Пример #1
0
 def get_rent(self, roll, ui):
   if roll is None:
     "Enter to roll dice:"
     die1 = die()
     die2 = die()
     roll = die1 + die2 
     ui.print_message("%s rolled a %d and %d to get %d." % (self, die1, die2, roll))
   if len(self.owner.owned_by_group['utilities']) == 2:
     ui.print_message("%s ownes two utilities, so rent is 10x the roll, or $%d!" % (self, roll*11))
     return roll * 11
   else:
     ui.print_message("%s ownes one utility, so rent is 4x the roll, or $%d!" % (self, roll*4))
     return roll * 4
Пример #2
0
 def roll(self):
   """Rolls dice and then calls self.advance() to go to that function.
     If doubles is rolled a third time, Player goes directly to jail and does not advance.
   """
   self.ui.print_message("%s's turn." % (self))
   self.check_balance()
   self.develop_monopolies()
   if not self.simulate:
     self.ui.raw_input("Enter to roll. ")
   die1 = die()
   die2 = die()
   dice = die1 + die2 
   self.ui.print_message("%s rolled a %d and %d to get %d." % (self, die1, die2, dice))
   if self.doubles_jail(die1, die2):
     return None
   doubles = die1 == die2
   self.advance(self.position + dice, roll=dice, doubles=doubles)