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)
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)
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)
def double(self, who): assert self.is_leagal_to_double(who) self.on_inner_action = util.get_opp(who) self.doubled = True
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
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