Hi!
I'm new to python and having some troubles comming off java's very strict and formal OO approach. why does the following code snippet below throw this error, when I'm trying to call GenerateMoves() on an object?
NameError: global name 'CheckIfRegularMove' is not defined
i am trying to call the function CheckIfRegularMove inside of GenerateMoves
how do i call functions inside of a class in python? and a little of background if possible.
thank you in advance
class Position:
def __init__(self):
....
def GenerateMoves(self):
moves = []
#upper L moves:
if CheckIfRegularMove((2,-1)):
print "Yeyeyeah"
def CheckIfRegularMove(self,move):
tmp = (self.Loaction[0] + move[0], self.Loaction[1] + move[1])
tuple = (0,1,2,3)
if tmp[0] in tuple and tmp[1] in tuple:
return True
return False