Пример #1
0
 def test_single_barred_pip(self):
     board = Board(repeat_point(24))
     board.add_bar(Color.White)
     self.assertEqual(board.pip_count(), {
         Color.Black: 0,
         Color.White: 24,
     })
Пример #2
0
 def test_frozen_board_hashable(self):
     b1 = Board(list(default_starting_points))
     b1.add_off(Color.White)
     b1.add_bar(Color.Black)
     b2 = Board(list(default_starting_points))
     b2.add_off(Color.White)
     b2.add_bar(Color.Black)
     self.assertEqual(hash(b1.frozen_copy()), hash(b2.frozen_copy()))
Пример #3
0
 def test_can_get_off_bar_with_parly_full_home(self):
     board = Board(repeat_point(5, 2, Color.Black) + repeat_point(19))
     board.add_bar(Color.White)
     self.assertEqual(
         extract_moves(board.possible_moves(Color.White,
                                            Dice(roll=(1, 6)))),
         set([
             (
                 Move(Color.White, Move.Bar, 6),
                 Move(Color.White, 6, 1),
             ),
         ]))
Пример #4
0
 def test_can_get_off_bar_with_empty_home(self):
     board = Board(repeat_point(24))
     board.add_bar(Color.White)
     self.assertEqual(
         extract_moves(board.possible_moves(Color.White,
                                            Dice(roll=(1, 6)))),
         set([
             (
                 Move(Color.White, Move.Bar, 1),
                 Move(Color.White, 1, 6),
             ),
             (
                 Move(Color.White, Move.Bar, 6),
                 Move(Color.White, 6, 1),
             ),
         ]))
Пример #5
0
 def test_cant_bear_off_with_bar(self):
     board = Board(repeat_point(23) + [Point(2, Color.White)], )
     board.add_bar(Color.White)
     self.assertFalse(board.can_bear_off(Color.White))
Пример #6
0
 def test_cant_get_off_bar_with_full_home(self):
     board = Board(repeat_point(6, 2, Color.Black) + repeat_point(18))
     board.add_bar(Color.White)
     self.assertEqual(
         extract_moves(board.possible_moves(Color.White,
                                            Dice(roll=(1, 6)))), set())