I'm writing a Tic Tac Toe AI and have a problem with a function that I want to define. It can be simplified to something like:
z = True
X = 1
y = 2
def place(X,y):
if z = True:
if X == 1:
x = y
(please note, I made some of my x'es capital just to make it easier to differentiate them for this post). The problem here is that I need to assign the value of y to X, but in the "x=y" statement, I'm given an error that x is a local variable not used, like if the x in that IF
statement is local only to that IF
statement, and is not connected.
A test with it showed that after the function was run, the X was unchanged, and printed the old value. No error is given in the function before that, only the one marked as x is local. What can I do to fix this so that x and X actually share values?
I have tried making go through other variables, but that didn't work. I have tried to use the global function on a value to lead it through, but that didn't work either.