Skip to content

Update Tic_Tac_Toe.py #178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion Python/Tic_tac_toe.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import random
def tic_tac_toe():
p=["1","2","3","4","5","6","7","8","9"]
P1=None
Expand All @@ -20,7 +21,13 @@ def pattern():
p1='O'
print("Player1:You chose %c\n"%p1)
print("Player2:You chose %c\n"%p2)
print("Player1:You should start the game\n\n")
def tose():
choice=random.randint(0,1)
if choice==0:
print("Player1:You should start the game\n\n")
else:
print("Player2:You should start the game\n\n")
turn=tose()
def player_1():
while(1):
print("Player1:Place the position of %c\n"%p1)
Expand All @@ -43,6 +50,10 @@ def player_2():
else:
print("Player1:You chose a wrong cell\n")
continue
if turn==0:
player_1()
else:
player_2()
def game_win():
c=0
t=0
Expand Down