Advertisement
Guest User

Untitled

a guest
Nov 12th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. def getNeighbors(x,y):
  2.     def app(arr , x,y):
  3.         arr.append([dice[y][x] , resources[y][x]])
  4.     pairs = []
  5.     if(x > 0 and y < 4):
  6.         #upperleft
  7.         app(pairs ,x-1, y )
  8.     if(x < 4 and y < 4):
  9.         #upperright
  10.         app(pairs ,x, y )    
  11.     if(x > 0 and y > 0):
  12.         #lowerleft
  13.         app(pairs ,x-1, y-1 )
  14.  
  15.     if(x < 4 and y > 0):
  16.         #lowerright
  17.         app(pairs ,x, y-1 )
  18.     return pairs
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement