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
A ____ is a key-dependent, one-way hash function that allows only specific recipients(symmetric key holders) to access the messa
Alexxx [7]

Answer: (C) MAC

Explanation:

MAC is stand for the message authentication code and it is one of the key dependent hash function. Message authentication provide the data integrity and also the origin of data authentication.

  • It basically allow the specific recipients known as the holder of the symmetric key.
  • The message authentication code uses the CBC (Cipher block chaining) mode for constructing the MAC algorithm and it also uses the block cipher for the conjunction by using the CBC operations.    

On the other hand, all the options are incorrect as they are not the key dependent hash function.

Therefore, Option (C) is correct.

7 0
3 years ago
Which of the following are safety guidelines when socializing online?
DochEvi [55]

Answer:

All of them execpt five and three.

Explanation:

It is okay to have social media and receive messages.

3 0
2 years ago
A gamer typing their name into the computer is an example of:
vova2212 [387]

user input I think I'm not sure though

3 0
2 years ago
Read 2 more answers
"Your friend is having a birthday and you want to create a slide-show presentation with pictures of her that you have saved on y
OleMash [197]
Could you be more specific? So I can help you in the best way I can.
5 0
3 years ago
Can anyone help???
Ugo [173]

Answer: Protocol identifier

Explanation:

Just took the test and resource name was incorrect. Hope this helps :)

6 0
2 years ago
Read 2 more answers
Other questions:
  • A disk rotates at a rate of 7200 revolutions per minute. Seek operations (i.e., moving the access head to a desired track) take
    6·1 answer
  • A series circuit and identify how voltage is split up by each load in the circuit?
    11·1 answer
  • "The pkill command terminates _________."
    14·1 answer
  • Gmod how to make someone admin on a lan server
    6·2 answers
  • Linda subscribes to a cloud service. The service provider hosts the cloud infrastructure and delivers computing resources over t
    10·1 answer
  • Given a vector of students, the function FinalAvg is supposed to return the average final exam score across all the students in
    6·1 answer
  • How do you close a file?
    12·2 answers
  • What are binary code​
    7·2 answers
  • How do you make a ringtone on earsketch
    9·1 answer
  • How each programming language differs in terms of constructs, techniques, use and requirements?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!