Skip to content

Commit 57b408f

Browse files
Update TicTacToe.py
1 parent da2d538 commit 57b408f

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

TicTacToe-GUI/TicTacToe.py

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
# -*- coding: utf-8 -*-
22
"""
3-
Tic Toe Using pygame , numpy and sys with Graphical User Interface
3+
Created on Sat Apr 10 19:44:45 2021
44
5+
@author: Lakhan Kumawat
56
"""
67

8+
# -*- coding: utf-8 -*-
9+
"""
10+
Tic Toe Using pygame , numpy and sys with Graphical User Interface
711
12+
"""
813

914
import pygame, sys
1015
from pygame.locals import *
@@ -95,12 +100,14 @@ def available_square(row,col):
95100

96101
#check board full or not
97102
def is_board_full():
103+
k=False
98104
for row in range(board_rows):
99105
for col in range(board_columns):
100106
if board[row][col]==0:
101-
return False
107+
k=False
102108
else:
103-
return True
109+
k=True
110+
return k
104111

105112

106113
def check_win(player):
@@ -197,10 +204,21 @@ def restart():
197204
screen.blit(text, textRect)
198205
screen.blit(leave,leaveRect)
199206
player=player%2 +1
200-
207+
if not game_over :
208+
Won= font.render("Player"+str(player)+" Turn", True ,blue,green)
209+
screen.blit(Won, winRect)
210+
draw_figures()
211+
212+
"""
213+
if is_board_full():
214+
Won= font.render(" It's a Tie ", True ,blue,green)
215+
screen.blit(Won, winRect)
216+
screen.blit(text, textRect)
217+
screen.blit(leave,leaveRect)
218+
"""
201219

202220

203-
draw_figures()
221+
204222
#to restart the game
205223
if event.type==pygame.KEYDOWN:
206224
if event.key==pygame.K_r:

0 commit comments

Comments
 (0)