Tic-Tac-Toe Program Development for Two Players, Assignments of Computer Science

The requirements for developing a tic-tac-toe program that allows two users to play against each other. The program should validate user moves and print a winning message or a message indicating a cat's game if applicable. A sample run of the program.

Typology: Assignments

Pre 2010

Uploaded on 02/24/2010

koofers-user-1iw
koofers-user-1iw 🇺🇸

9 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
COP 3223 Make Up Program #5
Write a program that allows two users to play tic-tac-toe against each other. Your
program should allow each user to either the row and column of their move, and make
sure that valid values are entered. Also, if there is a winner, your program should print
out a message to that effect right after the winning move. If the game is a cats game, your
program should print a message out to that effect after the board is filled. Here is a
sample run:
Player #1(X) enter your move, row followed by column:
0 1 2
0 _ _ _
1 _ _ _
2 _ _ _
1 1
Player #2(O) enter your move, row followed by column:
0 1 2
0 _ _ _
1 _ X _
2 _ _ _
1 1
Sorry, that is not a valid move. Try again.
0 0
Player #1(X) enter your move, row followed by column:
0 1 2
0 O _ _
1 _ X _
2 _ _ _
2 2
Player #2(O) enter your move, row followed by column:
0 1 2
0 O _ _
1 _ X _
2 _ _ X
pf2

Partial preview of the text

Download Tic-Tac-Toe Program Development for Two Players and more Assignments Computer Science in PDF only on Docsity!

COP 3223 Make Up Program # Write a program that allows two users to play tic-tac-toe against each other. Your program should allow each user to either the row and column of their move, and make sure that valid values are entered. Also, if there is a winner, your program should print out a message to that effect right after the winning move. If the game is a cats game, your program should print a message out to that effect after the board is filled. Here is a sample run: Player #1(X) enter your move, row followed by column: 0 1 2 0 _ _ _ 1 _ _ _ 2 _ _ _ 1 1 Player #2(O) enter your move, row followed by column: 0 1 2 0 _ _ _ 1 _ X _ 2 _ _ _ 1 1 Sorry, that is not a valid move. Try again. 0 0 Player #1(X) enter your move, row followed by column: 0 1 2 0 O _ _ 1 _ X _ 2 _ _ _ 2 2 Player #2(O) enter your move, row followed by column: 0 1 2 0 O _ _ 1 _ X _ 2 _ _ X

Player #1(X) enter your move, row followed by column: 0 1 2 0 O _ _ 1 O X _ 2 _ _ X 2 0 Player #2(O) enter your move, row followed by column: 0 1 2 0 O _ _ 1 O X _ 2 X _ X 0 2 Player #1(X) enter your move, row followed by column: 0 1 2 0 O _ O 1 O X _ 2 X _ X 2 1 Player #1 wins! Here is the final game board: 0 1 2 0 O _ O 1 O X _ 2 X X X