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
What will be the value of x after the following loop terminates?
Katena32 [7]

Answer:

10

Explanation:

This for-loop is simply iterating three times in which the value of x is being set to the value of x * 1.  So let's perform these iterations:

x = 10

When i = 0

x = x * 1 ==> 10

When i = 1

x = x * 1 ==> 10

When i = 2

x = x * 1 ==> 10

And then the for-loop terminates, leaving the value of x as 10.

Hence, the value of x is equal to 10.

Cheers.

7 0
3 years ago
What are the guided and unguided transmission media and what are the differences?
Ludmilka [50]

Answer:  They are forms of of carrying data from communication devices. The difference is the medium where the signal travels.

Explanation:

Hi, the difference between guided and unguided media is that in the guided media, the signal travels through a physical medium whereas, in unguided media, the signal travels through the air.  

Guided and unguided media are types of transmission media.

The transmission media carries electromagnetic signals, that transmit data between communicating devices like computers.

4 0
3 years ago
Friedman (1999) argues that "we are wrong to base health promotion in all societies on a Western framework for human development
Dovator [93]

Answers with Explanation:

A. Give at least two reasons why he believes this.

Friedman believes that health promotion based on Western framework for human development<em> unfairly criticizes the other cultures in the society.</em> Western framework values intellectual and economic achievements alone, which then <em>results to putting a great expense on the other essential human qualities.</em>

B. What crisis does he believe is happening in the most economically developed countries?

The crisis that is happening in the most economically developed country is the <em>devaluing of the other aspects which other human beings value in terms of individuality or families.</em>

C. What does he recommend to improve the programming for adolescent health?

He recommends that if changes were to be implemented for adolescent's health, <u>these have to be properly assessed regarding their effect on the adolescent's development,</u> including his/her family and other social relationships. Next is to check whether<u> it doesn't conflict with the adolescent's culture in the community that he belongs</u>. If it does, then it is essential to change it or find <em>another way which fosters</em><em> </em><em>the same goal.</em>

7 0
3 years ago
A company wishes to increase security at the employee entrance. Which of the following technologies would be the most useful?
AVprozaik [17]
I believe a metal detector would be a fine choice for an employee entrance. 
5 0
3 years ago
Read 2 more answers
In computer science how can you define "copyright, designs and patents act 1988"?​
Natali5045456 [20]

Answer:

:)

Explanation:

Copyright Designs and Patents Act

The Copyright Designs and Patents Act (1988) gives creators of digital media the rights to control how their work is used and distributed. ...

Anything which you design or code is automatically copyrighted and may not be copied without your permission, as the digital creator.

5 0
2 years ago
Other questions:
  • Which part of the os provides users and applications with an interface to manipulate files?
    8·1 answer
  • The Circle of Growth
    10·1 answer
  • What is the purpose of system calls, and how do system calls relate to the OS and to the concept of dual-mode (kernel-mode and u
    14·1 answer
  • 12. When trying to identify the sorted column in a table, you would look for the column where A. an arrow is displayed in the fi
    10·2 answers
  • How do I use this without the spring?
    6·1 answer
  • How do you change a account on an iPod generation 5
    10·1 answer
  • What two pieces of information would you need in order to measure the masses of stars in an eclipsing binary system?
    9·1 answer
  • Ok so this question is kinda weird but does anyone know what google drive is. If so how do you upload a video to it?
    11·2 answers
  • A bastion host allows the firewall to connect to the internal network and the perimeter network.TrueFalse
    15·1 answer
  • Write a program to demonstrate circular linked list with operations using pointers – insert
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!