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
How to remove negative feedback on amazon?
Svetlanka [38]
1. go back to the feedback you submitted
2.Locate the order, and then click remove 
3.select a reason for the removal and click to remove the feedback button.

(But why would you write a rude comment in the first place to begin with?)
3 0
3 years ago
Data is best described as
viktelen [127]

Answer:

The answer is B

Explanation:

TOOK THE TEST

5 0
3 years ago
Read 2 more answers
What type of expense generally covers performing and producing elements?
Paraphin [41]

Answer:

You might think expenses are expenses. If the money's going out, it's an expense. But here at Fiscal Fitness, we like to think of your expenses in four distinct ways: fixed, recurring, non-recurring, and whammies (the worst kind of expense, by far).

7 0
3 years ago
What are examples of scanning devices?
eimsori [14]

Here the examples of scanning devices :

  • Drum Scanner.
  • Handheld Scanner.
  • Flatbed Scanner.
  • Optical Character Recognition.
  • Magnetic Ink Character Recognition.
  • Image Scanner.

<h3>What is meant by scanning ?</h3>
  • A text is scanned quickly in order to find a specific piece of information. In daily life, scanning is regularly used for tasks like looking up a word in a dictionary or finding a friend's name in your phone's contacts list.
  • Scanners may basically be divided into three categories. These consist of network scanning, port scanning, and vulnerability scanning.
  • There are three different types of scanners: portable scanners, flatbed scanners, and drum scanners. While flatbed scanners are commonly used in offices and classrooms, drum scanners are mainly used in the publishing industry to print high-quality pictures.
  • Three processes make up the basic scanning process: scan, register, and detail.

Learn more about scanning refer to :

brainly.com/question/25106178

#SPJ4

4 0
1 year ago
With all of the digital data being collected today the size and number of databases are exploding. this volume of data is often
miss Akunina [59]

With all the digital data being collected today, the size and number of databases are exploding. This volume of data is often called blank big data.

<h3>What is digital data?</h3>

Digital data is the form of data that is digitalized or in digital form. These data are stored in memory cards or chips in the devices. This information is in the form of encryption codes.

The data from human language is converted into computer language. The computer language is in the form of binary codes. The form is 100101010. The language is understood by the computer.

Thus, the volume of data is often called blank big data.

To learn more about digital data, refer to the link:

brainly.com/question/21090939

#SPJ4

7 0
1 year ago
Other questions:
  • What are the main types of computer software?
    5·2 answers
  • A(n) file management system is a program that allows the creation of individual database tables, each of which is stored in its
    5·1 answer
  • The _______ contains the most commonly used commands.
    6·2 answers
  • Convert pounds to ounces.
    11·2 answers
  • WILL GIVE BRAINLIEST! The command simplify is used if you only want the first two digits of a decimal to appear in the interpret
    13·1 answer
  • What type of app is Drake designing? Drake is designing a mobile app for an online travel blog. The app will enable browsers to
    5·1 answer
  • 4.8 code practice question 1 edhesive
    8·2 answers
  • Explain how you think robotics plays a part in the subway driver's job.
    13·2 answers
  • Explain why the receptionist responded as indicated in the following scenario.
    8·1 answer
  • You are the security analyst for your organization and have discovered evidence that someone is attempting to brute-force the ro
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!