1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
aniked [119]
3 years ago
7

A Python data model defining the state of a game for Tic-Tac-Toe. You must fully describe the notion of a state of the game, lim

iting yourself to the primitive data types of the Python Programming Language. In addition, you must use the notation for defining types discussed over the course of the semester, and provide a detailed description of your model.Using your data model, you are to define the following functions in Python:
game_title - given no arguments, returns a string which will be used as the window title for a Tic-Tac-Toe game in TPGE;
game_over - a relation on states which determines whether or not the game is over in a given state;initial_state - a function which given no arguments, returns the initial state of the game of Tic-Tac-Toe;successor_state - a function which given the state of a game and a point corresponding to a mouse-click within the game window, returns the next state of the game;
image_representation - a function which given the state of a game, returns a list of TPGE images needed to draw the state for the user(s)
Using your functions from (2), implement a graphical, 2-Player version of Tic-Tac-Toe using TPGE, by following the blueprint given in simple_game.py.
For each function that you implement (helper functions and primary functions), give the function signature using the notation discussed in class.
Computers and Technology
1 answer:
Artist 52 [7]3 years ago
8 0

Answer:

Check the explanation

Explanation:

Here in this game of Tic-Tac-Toe, it is using the TPGE engine which is a Tiny Python Game Engine. Let's talk about its functions like:-

def image_type(img): In this function, it is simply taking image as a parameter and returning its object type like DISC if the image is in graphical form, TEXT if it is a string, and LINE if it is other than the mentioned object.

def convert_image(img):  In this function, it is simply taking image as a parameter and returning an equivalent graphical object as understood by John Zelle's. Mainly comparing for three things in this function and those are: if image equals to DISC then it is calling convert_circle(function), if image equals to LINE then it is calling convert_line(function), and if image equals to TEXT then it is calling convert_text(function),

def convert_circle(x): This function takes a list( a group of values) and makes a circle at the center of the window and the circle's radius is coming from the list.

convert_text, convert_line, convert_circle are only creating text, line, and circle and then returning it.

def graphical_elements(images): This function is taking image as a parameter and then extracting shape and color from the image and then calling convert_image(shape) and convert_type(shape) and it gives us graphic and kind respectively. Now it is checking whether kind equals to DISC If yes then filling color on the window else, setting the outline of the window

def run(): Here it is finally running the game with required parameters, the whole game is continously running under the while loop.

That's all

You might be interested in
In which way is a worm different from a virius
dangina [55]
A worm as a multicell organism, but a virus is a single cell.
3 0
3 years ago
A computer game that can be purchased online and played right away has good _____ utility.
ratelena [41]
D. Time

It’s easy to access any time even after it was just purchased.

I hope this helped
6 0
3 years ago
The power of if worksheet
sergejj [24]
What are you talking about?
3 0
3 years ago
In the following scenario, which is the least
mario62 [17]

Answer:

Size

Explanation:

Connectivity, they need internet to work.

Speed, they need it to work fast.

Storage, they need space to work.

Size, isn't all that important, unlike the rest.

7 0
3 years ago
Early word processors ran on devices that look like digital
S_A_V [24]

Answer:

True

Explanation:

The word processor used to be the only office machine in the year 1960s, that combined the keyboard text-entry and various printing functions of an electric typewriter with the recording memory. And this recording unit was a tape or a floppy disk, with the simplest of processor applied for text editing. Hence, the above statement that the early word processors ran on the devices that look like digital is true.

6 0
3 years ago
Read 2 more answers
Other questions:
  • Write Java program to allow the user to input the amount of deposit, yearly interest rate (percentage), and income tax(percentag
    9·1 answer
  • Why is it important to not get distracted while driving?
    13·2 answers
  • Bulleted and Numbered List button appear in the ………….. Toolbar.​
    6·1 answer
  • What will empty the log of Internet sites you have recently viewed
    12·2 answers
  • A developer of a relational database refers to a file as a
    11·1 answer
  • Is this statement true or false?
    11·1 answer
  • If a triathlon is a sport combining three events, what do you think would be the word for a sport combining five events?
    7·1 answer
  • What term is used to refer to the requesting of information from a database?
    10·2 answers
  • I need help..
    15·1 answer
  • 8.5 Edhesive Code Practice
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!