Python Programming

Description:  For project 4 let’s build a text-based Tic Tac Toe program.  After each player moves, re-display the new board.  Let’s have users enter a row number and a column number to put their X or O on the board.

We want the program to determine the winner or a draw.  We also want the program to enforce the rule that a player can only put his X or O in an empty position.  I would also like the option to have 2 humans play or have a human play against the computer.

 

Sample 1

This program will play tic tac toe.

 

Enter 1 for a 1-player game.  Enter 2 for a 2-player game.

>> 1

 

cols

1 2 3

r 1 | |

o  -+-+-

w 2 | |

s  -+-+-

3 | |

 

Player 1 enter the row number of where you would like to go?

>> 1

Player 1 enter the column number of where you would like to go?

>> 2

 

cols

1 2 3

r 1 |X|

o  -+-+-

w 2 | |

s  -+-+-

3 | |

 

Computer’s turn.

 

cols

1 2 3

r 1 |X|

o  -+-+-

w 2 |O|

s  -+-+-

3 | |

 

 

Player 1 enter the row number of where you would like to go?

>> 2

Player 1 enter the column number of where you would like to go?

>> 2

 

Error:  Someone has already gone there.  Please try again.

Player 1 enter the row number of where you would like to go?

>> 2

Player 1 enter the column number of where you would like to go?

>> 3

 

cols

1 2 3

r 1 |X|

o  -+-+-

w 2 |O|X

s  -+-+-

3 | |

 

Computer’s turn.

 

cols

1 2 3

r 1 |X|

o  -+-+-

w 2 |O|X

s  -+-+-

3O| |

 

 

Player 1 enter the row number of where you would like to go?

>> 4

Error:  You can only enter a value from 1 to 3.

Player 1 enter the row number of where you would like to go?

>> 3

Player 1 enter the column number of where you would like to go?

>> 3

 

cols

1 2 3

r 1 |X|

o  -+-+-

w 2 |O|X

s  -+-+-

3O| |X

 

Computer’s turn.

 

cols

1 2 3

r 1 |X|O

o  -+-+-

w 2 |O|X

s  -+-+-

3O| |

 

The computer won!  Game over!

 

 

Hints:

Here are some hints.  Begin slowly and create and test different pieces of the software; don’t just try to build it in one sitting.  Use function decomposition to break the problem (and program) into smaller manageable pieces.

I will give additional hints in future weeks.

 

Turn In:

  1. Turn in the program source code as a .py file.

Grading Criteria:

This program is worth 100 points.  Points will be distributed via the following table:

  • The program draws the board correctly. (10 points)
  • The program prompts the user for a row and column. (10 points)
  • If a user enters an incorrect row or column number, the program lets them re-enter it. (10 points)
  • The program places the correct symbol (X or O) in the correct position.  (10 points)
  • The program prevents a user from placing their symbol on a non-empty position. (10 points)
  • The program correctly identifies a winner. (10 points)
  • The program correctly identifies a draw. (10 points)
  • The program simulates a computer opponent correctly. (10 points)
Order a unique copy of this paper
(550 words)

Approximate price: $22

Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency

Order your paper today and save 10% with the discount code HDCOVID10