Search { final void scoreMoveList(MoveGen.MoveList moves, int ply) { scoreMoveList(moves, ply, 0); } Search(Position pos, long[] posHashList, int posHashListSize, TranspositionTable tt,
                  History ht); void setListener(Listener listener); final void timeLimit(int minTimeLimit, int maxTimeLimit); final void setStrength(int strength, long randomSeed, int maxNPS); final Move iterativeDeepening(MoveGen.MoveList scMovesIn,
            int maxDepth, long initialMaxNodes, boolean verbose); final int negaScout(int alpha, int beta, int ply, int depth, int recaptureSquare,
                               final boolean inCheck); final int signSEE(Move m); final boolean negSEE(Move m); final int SEE(Move m); static boolean canClaimDraw50(Position pos); static boolean canClaimDrawRep(Position pos, long[] posHashList, int posHashListSize, int posHashFirstNew); public int nodesBetweenTimeCheck; final static int MATE0; final static int UNKNOWN_SCORE; }
@Test public void testScoreMoveList() throws ChessParseError { System.out.println("SEEorder"); Position pos = TextIO.readFEN("r2qk2r/ppp2ppp/1bnp1nb1/1N2p3/3PP3/1PP2N2/1P3PPP/R1BQRBK1 w kq - 0 1"); Search sc = new Search(pos, nullHist, 0, tt, ht); MoveGen moveGen = new MoveGen(); MoveGen.MoveList moves = moveGen.pseudoLegalMoves(pos); sc.scoreMoveList(moves, 0); for (int i = 0; i < moves.size; i++) { Search.selectBest(moves, i); if (i > 0) { int sc1 = moves.m[i - 1].score; int sc2 = moves.m[i].score; assertTrue(sc2 <= sc1); } } moves = moveGen.pseudoLegalMoves(pos); moves.m[0].score = 17; moves.m[1].score = 666; moves.m[2].score = 4711; sc.scoreMoveList(moves, 0, 2); assertEquals(17, moves.m[0].score); assertEquals(666, moves.m[1].score); for (int i = 1; i < moves.size; i++) { Search.selectBest(moves, i); if (i > 1) { int sc1 = moves.m[i - 1].score; int sc2 = moves.m[i].score; assertTrue(sc2 <= sc1); } } Move m = TextIO.stringToMove(pos, "Ra6"); moves = moveGen.pseudoLegalMoves(pos); boolean res = Search.selectHashMove(moves, m); assertEquals(true, res); assertEquals(m, moves.m[0]); }