/*
- Glaurung, a UCI chess playing engine.
- Copyright (C) 2004-2008 Tord Romstad
+ Stockfish, a UCI chess playing engine derived from Glaurung 2.1
+ Copyright (C) 2004-2008 Tord Romstad (Glaurung author)
+ Copyright (C) 2008 Marco Costalba
- Glaurung is free software: you can redistribute it and/or modify
+ Stockfish is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
- Glaurung is distributed in the hope that it will be useful,
+ Stockfish is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
//// Functions
////
-/// think() is the external interface to Glaurung's search, and is called when
+/// think() is the external interface to Stockfish's search, and is called when
/// the program receives the UCI 'go' command. It initializes various
/// search-related global variables, and calls root_search()
// Stop search if most of MaxSearchTime is consumed at the end of the
// iteration. We probably don't have enough time to search the first
// move at the next iteration anyway.
- if(current_search_time() > ((MaxSearchTime + ExtraSearchTime)*80) / 128)
+ if(current_search_time() > ((MaxSearchTime + ExtraSearchTime)*90) / 128)
stopSearch = true;
if(stopSearch) {
Depth extension(const Position &pos, Move m, bool pvNode,
bool check, bool singleReply, bool mateThreat) {
+
Depth result = Depth(0);
- if(check)
- result += CheckExtension[pvNode];
- if(singleReply)
- result += SingleReplyExtension[pvNode];
- if(pos.move_is_pawn_push_to_7th(m))
- result += PawnPushTo7thExtension[pvNode];
- if(pos.move_is_passed_pawn_push(m))
- result += PassedPawnExtension[pvNode];
- if(mateThreat)
- result += MateThreatExtension[pvNode];
- if(pos.midgame_value_of_piece_on(move_to(m)) >= RookValueMidgame
- && (pos.non_pawn_material(WHITE) + pos.non_pawn_material(BLACK)
- - pos.midgame_value_of_piece_on(move_to(m)) == Value(0))
- && !move_promotion(m))
- result += PawnEndgameExtension[pvNode];
- if(pvNode && pos.move_is_capture(m)
- && pos.type_of_piece_on(move_to(m)) != PAWN && pos.see(m) >= 0)
- result += OnePly/2;
+ if (check)
+ result += CheckExtension[pvNode];
+
+ if (singleReply)
+ result += SingleReplyExtension[pvNode];
+
+ if (pos.move_is_pawn_push_to_7th(m))
+ result += PawnPushTo7thExtension[pvNode];
+
+ if (pos.move_is_passed_pawn_push(m))
+ result += PassedPawnExtension[pvNode];
+
+ if (mateThreat)
+ result += MateThreatExtension[pvNode];
+
+ if ( pos.midgame_value_of_piece_on(move_to(m)) >= RookValueMidgame\r
+ && ( pos.non_pawn_material(WHITE) + pos.non_pawn_material(BLACK)\r
+ - pos.midgame_value_of_piece_on(move_to(m)) == Value(0))\r
+ && !move_promotion(m))
+ result += PawnEndgameExtension[pvNode];
+
+ if ( pvNode
+ && pos.move_is_capture(m)
+ && pos.type_of_piece_on(move_to(m)) != PAWN
+ && pos.see(m) >= 0)
+ result += OnePly/2;
return Min(result, OnePly);
}
bool overTime = t > AbsoluteMaxSearchTime
|| (RootMoveNumber == 1 && t > MaxSearchTime + ExtraSearchTime)
|| ( !FailHigh && !fail_high_ply_1() && !Problem
- && t > 6*(MaxSearchTime + ExtraSearchTime));
+ && t > 10*(MaxSearchTime + ExtraSearchTime));
if ( (Iteration >= 2 && (!InfiniteSearch && overTime))
|| (ExactMaxTime && t >= ExactMaxTime)