File tree Expand file tree Collapse file tree 1 file changed +23
-5
lines changed
Expand file tree Collapse file tree 1 file changed +23
-5
lines changed Original file line number Diff line number Diff line change 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
914import pygame , sys
1015from pygame .locals import *
@@ -95,12 +100,14 @@ def available_square(row,col):
95100
96101#check board full or not
97102def 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
106113def 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 :
You can’t perform that action at this time.
0 commit comments