calculate_legal_states seem to work
This commit is contained in:
parent
b5007c470a
commit
740de07ac8
121
test.py
121
test.py
|
@ -271,6 +271,125 @@ class TestLegalMoves(unittest.TestCase):
|
||||||
self.assertEqual(Board.calculate_legal_states(board, -1, (1,1)), { board })
|
self.assertEqual(Board.calculate_legal_states(board, -1, (1,1)), { board })
|
||||||
self.assertEqual(Board.calculate_legal_states(board, -1, (3,1)), expected_board_set_3_1)
|
self.assertEqual(Board.calculate_legal_states(board, -1, (3,1)), expected_board_set_3_1)
|
||||||
self.assertEqual(Board.calculate_legal_states(board, -1, (3,4)), expected_board_set_3_4)
|
self.assertEqual(Board.calculate_legal_states(board, -1, (3,4)), expected_board_set_3_4)
|
||||||
|
|
||||||
|
def test_multiple_checkers(self):
|
||||||
|
board = ( 0,
|
||||||
|
0, 0, 1, 0, 0, 1,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, -2, 0,
|
||||||
|
0 )
|
||||||
|
expected_board_set_3_5 = {
|
||||||
|
( 0,
|
||||||
|
0, 0, 0, 0, 0, 1,
|
||||||
|
0, 0, 0, 0, 1, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, -2, 0,
|
||||||
|
0 ),
|
||||||
|
( 0,
|
||||||
|
0, 0, 1, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 1, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, -2, 0,
|
||||||
|
0 ),
|
||||||
|
( 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 1, 1, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, -2, 0,
|
||||||
|
0 )
|
||||||
|
}
|
||||||
|
self.assertEqual(Board.calculate_legal_states(board, 1, (3,5)), expected_board_set_3_5)
|
||||||
|
|
||||||
|
def test_double_roll(self):
|
||||||
|
board = ( 0,
|
||||||
|
2, 0, 0, 2, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, -2, 0,
|
||||||
|
0 )
|
||||||
|
|
||||||
|
expected_board_set_1_1 = {
|
||||||
|
( 0,
|
||||||
|
1, 0, 0, 2, 1, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, -2, 0,
|
||||||
|
0 ),
|
||||||
|
( 0,
|
||||||
|
2, 0, 0, 1, 0, 0,
|
||||||
|
0, 1, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, -2, 0,
|
||||||
|
0 ),
|
||||||
|
( 0,
|
||||||
|
0, 0, 2, 2, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, -2, 0,
|
||||||
|
0 ),
|
||||||
|
( 0,
|
||||||
|
2, 0, 0, 0, 0, 2,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, -2, 0,
|
||||||
|
0 ),
|
||||||
|
( 0,
|
||||||
|
0, 2, 0, 0, 2, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, -2, 0,
|
||||||
|
0 ),
|
||||||
|
( 0,
|
||||||
|
1, 1, 0, 1, 0, 0,
|
||||||
|
1, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, -2, 0,
|
||||||
|
0 ),
|
||||||
|
( 0,
|
||||||
|
1, 0, 1, 1, 0, 1,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, -2, 0,
|
||||||
|
0 ),
|
||||||
|
( 0,
|
||||||
|
0, 1, 1, 1, 1, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, -2, 0,
|
||||||
|
0 ),
|
||||||
|
( 0,
|
||||||
|
2, 0, 0, 0, 1, 0,
|
||||||
|
1, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, -2, 0,
|
||||||
|
0 ),
|
||||||
|
( 0,
|
||||||
|
0, 2, 0, 1, 0, 1,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, -2, 0,
|
||||||
|
0 ),
|
||||||
|
( 0,
|
||||||
|
1, 1, 0, 0, 1, 1,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, -2, 0,
|
||||||
|
0 ),
|
||||||
|
( 0,
|
||||||
|
0, 1, 0, 3, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, -2, 0,
|
||||||
|
0 ),
|
||||||
|
( 0,
|
||||||
|
1, 0, 1, 0, 2, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, -2, 0,
|
||||||
|
0 )
|
||||||
|
}
|
||||||
|
|
||||||
|
self.assertEqual(Board.calculate_legal_states(board, 1, (1,1)), expected_board_set_1_1)
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user