def test_bCmplx_heuristicInCheck(self): # Neither player should be in check at the start wVal = heuristicInCheck(ChessBoard.WHITE, getBoardComplex()) bVal = heuristicInCheck(ChessBoard.BLACK, getBoardComplex()) self.assertTrue(wVal == 1) self.assertTrue(bVal == 1)
def test_bCmplx_heuristicPiecesUnderAttack(self): wVal = heuristicPcsUnderAttack(ChessBoard.WHITE, getBoardComplex()) bVal = heuristicPcsUnderAttack(ChessBoard.BLACK, getBoardComplex()) properWhiteVal = 1 - 2 * (10 / 39) properBlackVal = 1 - 2 * (12 / 39) self.assertTrue(wVal == properWhiteVal) self.assertTrue(bVal == properBlackVal)
def test_bCmplx_heuristicPieceValue(self): wVal = heuristicPieceValue(ChessBoard.WHITE, getBoardComplex()) bVal = heuristicPieceValue(ChessBoard.BLACK, getBoardComplex()) properWhiteVal = (39 - 19.5) / 19.5 properBlackVal = (35 - 19.5) / 19.5 self.assertTrue(wVal == properWhiteVal) self.assertTrue(bVal == properBlackVal)
def test_bCmplx_heuristicPiecesCovered(self): # Maximum covered value for new board is 39 wVal = heuristicPiecesCovered(ChessBoard.WHITE, getBoardComplex()) bVal = heuristicPiecesCovered(ChessBoard.BLACK, getBoardComplex()) properWhiteVal = -1 + 28 / 39 * 2 properBlackVal = -1 + 19 / 35 * 2 self.assertTrue(wVal == properWhiteVal) self.assertTrue(bVal == properBlackVal)
def test_bCmplx_allLegalMoves_black(self): b = getBoardComplex() print "considering a board" print b eMoves = enumMoves(b, _b) import pdb; pdb.set_trace() self._allLegalMoves(b, _b, eMoves)
def test_bCmplx_allLegalMoves_black(self): b = getBoardComplex() print "considering a board" print b eMoves = enumMoves(b, _b) import pdb pdb.set_trace() self._allLegalMoves(b, _b, eMoves)
def test_bCmplx_heuristicEmptySpaceCoverage(self): b = getBoardComplex() wVal = heuristicEmptySpaceCvrg(ChessBoard.WHITE, b) bVal = heuristicEmptySpaceCvrg(ChessBoard.BLACK, b) properWhiteVal = -1 + 22 / 36 * 2 properBlackVal = -1 + 22 / 36 * 2 self.assertTrue(wVal == properWhiteVal) self.assertTrue(bVal == properBlackVal)
def test_bCmplx_allLegalMoves_white(self): b = getBoardComplex() self._allLegalMoves(b, _w, enumMoves(b, _w))