Ejemplo n.º 1
0
 def test_two_pip_bear_off(self):
     board = Board(
         repeat_point(19) + [Point(2, Color.White)] + repeat_point(4))
     self.assertEqual(
         extract_moves(board.possible_moves(Color.White,
                                            Dice(roll=(5, 6)))),
         set([
             # These  movesets are identical to each other because they both bear
             # off and could be deduped, but don't seem harmful, so leaving for now
             (
                 Move(Color.White, 20, 6),
                 Move(Color.White, 20, 5),
             ),
             (
                 Move(Color.White, 20, 5),
                 Move(Color.White, 20, 6),
             ),
         ]))
Ejemplo n.º 2
0
 def test_single_valid_move(self):
     board = Board(
         repeat_point(10) + [Point(1, Color.White)] +
         [Point(2, Color.White)] + repeat_point(12, 2, Color.Black))
     self.assertEqual(
         extract_moves(board.possible_moves(Color.White,
                                            Dice(roll=(1, 3)))),
         set([
             (Move(Color.White, 11, 1), ),
         ]))
Ejemplo n.º 3
0
 def test_one_blocked_pip_bear_off(self):
     """Sames as test_one_pip_bear_off but 1 is blocked"""
     board = Board(
         repeat_point(4) + [Point(2, Color.White)] +
         [Point(1, Color.Black)] + repeat_point(18))
     self.assertEqual(
         extract_moves(board.possible_moves(Color.Black,
                                            Dice(roll=(1, 6)))),
         set([
             (Move(Color.Black, 6, 6), ),
         ]))
Ejemplo n.º 4
0
 def test_simple_hit(self):
     board = Board([Point(2, Color.White)] + [Point(1, Color.Black)] +
                   repeat_point(22))
     board.apply_move(Move(Color.White, 1, 1))
     self.assertEqual(board.bar[Color.Black.value], 1)
Ejemplo n.º 5
0
 def test_simple_move(self):
     board = Board([Point(2, Color.White)] + repeat_point(23))
     board.apply_move(Move(Color.White, 1, 6))
     self.assertEqual(board.point_at_number(1), Point(1, Color.White))
     self.assertEqual(board.point_at_number(7), Point(1, Color.White))