Example #1
0
    def change_turn(self, selected, square):
        opening = ''.join([
            p0x88_to_chess_notation(tuple_to_0x88(selected)),
            p0x88_to_chess_notation(tuple_to_0x88(square))
        ])
        self.selected = None
        self.fail = None

        if hasattr(self.current_player, 'openings'):
            if self.current_player.openings:
                try:
                    self.current_player.openings = self.current_player.openings[opening]
                except KeyError:
                    self.current_player.openings = {}

        self.other_player.end_turn()
        self.current_player.start_turn()
 def test_tuple_0_7_to_0x88_0(self):
     self.assertEqual(tuple_to_0x88((0, 7)), 0)
 def test_tuple_0_0_to_0x88_112(self):
     self.assertEqual(tuple_to_0x88((0, 0)), 112)