def test_4(self): b = Board() b.pointsContent = [0] * 26 b.pointsContent[1] = -1 b.pointsContent[2] = 2 b.pointsContent[4] = 1 b.pointsContent[5] = 1 b.pointsContent[6] = 3 b.pointsContent[8] = 1 b.pointsContent[12] = -5 b.pointsContent[13] = 5 b.pointsContent[17] = -2 b.pointsContent[19] = -4 b.pointsContent[20] = -1 b.pointsContent[22] = -1 b.pointsContent[24] = 2 b.whiteCheckers = {1, 12, 17, 19, 20, 22} b.blackCheckers = {24, 13, 8, 6, 5, 4, 2} b.whiteCheckersTaken = 1 b.blackCheckersTaken = 0 d = Dice(4, 2) m = generate_moves(b, "WHITE", d) print(b) print(m) self.assertEqual(len(m), 5)
def test_12(self): b = Board() b.pointsContent = [0] * 26 b.pointsContent[2] = 5 b.pointsContent[3] = -1 b.pointsContent[4] = 1 b.pointsContent[5] = 1 b.pointsContent[6] = 3 b.pointsContent[13] = 1 b.pointsContent[16] = -2 b.pointsContent[18] = -2 b.pointsContent[19] = -3 b.pointsContent[20] = -2 b.pointsContent[21] = -2 b.pointsContent[22] = -2 b.pointsContent[23] = -1 b.pointsContent[24] = 3 b.whiteCheckers = {3, 16, 18, 19, 20, 21, 22, 23} b.blackCheckers = {24, 13, 6, 5, 4, 2} b.whiteCheckersTaken = 0 b.blackCheckersTaken = 1 d = Dice(4, 1) m = generate_moves(b, "BLACK", d) print(b) print(m) self.assertEqual(len(m), 3)
def test_0(self): b = Board() b.pointsContent = [0] * 26 b.pointsContent[1] = -3 b.pointsContent[2] = 6 b.pointsContent[3] = 4 b.pointsContent[6] = 2 b.pointsContent[4] = 1 b.pointsContent[13] = -1 b.pointsContent[19] = -4 b.pointsContent[20] = 2 b.pointsContent[22] = -1 b.pointsContent[23] = -4 b.pointsContent[24] = -2 b.whiteCheckers = {1, 13, 19, 22, 23, 24} b.blackCheckers = {2, 3, 4, 6, 20} b.blackCheckersTaken = 0 b.whiteCheckersTaken = 0 d = Dice(4, 1) print(b) current = MoveNode("start", board_after=b, deep=0) ab = alpha_beta(current, 2, "BLACK", dice=d) mm = expectiminimax(current, 2, "BLACK", dice=d) print(ab) print(mm)
def test_9(self): b = Board() b.pointsContent = [0] * 26 b.pointsContent[1] = -2 b.pointsContent[6] = 5 b.pointsContent[7] = 3 b.pointsContent[8] = 4 b.pointsContent[12] = -4 b.pointsContent[13] = -1 b.pointsContent[18] = 2 b.pointsContent[19] = -3 b.pointsContent[21] = -2 b.pointsContent[23] = -2 b.pointsContent[24] = -1 b.whiteCheckers = {1, 12, 13, 19, 21, 23, 24} b.blackCheckers = {6, 7, 8, 18} b.whiteCheckersTaken = 0 b.blackCheckersTaken = 1 d = Dice(4, 1) m = generate_moves(b, "BLACK", d) print(b) print(m) self.assertEqual(len(m), 5)
def test_1(self): b = Board() b.pointsContent = [0] * 26 b.pointsContent[1] = -2 b.pointsContent[12] = -5 b.pointsContent[17] = -3 b.pointsContent[19] = -5 b.pointsContent[2] = 14 b.pointsContent[7] = 1 b.whiteCheckers = {1, 12, 17, 19} b.blackCheckers = {2, 7} b.blackCheckersTaken = 0 b.whiteCheckersTaken = 0 d = Dice(5, 1) m = generate_moves(b, "BLACK", d) self.assertEqual(len(m), 1)
def test_8(self): b = Board() b.pointsContent = [0] * 26 b.pointsContent[7] = -2 b.pointsContent[12] = -5 b.pointsContent[17] = -3 b.pointsContent[19] = -5 b.pointsContent[8] = 1 b.pointsContent[3] = 3 b.pointsContent[1] = 10 b.pointsContent[0] = 1 b.whiteCheckers = {7, 12, 17, 19} b.blackCheckers = {8, 3, 1} b.blackCheckersTaken = 0 b.whiteCheckersTaken = 0 d = Dice(2, 2) m = generate_moves(b, "BLACK", d) print(b) print(m) self.assertEqual(len(m), 4)
def test_5(self): b = Board() b.pointsContent = [0] * 26 b.pointsContent[1] = -2 b.pointsContent[12] = -5 b.pointsContent[17] = -3 b.pointsContent[19] = -5 b.pointsContent[24] = 2 b.pointsContent[13] = 5 b.pointsContent[4] = 3 b.pointsContent[6] = 5 b.whiteCheckers = {12, 17, 19} b.blackCheckers = {24, 13, 6, 4} b.whiteCheckersTaken = 2 b.blackCheckersTaken = 0 d = Dice(4, 6) m = generate_moves(b, "WHITE", d) print(b) print(m) self.assertEqual(len(m), 1)
def test_10(self): b = Board() b.pointsContent = [0] * 26 b.pointsContent[1] = -1 b.pointsContent[2] = 1 b.pointsContent[4] = 1 b.pointsContent[5] = 2 b.pointsContent[6] = 3 b.pointsContent[8] = 1 b.pointsContent[13] = 5 b.pointsContent[21] = -13 b.pointsContent[24] = 2 b.whiteCheckers = {1, 21} b.blackCheckers = {24, 13, 8, 6, 5, 4, 2} b.whiteCheckersTaken = 1 b.blackCheckersTaken = 0 d = Dice(4, 2) m = generate_moves(b, "WHITE", d) print(b) print(m) self.assertEqual(len(m), 2)