Skip to content

kevin-sia/tic-tac-toe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Tic-Tac-Toe in Python

Using the framework from an assignment from Jose Portilla's Python Bootcamp course on Udemy, I created a simple tic-tac-toe game in Python. I decided to take it a step further and make it an exercise for myself in writing proper functions (with docstrings), loops, and defensive code.

If you have any questions, comments, or suggestions, please feel free to connect with me via LinkedIn or e-mail (kevinsia92@gmail.com).


Playing the Game

Open the tic_tac_toe.ipynb notebook in Jupyter Notebook or JupyterLab. If neither are installed, web versions are available here. If you are using Jupyter Notebook or JupyterLab on the web, you will have to upload the notebook to the Jupyter directory.

Once the notebook is open, run all cells to define the game functions and begin playing the game in the last cell. The game steps are as follows:

  1. Player 1 chooses their marker (X or O), and Player 2 is assigned the marker that wasn't chosen
  2. A random number generator determines which player goes first
  3. Players take turns by indicating which position on the game board they want to place their marker on, attempting to win by filling a row/column/diagonal with only their marker
  4. Once a player wins, they are prompted to replay or not

Next Steps

Future work would involve finding a way to deploy this game to a simple website.