forked from bcorfman/raven-checkers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_onek_eval.py
31 lines (27 loc) · 901 Bytes
/
test_onek_eval.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from globalconst import BLACK, WHITE, KING
import onek_eval
import unittest
import checkers
# (white)
# 45 46 47 48
# 39 40 41 42
# 34 35 36 37
# 28 29 30 31
# 23 24 25 26
# 17 18 19 20
# 12 13 14 15
# 6 7 8 9
# (black)
class TestOneKingAttackOneKingEvaluator(unittest.TestCase):
def setUp(self):
self.game = checkers.Checkers()
self.board = self.game.curr_state
self.board.clear()
squares = self.board.squares
squares[6] = BLACK | KING
squares[48] = WHITE | KING
self.board.to_move = BLACK
self.board.update_piece_count()
def testInitialBlackMoves(self):
ev = onek_eval.OneKingAttackOneKingEvaluator(1.0)
self.assertEqual(ev.calculate_desirability(self.board), 1.0)