Skip to content

Commit 48294ef

Browse files
author
IshanRastogi2608
committed
Add Comments
1 parent 9998b49 commit 48294ef

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

main.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# GAME LOGIC
55
# --------------------------------------------------------------------------
66

7-
# global constants
7+
# CREATING CONSTANTS AND VARIABLES
88
MARK1 = 'O'
99
MARK2 = 'X'
1010

@@ -13,6 +13,7 @@
1313
player1 = ''
1414
player2 = ''
1515
current_player_identifier = 0
16+
# winning conditions
1617
wins = [
1718
[(0, 0), (0, 1), (0, 2)],
1819
[(1, 0), (1, 1), (1, 2)],
@@ -23,11 +24,15 @@
2324
[(0, 0), (1, 1), (2, 2)],
2425
[(0, 2), (1, 1), (2, 0)]
2526
]
27+
# places to mark. If it is false, user can place his mark else not
2628
check_table = [[False, False, False],
2729
[False, False, False],
2830
[False, False, False]]
31+
# variable to stop users form placing their marks
2932
game_over = False
3033

34+
# DEFINING FUNCTIONS
35+
3136

3237
def set_initials(name1, name2):
3338
global current_mark, player1, player2, current_player_identifier
@@ -152,7 +157,8 @@ def display_game_board(val1, val2):
152157
# GAME User Interface
153158
# --------------------------------------------------------------------------
154159

155-
# font styles
160+
# UI VARIABLES AND CONSTANTS
161+
# fonts
156162
BODY = ("Arial", 16, "normal")
157163
HEAD = ("Courier", 20, "bold")
158164
GIANT = ("Arial", 50, "bold")
@@ -166,7 +172,8 @@ def display_game_board(val1, val2):
166172
rows = {0: 0, 2: 1, 4: 2}
167173
cols = {1: 0, 3: 1, 5: 2}
168174

169-
# Create a window
175+
# CREATE WIDGETS
176+
# create the window
170177
window = tk.Tk()
171178
window.title("Welcome to Tic Tac Toe")
172179
window.geometry("640x427")

0 commit comments

Comments
 (0)