Compare commits
No commits in common. "7cf4d903361e6a192f0efd42226115b3b153d2fc" and "05cad13ed5725a99c69ab3965b6c0dc0c93bd0f5" have entirely different histories.
7cf4d90336
...
05cad13ed5
1 changed files with 3 additions and 0 deletions
|
|
@ -15,13 +15,16 @@ def printBoard(boardInput):
|
||||||
def possibleMoves(inputCoords, boardInput):
|
def possibleMoves(inputCoords, boardInput):
|
||||||
maxLen = len(boardInput) - 1
|
maxLen = len(boardInput) - 1
|
||||||
moveList = []
|
moveList = []
|
||||||
|
|
||||||
# possible moves: (x+1, y), (x-1, y), (x, y+1), (x, y-1), (x+1, y+1), (x-1, y-1), (x+1, y-1), (x-1, y+1)
|
# possible moves: (x+1, y), (x-1, y), (x, y+1), (x, y-1), (x+1, y+1), (x-1, y-1), (x+1, y-1), (x-1, y+1)
|
||||||
possibleMoves = [(1, 0), (-1, 0), (0, 1), (0, -1), (1, 1), (-1, -1), (1, -1), (-1, 1)]
|
possibleMoves = [(1, 0), (-1, 0), (0, 1), (0, -1), (1, 1), (-1, -1), (1, -1), (-1, 1)]
|
||||||
|
|
||||||
for move in possibleMoves:
|
for move in possibleMoves:
|
||||||
newX = inputCoords[0] + move[0]
|
newX = inputCoords[0] + move[0]
|
||||||
newY = inputCoords[1] + move[1]
|
newY = inputCoords[1] + move[1]
|
||||||
if (0 <= newX <= maxLen) and (0 <= newY <= maxLen):
|
if (0 <= newX <= maxLen) and (0 <= newY <= maxLen):
|
||||||
moveList.append((newX, newY))
|
moveList.append((newX, newY))
|
||||||
|
|
||||||
print(moveList)
|
print(moveList)
|
||||||
# return moveList
|
# return moveList
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue