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]
4 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]4 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
As a computer science student, which career you will select and what do you predict about the future of that specific IT-Career.
miv72 [106K]

Answer:

A cyber security agent

Explanation:

That will mean protecting organizations from being hacked by other ethical hackers

4 0
3 years ago
Electronic business includes which of the following
Alja [10]

Answer:

D. all of these

Explanation:

5 0
3 years ago
Read 2 more answers
Why is it essential to know what information will be needed from the database from the outset of development?
KIM [24]

Answer:

all of the answers

Explanation:

According to my research on information technology, I can say that based on the information provided within the question all of the answers provided would be important pieces of information to know. This is because each provides information on another and all information possible is helpful in a development process.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

7 0
4 years ago
must understand both art and engineering. a. industrial designer b. environmental designer c. interior designer d. graphic desig
enot [183]
It's d. Graphic designer because they design things on the computer with code
7 0
3 years ago
While adding voices to an animation, what kind of room should you choose?
MrRissso [65]

Answer:

A. A quiet room

Explanation:

Because if you open the windows the will be noise

a huge room will echoe

a room with air conditioning will make noise

7 0
4 years ago
Other questions:
  • Hydropower uses moving water to do work, such as grinding grains in a mill. True False
    7·1 answer
  • Suppose a classmate constructed an electric motor with a solid commutator.that is, the commutator has no split. This solid commu
    9·1 answer
  • What term is given to pieces of computer software that allow you to manage your e-mail from your computer?
    12·1 answer
  • What type of device is the keyboard?<br><br> Output<br> Input<br> Monitoring<br> Software
    7·2 answers
  • A technician recently fixed a computer with several viruses and spyware programs on it and notices the Internet settings were se
    15·1 answer
  • A look to different section of the same page is known as_____.
    7·1 answer
  • A tiny spot on an LCD monitor display screen that permanently remains black when it should be activated and displaying color is
    12·1 answer
  • Select the correct answer from each drop-down menu.
    6·2 answers
  • Write, in your own words, a one-two paragraph summary on the Running Queries and Reports tutorials. Apply critical thinking and
    10·1 answer
  • Pls help I will give points
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!