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
This isn't a homework question but rather a technological problem. I connected my device to the motherboard but it will not dete
Helen [10]
Re start the computer again
5 0
3 years ago
Read 2 more answers
A storyboard is an example of an implementation tool.
alexdok [17]

Answer:

That's not true. A storyboard is an organizer to plan out certain things and to know how something should look before doing the finished product.

Explanation:

7 0
3 years ago
What does this mean, i am so confused- Explain the importance of identifying the purpose/use for pre-production documents
irina1246 [14]

Answer: These are mostly used in interior design, fashion design, and advertising. they are often used to generate ideas for a client to meet their approval before making the final product. It can help in terms of planning because it could be used to create a design or a theme.

Explanation: yw

4 0
2 years ago
When a signal travels across network medium, it signal loses strength the further it gets from the transmitting station, to the
neonofarm [45]

Answer:

Attenuation.

Explanation:

Attenuation means a gradual reduction in the strength of a signal as it moves from station to station which may even cause the receiving station to misinterpret the signal. Any signal can be attenuated - digital or analog.

Attenuation is often caused by weakness, fatigue or passiveness of networking cables and connectors. It could also be caused by noise and long distance.

To get around this, the network device(s) will often resend signals multiple times over just to ensure that at least one of the signals gets there and is interpreted correctly.

3 0
3 years ago
The points a b c and d lie on a straight line ab:bd = 1:4
pochemuha

The points a b c and d lie on a straight line ab:bd = 1:4 are A line that extends to infinity on both sides and has no curves is called a straight line.AB:BC=3:4.

<h3>What do you call a straight line?  </h3>

A line is simply an object in geometry denoted as an object with no width that extends on both sides. A straight line is just a line with no curves.

  • AC=AB+BC=3+4=7;  AC:CD=2:1, i.e. AC=2;   because we get 2 different lengths for AC, we change the given ratio AC:CD to an equivalent one with AC=7 .
  • As follows: AC:CD = 2 : 1 = 7 : 3.5 (multiply both sides by 3.5 )   Now we have AC:CD = 7 : 3.5 and AD = AC+CD= 7+3.5 = 10.5,, and the answer is: the ratio  BC:AD = 4:10.5.

Read more about the straight line:

brainly.com/question/3493733

#SPJ1

3 0
2 years ago
Other questions:
  • Discuss Hashing and how it is utilized within the IT industry. Also, discuss how Hashing can improve our sorting and searching r
    12·1 answer
  • What color model should Joe use if he will be using an offset printing press?
    7·1 answer
  • Technician A says that if you add pre-lube to a sealing lip of an axle seal, it will cause the seal to leak causing the bearings
    8·1 answer
  • Biomimicry is the term used when engineers are inspired by objects found in nature? Group of answer choices True False
    10·1 answer
  • Write a program that calculates the total amount of a meal purchased at a restaurant by a customer. The program should ask the u
    15·1 answer
  • What will happen when you drag and drop a worksheet tab into another workbook WITHOUT holding the Ctrl key down?
    13·2 answers
  • Write a calculate_sq_inches_of_good_pizza function that accepts the diameter of a pizza and returns the area of the pizza minus
    7·1 answer
  • State any three points of importance of local level profession​
    11·1 answer
  • Which of the following number is divisible by 3? (340 , 432 , 113)​
    7·1 answer
  • What defines the scope of a project?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!