CSC 250 - Tic Tac Toe

In this assignment you will be implementing a text-based version of the popular tic-tac-toe game!

Tic Tac Toe board

The game will be played by entering in inputs to the program and printing out the status of the game to the user. When the game first begins, the following message will be printed to the console:

~~~~~~~~~~~~~~~~~~~~~~
Welcome to Tic-Tac-Toe
~~~~~~~~~~~~~~~~~~~~~~

After this, the game will begin, and the X and O players will alternate taking turns, starting with X. At the beginning of each turn, the current status/layout of the board will be printed. At the beginning of the game, the board has no Xs or Os on it, so a blank board status will look like so:

The board currently is:
/-----\
| | | |
-------
| | | |
-------
| | | |
\-----/

After the summer, your program should ask the current player for the row/column that they want to place the player at. This should look like so:

player X enter row: ?
player X enter col: ?

or . . .

player O enter row: ?
player O enter col: ?

The two players (X and O) will continue antering row/column values back and forth until one of the two players has won. In-between each move, the updated board will be printed.

Here’s an example of the first two moves of a full game:

~~~~~~~~~~~~~~~~~~~~~~
Welcome to Tic-Tac-Toe
~~~~~~~~~~~~~~~~~~~~~~

The board currently is:
/-----\
| | | |
-------
| | | |
-------
| | | |
\-----/
player X enter row: 2
player X enter col: 2
The board currently is:
/-----\
| | | |
-------
| |X| |
-------
| | | |
\-----/
player O enter row: 1
player O enter col: 3
The board currently is:
/-----\
| | |O|
-------
| |X| |
-------
| | | |
\-----/
player X enter row:

Notice the way in which the board updates on each turn.

You do not have to worry about the following edge/error cases:

Development Strategy and Design

When writing your code,, you should split up the logic into several function, each with a distinct task. Below are the functions you should use:

You are not required to follow this pattern. However, you are required to split your logic up into at least 4 functions, some of which should user parameters and returns.

You should also include a header comment, with a detailed description of the game. Name your program ttt.py.

Turning In

This program is due 2/12/2018 at 5:00pm. Turn in the program to the associated D2L dropbox.

Examples

Below are several example sequences of a game being played from start-to-finish.

~~~~~~~~~~~~~~~~~~~~~~
Welcome to Tic-Tac-Toe
~~~~~~~~~~~~~~~~~~~~~~

The board currently is:
/-----\
| | | |
-------
| | | |
-------
| | | |
\-----/
player X enter row: 2
player X enter col: 2
The board currently is:
/-----\
| | | |
-------
| |X| |
-------
| | | |
\-----/
player O enter row: 1
player O enter col: 3
The board currently is:
/-----\
| | |O|
-------
| |X| |
-------
| | | |
\-----/
player X enter row: 2
player X enter col: 1
The board currently is:
/-----\
| | |O|
-------
|X|X| |
-------
| | | |
\-----/
player O enter row: 3
player O enter col: 3
The board currently is:
/-----\
| | |O|
-------
|X|X| |
-------
| | |O|
\-----/
player X enter row: 2
player X enter col: 3
The board currently is:
/-----\
| | |O|
-------
|X|X|X|
-------
| | |O|
\-----/
Player X wins!
~~~~~~~~~~~~~~~~~~~~~~
Welcome to Tic-Tac-Toe
~~~~~~~~~~~~~~~~~~~~~~

The board currently is:
/-----\
| | | |
-------
| | | |
-------
| | | |
\-----/
player X enter row: 3
player X enter col: 2
The board currently is:
/-----\
| | | |
-------
| | | |
-------
| |X| |
\-----/
player O enter row: 1
player O enter col: 1
The board currently is:
/-----\
|O| | |
-------
| | | |
-------
| |X| |
\-----/
player X enter row: 2
player X enter col: 2
The board currently is:
/-----\
|O| | |
-------
| |X| |
-------
| |X| |
\-----/
player O enter row: 1
player O enter col: 2
The board currently is:
/-----\
|O|O| |
-------
| |X| |
-------
| |X| |
\-----/
player X enter row: 3
player X enter col: 3
The board currently is:
/-----\
|O|O| |
-------
| |X| |
-------
| |X|X|
\-----/
player O enter row: 1
player O enter col: 3
The board currently is:
/-----\
|O|O|O|
-------
| |X| |
-------
| |X|X|
\-----/
Player O wins!