def test_newB_heuristicInCheck(self):
        # Neither player should be in check at the start
        wVal = heuristicInCheck(ChessBoard.WHITE, getBoardNew())
        bVal = heuristicInCheck(ChessBoard.BLACK, getBoardNew())

        self.assertTrue(wVal == 1)
        self.assertTrue(bVal == 1)
    def test_newB_heuristicPiecesCovered(self):
        # Maximum covered value for new board is 39
        wVal = heuristicPiecesCovered(ChessBoard.WHITE, getBoardNew())
        bVal = heuristicPiecesCovered(ChessBoard.BLACK, getBoardNew())

        properRetVal = -1 + 29 / 39 * 2
        self.assertTrue(wVal == properRetVal)
        self.assertTrue(bVal == properRetVal)
 def test_newB_correctValues(self):
     # "Should be 20 possible moves at start")
     self._assertListsEq([(_Posn(0, 1), _Posn(2, 0)),
                          (_Posn(0, 1), _Posn(2, 2)),
                          (_Posn(0, 6), _Posn(2, 5)),
                          (_Posn(0, 6), _Posn(2, 7)),
                          (_Posn(1, 0), _Posn(2, 0)),
                          (_Posn(1, 0), _Posn(3, 0)),
                          (_Posn(1, 1), _Posn(2, 1)),
                          (_Posn(1, 1), _Posn(3, 1)),
                          (_Posn(1, 2), _Posn(2, 2)),
                          (_Posn(1, 2), _Posn(3, 2)),
                          (_Posn(1, 3), _Posn(2, 3)),
                          (_Posn(1, 3), _Posn(3, 3)),
                          (_Posn(1, 4), _Posn(2, 4)),
                          (_Posn(1, 4), _Posn(3, 4)),
                          (_Posn(1, 5), _Posn(2, 5)),
                          (_Posn(1, 5), _Posn(3, 5)),
                          (_Posn(1, 6), _Posn(2, 6)),
                          (_Posn(1, 6), _Posn(3, 6)),
                          (_Posn(1, 7), _Posn(2, 7)),
                          (_Posn(1, 7), _Posn(3, 7))],
                         enumMoves(getBoardNew(), _w))
Beispiel #4
0
 def test_newB_correctValues(self):
     # "Should be 20 possible moves at start")
     self._assertListsEq([(_Posn(0, 1), _Posn(2, 0)),
                          (_Posn(0, 1), _Posn(2, 2)),
                          (_Posn(0, 6), _Posn(2, 5)),
                          (_Posn(0, 6), _Posn(2, 7)),
                          (_Posn(1, 0), _Posn(2, 0)),
                          (_Posn(1, 0), _Posn(3, 0)),
                          (_Posn(1, 1), _Posn(2, 1)),
                          (_Posn(1, 1), _Posn(3, 1)),
                          (_Posn(1, 2), _Posn(2, 2)),
                          (_Posn(1, 2), _Posn(3, 2)),
                          (_Posn(1, 3), _Posn(2, 3)),
                          (_Posn(1, 3), _Posn(3, 3)),
                          (_Posn(1, 4), _Posn(2, 4)),
                          (_Posn(1, 4), _Posn(3, 4)),
                          (_Posn(1, 5), _Posn(2, 5)),
                          (_Posn(1, 5), _Posn(3, 5)),
                          (_Posn(1, 6), _Posn(2, 6)),
                          (_Posn(1, 6), _Posn(3, 6)),
                          (_Posn(1, 7), _Posn(2, 7)),
                          (_Posn(1, 7), _Posn(3, 7))],
                         enumMoves(getBoardNew(), _w))
 def test_newB_allLegalMoves(self):
     self._allLegalMoves(getBoardNew(), _w, enumMoves(getBoardNew(), _w))
 def test_newB_correctLen(self):
     self.assertEqual(20, len(enumMoves(getBoardNew(), _w)))
    def test_newB_heuristicPiecesUnderAttack(self):
        wVal = heuristicPcsUnderAttack(ChessBoard.WHITE, getBoardNew())
        bVal = heuristicPcsUnderAttack(ChessBoard.BLACK, getBoardNew())

        self.assertTrue(wVal == 1)
        self.assertTrue(bVal == 1)
    def test_newB_heuristicEmptySpaceCoverage(self):
        wVal = heuristicEmptySpaceCvrg(ChessBoard.WHITE, getBoardNew())
        bVal = heuristicEmptySpaceCvrg(ChessBoard.BLACK, getBoardNew())

        self.assertTrue(wVal == 0)
        self.assertTrue(bVal == 0)
Beispiel #9
0
 def test_newB_allLegalMoves(self):
     self._allLegalMoves(getBoardNew(), _w, enumMoves(getBoardNew(), _w))
Beispiel #10
0
 def test_newB_correctLen(self):
     self.assertEqual(20, len(enumMoves(getBoardNew(), _w)))