Last active
February 5, 2023 01:29
-
-
Save NicolaM94/ae4e0e850250a6974042b0ac72be7585 to your computer and use it in GitHub Desktop.
Pawn class in python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MAX_X = 8 | |
MAX_Y = 8 | |
class Pawn: | |
def __init__(self,x,y): | |
self.x = x | |
self.y = y | |
def possibleMoves(self): | |
moves = [] | |
if self.x+1 <= MAX_X and self.y <= MAX_Y: | |
moves.append((self.x+1,self.y+1)) | |
if self.x-1 > 0 and self.y <= MAX_Y: | |
moves.append((self.x-1,self.y+1)) | |
return moves |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment