Exemplo n.º 1
0
 def accept_resign(self, who):
   assert self.is_to_accept_resign(who)
   new = [0, 0]
   self.game_state = RESIGNED
   new[who] = self.score[who] + self.resign_offer * pow(2, self.cube_in_logarithm)
   new[util.get_opp(who)] = self.score[util.get_opp(who)]
   self.score = tuple(new)
Exemplo n.º 2
0
 def drop(self, who):
   assert self.is_cube_take_or_pass(who)
   new = [0, 0]
   self.game_state = DOUBLED_OUT
   new[who] = self.score[who]
   new[util.get_opp(who)] = self.score[util.get_opp(who)] + pow(2, self.cube_in_logarithm)
   self.score = tuple(new)
Exemplo n.º 3
0
 def offer_resign(self, who, how_much):
   assert self.is_leagal_to_resign(who)
   assert how_much in (RESIGN_SINGLE, 
                                RESIGN_GAMMON,
                                RESIGN_BACKGAMMON
                                )
   self.resign_offer = how_much
   self.on_inner_action = util.get_opp(who)
Exemplo n.º 4
0
 def double(self, who):
   assert self.is_leagal_to_double(who) 
   self.on_inner_action = util.get_opp(who)
   self.doubled = True
Exemplo n.º 5
0
 def pickupdice(self):
   self.rolled = (0, 0)
   print self.on_action
   self.on_action = util.get_opp(self.on_action)
   self.on_inner_action = util.get_opp(self.on_inner_action)
   print self.on_action
Exemplo n.º 6
0
 def reject_resign(self, who):
   assert self.is_to_accept_resign(who)
   self.on_inner_action = util.get_opp(who)
   self.resign_offer = RESIGN_NONE