Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Below is python code template and problem. ----------------------------- ''' Enter the module docstring here ''' import tkinter import random class Game(object): ''' Enter the class

Below is python code template and problem. -----------------------------

'''

Enter the module docstring here

'''

import tkinter

import random

class Game(object):

'''

Enter the class docstring here

'''

# Add your class variables if needed here - square size, etc...)

def __init__(self, parent):

parent.title('Tic Tac Toe')

# Create the restart button widget

# Create a canvas widget

# Create a label widget for the win/lose message

# Create any additional instance variable you need for the game

pass # take out the pass statement and enter your code

def restart(self):

# This method is invoked when the user clicks on the RESTART button.

pass # take out the pass statement and enter your code

def play(self, event):

# This method is invoked when the user clicks on a square.

pass # take out the pass statement and enter your code

def main():

# Instantiate a root window

# Instantiate a Game object

# Enter the main event loop

pass # take out the pass statement and enter your code

if __name__ == '__main__':

main() -------------------------

Python with Tic-tac-toe is a game for two players. The players take turns marking the spaces in a 33 grid. The player who succeeds in placing three marks in a horizontal, vertical, or diagonal row wins the game.

Tic Tac Toe RESTART

You will implement a Graphical User interface for a Tic Tac Toe game with the following specifications:

The user will play against the computer.

The user is assigned one color and the computer is assigned another color. These may be any 2 colors of your choice.

The user always starts playing first. The user marks a space on the grid by clicking on that space. That space is then colored with the users assigned color. The computer immediately plays its move by coloring an available space with the other color.

If the user attempts to mark a space that is already taken, either by the user or the computer, nothing happens.

The game goes on until one player (the user or the computer) has 3 colored spaces in a line. The line can be horizontal, vertical, or diagonal. The game can also end in a tie if the entire board fills with no player completing such a line.

The player is given the option to restart the game, at any point during a game or after a win, a loss or a tie.

Simulation:

https://youtu.be/Z8nQ97pDiSY

tictactemplate.py

student submitted image, transcription available below

Tic Tac Toe RESTART

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 22nd European Conference Adbis 2018 Budapest Hungary September 2 5 2018 Proceedings Lncs 11019

Authors: Andras Benczur ,Bernhard Thalheim ,Tomas Horvath

1st Edition

3319983970, 978-3319983974

More Books

Students also viewed these Databases questions

Question

3. Who would the members be?

Answered: 1 week ago

Question

What was the role of the team leader? How was he or she selected?

Answered: 1 week ago