mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 07:27:46 +00:00
Allow full repetition detection
Based on sshivaji 6ee19aa5389ce60181907ba53bbb50642f2d5657 commit
This commit is contained in:
+9
-5
@@ -1467,7 +1467,7 @@ Value Position::compute_non_pawn_material(Color c) const {
|
||||
/// Position::is_draw() tests whether the position is drawn by material,
|
||||
/// repetition, or the 50 moves rule. It does not detect stalemates, this
|
||||
/// must be done by the search.
|
||||
template<bool SkipRepetition>
|
||||
template<bool SkipRepetition, bool SkipThreeFoldCheck>
|
||||
bool Position::is_draw() const {
|
||||
|
||||
// Draw by material?
|
||||
@@ -1482,7 +1482,7 @@ bool Position::is_draw() const {
|
||||
// Draw by repetition?
|
||||
if (!SkipRepetition)
|
||||
{
|
||||
int i = 4, e = std::min(st->rule50, st->pliesFromNull);
|
||||
int i = 4, e = std::min(st->rule50, st->pliesFromNull), rep_count=0;
|
||||
|
||||
if (i <= e)
|
||||
{
|
||||
@@ -1492,7 +1492,10 @@ bool Position::is_draw() const {
|
||||
stp = stp->previous->previous;
|
||||
|
||||
if (stp->key == st->key)
|
||||
return true;
|
||||
{
|
||||
if(SkipThreeFoldCheck) return true;
|
||||
else if(++rep_count>=2) return true;
|
||||
}
|
||||
|
||||
i +=2;
|
||||
|
||||
@@ -1504,8 +1507,9 @@ bool Position::is_draw() const {
|
||||
}
|
||||
|
||||
// Explicit template instantiations
|
||||
template bool Position::is_draw<false>() const;
|
||||
template bool Position::is_draw<true>() const;
|
||||
template bool Position::is_draw<false,true>() const;
|
||||
template bool Position::is_draw<true,true>() const;
|
||||
template bool Position::is_draw<false,false>() const;
|
||||
|
||||
|
||||
/// Position::flip() flips position with the white and black sides reversed. This
|
||||
|
||||
Reference in New Issue
Block a user