Guest

Juice

By: a guest on Jan 28th, 2012  |  syntax: None  |  size: 0.49 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse
This paste has a previous version, view the difference. Copied
  1. validCards = []
  2.  
  3. #filter list for cards that don't take you off map
  4.         for card in cards:
  5.             moveTo = utilities.cardDestination(gMap, you.robot.location, moveCards)
  6.             if isValidSquare(moveTo, gMap, you.robot.location[0], you.robot.location[1]):  
  7.                 validCards.add(card)
  8.  
  9.  
  10. def isValidSquare(self, gMap, x, y):
  11.         w = gMap.width
  12.         h = gMap.height
  13.         if 0 <= x and x < w and 0 <= y and y < h:
  14.             return True
  15.         return False