You will practice:
- Python lists/arrays
- Creating a two dimensional matrix with Python
- Using the while loop to avoid your application from ending.
- Using conditionals.
- Implementing a CLI (command line interface).
Fill the content of the methods play
, check_for_winner
, new_game
and the commands inside the while needed to make the TicTacToe behave like this picture.
def play(position):
def check_for_winner():
def new_game():
- There are two players
X
andO
. X
always starts playing.- To make a play, the command its
play <position>
for example:play 1
will play for the current player on the position 1 in the list (the second one) - If
X
makes a play, it'sO
's turn (automatically) and vice-versa. - Every time aony player makes a play you have to check for winners.
- The game ends when any of the players finally makes a winning combination.
- The game can be reset (start again) any time.
- The user must stop the game and exit anytime (releasing the terminal).
- Clone this repository:
$ git clone https://github.com/breatheco-de/exercise-tictactoe-cli-python
- Run the app by typing on the terminal:
$ python3 app.py