This is a simple tic tac toe game that runs in the command line.

Overview

Tic Tac Toe Game

This is a simple tic tac toe game that runs in the command line.

Game Description:

  • The game is made up of a square grid with 9 portions. Each portion represents a slot on which a symbol can be place, either an X or an O.

The game rules are simple; A player wins when his/her symbol is placed in a manner in which a straight line can be drawn to cross over the three symbols.


This game should allow two players to compete. In a later time, we will allow the computer to make decisions.


  • My game design

    • The game contains a list of 3 lists. This is so as to form a square array with 3 rows and 3 columns, each intersection of row and column having a special index number ranging from 1-9.

    • The gameplay is done in turns. When player 1 has played, it is player 2's turn.

    • Player 1 is automatically "X" as symbol while player 2 is assigned the "O".

    • The player's entry is a number between 1 & 9, the slot where his/her symbol is placed.

    • If a slot is empty, then it is represented a "_".

    • The game ends when either of the following happens;

      • A player wins
      • There is no possibility of winning
      • The program crashes, is interrupted or closed.

How do we know if a player has won ?

The has_player_won() function returns a boolean or a string. It returns a boolean enforced to False if there is no player who has won yet. On the other hand, it will return the winning player if a player has won.

# checks if a player has won
    # we are going to use the condition above
    # we will check the leading diagonals and a cross manner
    # we will know if a player (and which player) has won if
    # we can form a straight line with 3 consecutive symbols on the grid
    # if at a certain point, a symbol fails to be the same,
    # we stop checking and move on

    # How do we know a vertical or a horizontal is formed ?
    # This is pretty tricky
    # After thinking a little, I came up with the idea that
    # If we have 3 points whose _i_ value is the same, then it forms a horizontal line -> a win
    # In the case of 3 points with equal _j_ values, then it forms a vertical line -> still a win
    # For diagonals, it is much trickier

    # chech if player won along diagonals
    # the winning slot coordinates are
    # - [(0,0), (1,1), (2,2)] or [(0,2), (1,1), (2, 0)]

    # checking along the first diagonal

Plans

My future plan are to

  • Add the computer as a second player in case you have no friend to play it with
  • Create an online web-based multiplayer tic-tac-toe game with a leaderboard.
  • Train an unbeatable Tic Tac Toe AI ;)
Owner
Josias Aurel
Self-taught hobbyist developer. Coding for fun. Making things 😜
Josias Aurel
Tictactoe py tkinter canvas - Tic Tac Toe written in Python 3 with tkinter mainly using canvas

Python 3 Tic Tac Toe with tkinter This is a tkinter version of my Tic Tac Toe ga

Bojan Adzic 1 Jan 09, 2022
A fun discord bot for music, mini games, admin controls, economy, ai chatbot and levelling system

A fun discord bot for music, mini games, admin controls, economy, ai chatbot and levelling system. This bot was specially made for Dspark discord server.

2 Aug 30, 2022
Simple program to play Metamon automatically

Getting Started Radio Caca Important disclaimer This software is intended for use by individuals familiar with Python programming language. It uses se

Metamon Island 35 Dec 28, 2022
Allows you to email people wordle spoilers. Very beta, not as many features

wordlespoiler Allows you to email people wordle spoilers. Very beta, not as many features How to Use 1.) Make a new gmail account. Go to settings (Man

0 Jan 04, 2023
An single python server emulator of MMORPG game WindSlayer also known as WS1.

PySlayer An single python server emulator of MMORPG game WindSlayer also known as WS1. Requirements Python = 3.7 Old windslayer client (Korea Yahoo!

mirusu400 29 Dec 19, 2022
Implementation of Conway's game of life in python.

👾 👨🏻‍💻 Conway's Game of Life 👨🏻‍💻 👾 by FranciscoCharles An interactive simulator that implements the standard Conway Game of Life with a simpl

3 Oct 01, 2021
A chess engine with basic AI capabilities (search for best move using MinMax algorithm)

A chess engine with basic AI capabilities (search for best move using MinMax algorithm)

Ken Wu 1 Feb 02, 2022
A script to install a Windows game through GOG on Linux

proton-gog-install A script to install a Windows game through GOG on Linux. Based on this gist. Tested on Arch, might work elsewhere. Requirements: Im

5 Dec 28, 2022
Logo hitting the corner == best feeling ever!

Bouncing DVD logo - Pygame A little ride back to the 90s. Ah good ol' time! Didn't we all wait for the logo to hit the corners? Best feeling ever!! I

Hoang Nguyen 3 May 25, 2022
A small fun project to simulate Conway's Game of Life, created in Python.

A small fun project to simulate Conway's Game of Life, created in Python. Conway's Game of Life simulates a grid of cells, where the state of each cell consists of whether the cell is alive or dead.

Harrison Verrios 1 Jun 19, 2022
Implementation of the Spider-Man Game

Projeto FPRO FPRO/LEIC, 2021/22 Francisco Campos (up202108735) 1LEIC08 Objetivo Criar um clone do clássico Spider-Man em Pygame... Repositório de códi

1 Dec 24, 2021
Inflitator is a classic doom and wolfenstein3D like game made in Python, using the famous PYGAME module.

INFLITATOR Raycaster INFLITATOR is a raycaster made in Python3 with Pygame. It is a game built on top of a simple engine of the same name. An example

Zanvok Corporation 1 Jan 07, 2022
Sukoku-solver Python About Sudoku is one of the most popular puzzle games of all time

Sukoku-solver Python About Sudoku is one of the most popular puzzle games of all time. As a logic puzzle, Sudoku is also an excellent brain game. Bein

Harshith VH 1 Nov 20, 2021
PYGA: Python Google Analytics (ga.js) - Data Collection API

PYGA: Python Google Analytics - Data Collection API pyga is an implementation of Google Analytics (ga.js) in Python; so that it can be used at server

Arun Karunagath 136 Sep 19, 2022
A zombie game using Kinetic. You can control players using fingers

This is Eden Park's portpolio: Works, projects and practices This repository can be used to show the potential employers to check my works, code and p

Eden Park 4 May 16, 2022
Wordle-prophecy - The comprehensive list of all Wordle answers, past and future

About This repo contains the comprehensive list of all Wordle answers, past and

Hayden Moritz 2 Dec 15, 2022
A simple yet powerful Snake Game made with myPygameWorkflow

snakeGame A simple yet powerful Snake Game made with myPygameWorkflow. Requirments python3 Python.org myPygameWorkflow Github Ripo Usage $ cd main $ p

DuskyElf 1 Dec 26, 2021
Nerdle - a nerd's approach to solving Wordle

Nerdle - a nerd's approach to solving Wordle

4 Nov 28, 2022
Open source translation for the Tsukihime Remake game

Tsukihime-Translation Open source translation for the Tsukihime Remake game prepared by Clovermoon and Tsukihimates. Copyright Disclaimer under Sectio

118 Jan 01, 2023
Warden - Warden guessing game 1

Warden first python project and first posted project sorry for errors warden gue

hasher 3 Jan 09, 2022