Create a two-player tic-tac-toe game in Ruby.
- Must define at least two classes
- Must define at least one exception class
- Must use at least one
Array - Must use at least one
Hash - Must announce the winner when one player wins (three
Xs orOs in a row, up, down, or diagonal) - Must announce that the game ends in a tie if there are no available moves
Draw a game board using pipes (|) and dashes (-) that looks like this:
1 | 2 | 3
-----------
4 | 5 | 6
-----------
7 | 8 | 9
Then prompt the player to use enter a number.
For example, if the first player enters 5, replace the 5 with an X. If the second player enters 9, replace the 9 with an O. If those are the first two moves, the board should look like this:
1 | 2 | 3
-----------
4 | X | 6
-----------
7 | 8 | O
If you finish early, try creating a one-player tic-tac-toe game that you can play against the computer. Try to make your artificial intelligence unbeatable.