def make_partial_move(self, pm): if self.on_action == YOU: to_move, to_hit = self.position elif self.on_action == HIM: to_hit, to_move = self.position else: assert False to_move = list(to_move) to_hit = list(to_hit) if pm.src > OFF: to_move[pm.src] -=1 if pm.dest > OFF: to_move[pm.dest] +=1 if pm.is_hitting: if pm.is_undo(): to_hit[util.flip_point(pm.src)] +=1 to_hit[BAR] -= 1 else: to_hit[util.flip_point(pm.dest)] -=1 to_hit[BAR] += 1 if self.on_action == YOU: self.position = (tuple(to_move), tuple(to_hit)) elif self.on_action == HIM: self.position = (tuple(to_hit), tuple(to_move)) else: assert False
def is_hitting_to_land(self, n): if self.on_action == YOU: to_move, to_hit = self.position elif self.on_action == HIM: to_hit, to_move = self.position if n in POINTS: return to_hit[util.flip_point(n)] == 1 else: assert n == -1 return False