Disclaimer: I'm a bit of a newbie so this may very well be just a stupid oversight of mine (although, I suppose that would make this issue easier to solve)
When I run the following code:
xoro = [0 for i in range(9)]
checkeD = [False for i in range(9)]
potplay = 0
def checkeR(box_x): #This checks if a move has been played in a given box.
global checkeD
print(xoro[int(box_x)]) #prints "0", as no augmentations were made to xoro since declaration
if xoro[int(box_x)] == 1 or 4:
checkeD[int(box_x)] = True
checkeR(0)
print(checkeD[0])
What should happen is when xoro[0]
is passed through the if statement, since xoro[0] = 0 and does not fit the if statement's requirements, checkeD[0] should remain false, yet when run, the code returns checkeD[0] = True. What's more interesting is that when we remove the or
operator, making the if statement if xoro[int(box_x)] == 1:
, the code works as expected, returning False.
I have absolutely no idea what is going on it it would be great if someone helped.