Tags: %TAGME{ tpaction="" web="Main" tag="" }% view all tags

Lab 9 Tic Tac Toe

Moodle

522px-Tic_tac_toe.svg.png

Goal

To create tow player Tic Tac Toe game using classes, a matrix and using exceptions

Example

Consider the following game play:

1|2|3
-----
4|5|6
-----
7|8|9
Player X enter a move:1
1|2|3
-----
4|5|6
-----
7|8|9
Player X enter a move:1
X|2|3
-----
4|5|6
-----
7|8|9
Player O enter a move:2
X|O|3
-----
4|5|6
-----
7|8|9
Player X enter a move:3
X|O|X
-----
4|5|6
-----
7|8|9
Player O enter a move:2
(0,1) is taken!
Player O enter a move:d
Move must be a number!
Player O enter a move:20
Move must be in range 1-9!
Player O enter a move:4
X|O|X
-----
O|5|6
-----
7|8|9
Player X enter a move:5
X|O|X
-----
O|X|6
-----
7|8|9
Player O enter a move:6
X|O|X
-----
O|X|O
-----
7|8|9
Player X enter a move:7
X|O|X
-----
O|X|O
-----
X|8|9
Wow! X wins!

Program Shell Here is a start: https://repl.it/@JimSkon/TicTacToeStartClass

Complete this program with game play as seen above.

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2020-04-16 - JimSkon
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback