Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 4th, 2012  |  syntax: None  |  size: 0.79 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. def evaluate(self, player):
  2.         distinct = len(set(self.gems))
  3.         print self.gems[0] == self.gems[1]
  4.         print distinct
  5.         if player == 1:
  6.             if distinct < 7: return 1
  7.             else: return 2
  8.         if player == 2:
  9.             if distinct < 7: return 2
  10.             else: return 1
  11.  
  12. class Gem(object):
  13.     def __init__(self, reactor):
  14.         self.reactor = reactor
  15.         self.type = choice(range(1,7))
  16.         self.gem, self.gemRect = self.reactor.load_image('gem0' + str(self.type) + '.png', -1)
  17.    
  18.     def __eq__(o1, o2):
  19.         print o1.type
  20.         print o2.type
  21.         if o1.type == o2.type:
  22.             return True
  23.         else:
  24.             return False
  25.  
  26.  
  27.  
  28.  
  29. output:
  30. [shapeshifter@Tachychineta] $ python maemoreactor.py
  31. 1
  32. 1
  33. True
  34. 9