ravipudi / python-noughts-and-crosses

Simple command line noughts and crosses (Tic-Tac-Toe) built in Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

python-noughts-and-crosses

Simple command line noughts and crosses (Tic-Tac-Toe) built in Python

python noughtsandcrosses.py

Example game output:


        + - - - +
        |       |
        |       |
        |       |
        + - - - +

Player 1's (O) turn
Input a position (1-9): 1

        + - - - +
        | O     |
        |       |
        |       |
        + - - - +

Player 2's (X) turn
Input a position (1-9): 2

        + - - - +
        | O X   |
        |       |
        |       |
        + - - - +

Player 1's (O) turn
Input a position (1-9): 7

        + - - - +
        | O X   |
        |       |
        | O     |
        + - - - +

Player 2's (X) turn
Input a position (1-9): 4

        + - - - +
        | O X   |
        | X     |
        | O     |
        + - - - +

Player 1's (O) turn
Input a position (1-9): 9

        + - - - +
        | O X   |
        | X     |
        | O   O |
        + - - - +

Player 2's (X) turn
Input a position (1-9): 5

        + - - - +
        | O X   |
        | X X   |
        | O   O |
        + - - - +

Player 1's (O) turn
Input a position (1-9): 8

        + - - - +
        | O X   |
        | X X   |
        | O O O |
        + - - - +

Player 0 has won the game!

About

Simple command line noughts and crosses (Tic-Tac-Toe) built in Python


Languages

Language:Python 100.0%