/tic-tac-toe-game

TicTacToe game implementation in Python

Primary LanguagePython

TicTacToe Game

This is a small personal project for a fun little TicTacToe game with Tkinter and Python.

Gameplay

Tic-tac-toe is a game for two players, cross 'X' and naught 'O', who take turns marking the spaces in a 3×3 grid. Each player occupies a cell in turn. The goal is to place all three marks in a horizontal, vertical, or diagonal row.

Approach

The code is divided in two parts. Part one contains all the functions and Part 2 the initialization:

Part 1: Functions

1 - FUNCTION onclick_event => this event is triggered when user clicks a button
     Function to find a button by its name
     Function to set button's value (X or O)
     Function to check game over
2 - FUNCTION getting_button_value => Returns button value/text (X or O)
3 - FUNCTION checking_game_over  => Returns True or False
4 - FUNCTION resetting_game => Clears all buttons text

Part 2: Initializing Tic Tac Toe game

 1 - Creating and setting window properties
 2 - Creating font
 3 - Declaring initial value (X)

Demo

print