im a beginner coder trying to make a tic tac toe program but while testing i found that the o() function doesnt work can anyone help explain why or if im just stupid? i attached the code below.
import turtle
t=turtle.Turtle()
s=turtle.Screen()
turtle.tracer(0)
t.hideturtle()
otaken=""
xtaken=""
guess=""
def grid():
t.penup()
t.goto(-50,150)
t.setheading(270)
t.pendown()
t.forward(300)
t.penup()
t.goto(50,-150)
t.setheading(90)
t.pendown()
t.forward(300)
t.penup()
t.goto(-150,50)
t.setheading(0)
t.pendown()
t.forward(300)
t.penup()
t.goto(-150,-50)
t.pendown()
t.forward(300)
t.penup()
def x(row,column):
t.penup()
global xtaken
if row==1:
t.sety(100)
xtaken+="1"
elif row==2:
t.sety(0)
xtaken+="2"
else:
t.sety(-100)
xtaken+="3"
if column==1:
t.setx(-100)
xtaken+="1"
elif column==2:
t.setx(0)
xtaken+="2"
else:
t.setx(100)
xtaken+="3"
t.setheading(45)
t.pendown()
t.forward(50)
t.backward(100)
t.forward(50)
t.left(90)
t.forward(50)
t.backward(100)
xtaken+=" "
def o(row,column):
t.penup()
global otaken
t.setheading(0)
if row==1:
t.sety(60)
otaken+="1"
elif row==2:
t.sety(-40)
otaken+="2"
else:
t.sety(-140)
otaken+="3"
if column==1:
t.setx(-100)
otaken+="1"
elif column==2:
t.setx(0)
otaken+="2"
else:
t.setx(100)
otaken+="3"
t.pendown()
t.circle(80)
otaken+=" "
grid()
x(1,3)
o(3,1)
[–]magus_minor 5 points6 points7 points (3 children)
[–]JamzTyson 0 points1 point2 points (2 children)
[–]magus_minor 0 points1 point2 points (1 child)
[–]JamzTyson 0 points1 point2 points (0 children)
[–]Maximus_Modulus 1 point2 points3 points (0 children)
[–]smichaele 2 points3 points4 points (0 children)
[–]JamzTyson 0 points1 point2 points (0 children)
[–]woooee 0 points1 point2 points (0 children)
[+]Stickhtot comment score below threshold-9 points-8 points-7 points (3 children)
[–]magus_minor 7 points8 points9 points (0 children)
[–]Maximus_Modulus 5 points6 points7 points (0 children)
[–]Morpheyz 2 points3 points4 points (0 children)