When to claim Insufficient Material draw

Programming Topics (Computer Chess) and technical aspects as test techniques, book building, program tuning etc

Moderator: Andres Valverde

When to claim Insufficient Material draw

Postby peterhughes » 26 Mar 2005, 15:45

Having looked on the internet, there seems to be varied opinion about what consistitutes Insufficient Material. This is a concern, because according to some tournament rules, claiming a draw in error could cause you engine to automatically "lose the game".

Is there an offical definition of "Insufficient Material" that has been agreed on the WinBoard forum, that is used in all the tournaments that people on this forum enter?

Thanks
Peter Hughes
Last edited by peterhughes on 29 Mar 2005, 22:00, edited 1 time in total.
peterhughes
 
Posts: 42
Joined: 18 Jan 2005, 23:37

Re: When to claim Insufficient Material draw

Postby Pallav Nawani » 26 Mar 2005, 18:16

Claim Insufficient material draw iff just kings are left on board.

Pallav
User avatar
Pallav Nawani
 
Posts: 147
Joined: 26 Sep 2004, 20:00
Location: Dehradun, India

Re: When to claim Insufficient Material draw

Postby Sven Schüle » 26 Mar 2005, 18:36

Pallav Nawani wrote:Claim Insufficient material draw iff just kings are left on board.

Pallav
I don't think this is enough. To satisfy most TDs (and the rules) all engines should IMHO also claim draw at KBK and KNK. The last case is KBKB with bishops on same square colour; this is a draw, too, but I don't know if many engines claim it (Surprise not yet, unfortunately :-( but will do it soon :-) ). All these four cases have in common that the material of both sides is not sufficient to build a mate position, even with worst play.

Sven
User avatar
Sven Schüle
 
Posts: 240
Joined: 26 Sep 2004, 20:19
Location: Berlin, Germany

Re: When to claiming Insufficient Material draw

Postby Anonymous » 26 Mar 2005, 18:48

peterhughes wrote:Having looked on the internet, there seems to be varied opinion about what consistitutes Insufficient Material. This is a concern, because according to some tournament rules, claiming a draw in error could cause you engine to automatically "lose the game".

Is there an offical definition of "Insufficient Material" that has been agreed on the WinBoard forum, that is used in all the tournaments that people on this forum enter?



It is in the Fide Handbook http://www.fide.com/official/handbook.asp?level=EE101. The rule is not called "Insufficient Material Rule" there. Here is the relevant part:

9.6 The game is drawn when a position is reached from which a checkmate cannot occur by any possible series of legal moves, even with the most unskilled play. This immediately ends the game.

The easiest cases are: K-K, KB-K, KN-K, K+any number of Bs of one color vs. K +any number of Bs of the same colors. Not included in this rule are for example KB-KN (which IMHO is a bit over pedantic).

There are also totally blocked positions that are draw due to rule 9.6. The easiest example maybe:

[diag]k7/8/8/p2p2p1/P2P2P1/8/8/K7[/diag]

There can be more pawns, or even bishops. Typically engines (and GUIs) are not smart enough to detect this sort of draw.

BTW. I miss a rule in the FIDE rules where the stronger side can claim a draw, say in KR vs KN. Here only the R side can win. If I am the R side, I might want to claim a draw, but I can only offer (and my opponent could refuse it - not unlikely in engine games).

Regards,
Dieter
Anonymous
 

Re: When to claim Insufficient Material draw

Postby peterhughes » 26 Mar 2005, 21:32

Well, this is one of the best articles that I have found on the subject:

http://www.e4ec.org/immr.html

It's pretty comprehensive, and could get complicated/expensive to try and figure out in an engine.

I guess the main question is, what do WinBoard and Arena count as Insufficient Material? Because, I dont want to go and program some massively completed system of detection, and then find that WinBoard/Arena doesnt recognise, and then have Arena/WinBoard tell that I'm making an illegal draw claim, and me to therefore lose the game!

Secondly, if I just don't bother claiming "Insufficient Material" draw, or just claim it in simple situations like "two kings", will I be penalised by WinBoard/Arena for not claiming it, when I should?
peterhughes
 
Posts: 42
Joined: 18 Jan 2005, 23:37

Re: When to claim Insufficient Material draw

Postby Charles Roberson » 26 Mar 2005, 22:17

insufficient material is fairly simple
you just have to know the elementary endgames

a king and pawn vs a king can mate
a king and queen vs a king can mate
a king and rook vs a king can mate
a king and 2 bishops vs a king can mate
a king, bishop and knight vs a king can mate
The toughest bug to find is the one that doesn't exist. (CR -1988)
Charles Roberson
 
Posts: 23
Joined: 22 Dec 2004, 20:07
Location: North Carolina, USA

Re: When to claim Insufficient Material draw

Postby peterhughes » 26 Mar 2005, 23:27

Charles Roberson wrote:insufficient material is fairly simple
you just have to know the elementary endgames

a king and pawn vs a king can mate
a king and queen vs a king can mate
a king and rook vs a king can mate
a king and 2 bishops vs a king can mate
a king, bishop and knight vs a king can mate


Indeed, and a king, queen, 2 bishops, 2 knights, 2 rooks, and 8 pawns vs a king can mate, but that doesn help me. What I'm interested in is the conditions in which you can't mate. :)

For example:

a king and 2 bishops vs a king can mate


But, not if the 2 bishops are on the same coloured squares.
peterhughes
 
Posts: 42
Joined: 18 Jan 2005, 23:37

Re: When to claim Insufficient Material draw

Postby Pedro Castro » 27 Mar 2005, 04:39

int draw() //comprueba si hay tablas por insuficiencia de material
{
int i;

Eval_material();

if (pawnswhite == 0 && pawnsblack == 0) {
if ((pieceswhite < VAL_ROOK) && (piecesblack < VAL_ROOK)) {
if ((pieceswhite == VAL_BISHOP) && (piecesblack == VAL_BISHOP)) {
for (i = 0; i < 64; i++) {
if ((color[i] == WHITE) && (piece[i] == BISHOP))
bishopwhite = colorsquare[i];
if ((color[i] == BLACK) && (piece[i] == BISHOP))
bishopblack = colorsquare[i];
}
if (bishopwhite == bishopblack )
return FALSE;
}
return TRUE;
}
if ((pieceswhite == 2 * VAL_KNIGHT) && (piecesblack == 0)) {
return TRUE;
}
if ((pieceswhite == 0) && (piecesblack == 2 * VAL_KNIGHT)) {
return TRUE;
}
}
return FALSE;
}
Best wishes,

Pedro Castro
User avatar
Pedro Castro
 
Posts: 180
Joined: 28 Jan 2005, 01:09
Location: Pays Basque (Spain)

Re: When to claim Insufficient Material draw

Postby Pallav Nawani » 27 Mar 2005, 06:05

peterhughes wrote:
I guess the main question is, what do WinBoard and Arena count as Insufficient Material? Because, I dont want to go and program some massively completed system of detection, and then find that WinBoard/Arena doesnt recognise, and then have Arena/WinBoard tell that I'm making an illegal draw claim, and me to therefore lose the game!



Precisely the reason why I suggested claiming the draw when only kings are left. Winboard does not detect draws by itself, and it will go by whatever result you give. Arena, however, does its own adjudication. In one particular case when playing under Arena (I don't remember which), my engine claimed the draw, and put itself in force mode. The game continued and Natwarlal lost on time.

Pallav
User avatar
Pallav Nawani
 
Posts: 147
Joined: 26 Sep 2004, 20:00
Location: Dehradun, India

Re: When to claim Insufficient Material draw

Postby Anonymous » 27 Mar 2005, 07:08

Pedro, your routine has several errors. It returns draw for bishops of opposite color. It should be for the same color. It returns draw for B vs, N and N vs. N. It shouldn't. It returns draw for 2 Ns vs lone K. It shouldn't. Of course all these cases are (almost always) draw, and they can be evaluated as draw, but no draw claim is allowed.

If you add a piece list to your data structure, you may gain a lot of speed in your engine.

Sven, I see that I twice replied very similar to your post. When I replied, I did not see your post, yet. I started to write my posts before yours were finished. So now, it might look a bit strange, to basically repeat your answers.

Pallav, many TDs will not like it, when your engine does not claim draw in kbk and knk. When Arena has a problem for properly claimed draw, you should report a bug.

IMHO the draw claiming stuff should be inside the GUIs, and no problems ever would arise. When the GUI is not clever enough, to detect some more complicated draw (like those with the blocked patterns), usually nobody would be hurt, and the would play on for 50 moves too long. I know, that it is not always the case - George Lyapko found one game that was lost on time (IIRC), but would be draw because of blocked position.

Regards,
Dieter


Regards,
Dieter
Anonymous
 

Re: When to claim Insufficient Material draw

Postby Anonymous » 27 Mar 2005, 09:03

Hmmm, in my first answers, I was not really aware of the problem. My answer was what claims are legal according to chess rules. And used to Winboard (the GUI) it will work ok! Does it? In "local mode" - yes. But not in ICS play.

Say, I implement some very sophisticated draw detection for the blocked position type draws, or even those forced stalemates given in the link in another post. Instead of moving, the engine could claim draw now. But most probably, the ICS would not accept this, because it was not clever enough. My engine would lose on time. So, practically, beeing theoretically correct is not enough. Really a list would be needed. And one can fear, that different GUIs/ICSes would support contradicting list, so no real good solution. ICC already assumes KBKN (for example) as draw.

Perhaps the best list would be just KK, KNK, KBK (no sane GUI/ICS should ignore those) and perhaps KBKB (Bs of same color). Somebody should check, if the later is accepted in most environments. KBBK with Bs of same color should never happen in a real game.

Perhaps somebody would also like to ask in the tournament section or the general section of this forum. You might be able to catch the intention of more experienced users/TDs than here.

Regards,
Dieter
Anonymous
 

Re: When to claim Insufficient Material draw

Postby peterhughes » 27 Mar 2005, 11:29

Dieter

You've grasped what I'm talking about exactly.

In the end, I've just coded to KvK, KBvK and KNvK, and left it at that.

I just hope that all the tournaments I enter are at least smart enough to know about these few simple draw positions.

Cheers
Peter Hughes
peterhughes
 
Posts: 42
Joined: 18 Jan 2005, 23:37

Re: When to claim Insufficient Material draw

Postby Pedro Castro » 28 Mar 2005, 02:16

Thank you Dieter,

he did not know that with 2 Knight it was possible to be done mate, but after your message I have found this position,

7k/5K2/5NN1/8/8/8/8/8 w - - 0 1

kN vs KN (also not know)
7k/5K1n/6N1/8/8/8/8/8 b - - 1 1

kB vs KN (also not know)
7k/5KBn/8/8/8/8/8/8 b - - 1 1

right no clain draw.
Best wishes,

Pedro Castro
User avatar
Pedro Castro
 
Posts: 180
Joined: 28 Jan 2005, 01:09
Location: Pays Basque (Spain)

Re: When to claim Insufficient Material draw

Postby Pedro Castro » 28 Mar 2005, 02:57

Mate KB vs KB (bishops of opposite color)

7k/5KBb/8/8/8/8/8/8 b - - 1 1
Best wishes,

Pedro Castro
User avatar
Pedro Castro
 
Posts: 180
Joined: 28 Jan 2005, 01:09
Location: Pays Basque (Spain)

Re: When to claim Insufficient Material draw

Postby Anonymous » 28 Mar 2005, 08:38

pedrox wrote:Mate KB vs KB (bishops of opposite color)

7k/5KBb/8/8/8/8/8/8 b - - 1 1


Yes Pedro. But note that your routine returns draw (TRUE) for bishops of opposite color and not draw for bishops of equal color:

if (bishopwhite == bishopblack )
return FALSE; /* meaning no draw, -buers */

The "==" should be "!=", or do I miss something?

Cheers,
Dieter
Anonymous
 

Re: When to claim Insufficient Material draw

Postby Pedro Castro » 28 Mar 2005, 13:40

Yes Dieter, thank you,

I did not say it before (error bishop oposite) reason why she costs to me to express itself in English.

I add the code (in Spanish), is correct ?, I am not myself very bad programmer :) . It is not important for that the code is slow, single I verify once the movement is done, to evaluate I use another code where two knight against king I consider draw, and also bishop against Knight, Knight against knight and bishop against bishop.

Best,

Pedro

tablas = draw
peon = pawn
caballo = knight
alfil = bishop
torre = rook
blanco = white
negro = black
falso = false
verdadero = true

Code: Select all
int   colorcasilla[64] = {
      0, 1, 0, 1, 0, 1, 0, 1,
      1, 0, 1, 0, 1, 0, 1, 0,
      0, 1, 0, 1, 0, 1, 0, 1,
      1, 0, 1, 0, 1, 0, 1, 0,
      0, 1, 0, 1, 0, 1, 0, 1,
      1, 0, 1, 0, 1, 0, 1, 0,
      0, 1, 0, 1, 0, 1, 0, 1,
      1, 0, 1, 0, 1, 0, 1, 0,
   };
----------------------------------------------------------------------------
int tablas()   //comprueba si hay tablas por insuficiencia de material
{
   int i;

   Evalua_material();

   if (peonesblanco == 0 && peonesnegro == 0) {
      if ((piezasblanco < VALOR_TORRE) && (piezasnegro < VALOR_TORRE)) {
         if ((piezasblanco == VALOR_CABALLO) && (piezasnegro == VALOR_CABALLO))
            return FALSO;
         else if ((piezasblanco == VALOR_ALFIL) && (piezasnegro == VALOR_CABALLO))
            return FALSO;
         else if ((piezasblanco == VALOR_CABALLO) && (piezasnegro == VALOR_ALFIL))
            return FALSO;
         else if ((piezasblanco == VALOR_ALFIL) && (piezasnegro == VALOR_ALFIL)) {
               for (i = 0; i < 64; i++) {
               if ((color[i] == BLANCO) && (pieza[i] == ALFIL))
                  alfilblanco = colorcasilla[i];
               if ((color[i] == NEGRO) && (pieza[i] == ALFIL))
                  alfilnegro = colorcasilla[i];
            }
            if (alfilblanco != alfilnegro)
               return FALSO;
            else
               return VERDADERO;
         }
         else
            return VERDADERO;
      }
      else
         return FALSO;
   }
   else
      return FALSO;
}
Best wishes,

Pedro Castro
User avatar
Pedro Castro
 
Posts: 180
Joined: 28 Jan 2005, 01:09
Location: Pays Basque (Spain)

Re: When to claim Insufficient Material draw

Postby Charles Roberson » 28 Mar 2005, 17:47

Hi Peter,

The conditions that I gave were quite sufficient.
By knowing the minimal conditions for mating one can
code tests to see if you have less than those conditions.
If you have less than those conditions, you have insufficient
material.
The toughest bug to find is the one that doesn't exist. (CR -1988)
Charles Roberson
 
Posts: 23
Joined: 22 Dec 2004, 20:07
Location: North Carolina, USA

Re: When to claim Insufficient Material draw

Postby peterhughes » 28 Mar 2005, 23:40

Charles Roberson wrote: insufficient material is fairly simple
you just have to know the elementary endgames

a king and pawn vs a king can mate
a king and queen vs a king can mate
a king and rook vs a king can mate
a king and 2 bishops vs a king can mate
a king, bishop and knight vs a king can mate

...

The conditions that I gave were quite sufficient.
By knowing the minimal conditions for mating one can
code tests to see if you have less than those conditions.
If you have less than those conditions, you have insufficient
material.


Sorry, Charles, I haven't made myself clear in my reply to you. My appologies.

The list of pieces you gave is quite valid (with the exception of the Bishops point I made in my previous reply), but an Insufficent Material Draw is based upon more than just the pieces that are remaining. It's a badly named rule, to be honest. It should be called the "Mate Is Not Possible" draw, because that is actually what it means.

It's not just about having less than mating material. You could have more than mating material, and still not be able to mate the opponent by any sequence of play, no matter how poor.

So, it is not just about the number of pieces remaining, but also the positions they're in. It is this factor that makes "Insufficient Material Draw", in my opinion, hard/costly to compute.

Please look at all the examples in the link that I provided earlier...

http://www.e4ec.org/immr.html

...particularly examples (H) and (I)

If you think you can find an "easy" / cheap way of detecting "Insufficient Material Draw" positions, then I'd very much like to see a pseudo-code, or clearly-stepped description of the mechanics of your algorithm.

Cheers
Peter Hughes
peterhughes
 
Posts: 42
Joined: 18 Jan 2005, 23:37

Re: When to claim Insufficient Material draw

Postby Charles Roberson » 29 Mar 2005, 00:15

F,G, H and I are easy.

With I:
Your program to move -> take rook and announce insufficient material or wait a turn to announce it
Your program just moved -> shouldn't happen, big blunder

G & H are handled by 50 move rule or 3 fold rep of position.

With F, black is forced to ply RxQ, so black does. Now, white
has no legal move thus a stalemate is called by white.

My programs have entered several tournaments. The above
statements will be accepted by TD's.
The toughest bug to find is the one that doesn't exist. (CR -1988)
Charles Roberson
 
Posts: 23
Joined: 22 Dec 2004, 20:07
Location: North Carolina, USA

Re: When to claim Insufficient Material draw

Postby peterhughes » 29 Mar 2005, 11:17

Charles Roberson wrote:F,G, H and I are easy.

G & H are handled by 50 move rule or 3 fold rep of position.



Yes, but that's then 50 wasted moves by each side, and a lot of wasted tournament time. One of the major reasons for having the Insufficient Material Draw rule is to try and detect these "hopeless" positions early, so that a lot of time isn't wasted.

So, do you actually have an algorthm for detecting Insufficient Material Draw (as in examples G & H), or does your "easy" method just boil down to falling back to the 50 Move draw rule? If you don't then that's fine. I don't have one either! I'm actually quite happy just using KvK, KBvK & KNvK, and leaving it at that. It's just that you keep saying that you have this really simple solution, and I'm just not seeing it!

Regards
Peter Hughes
peterhughes
 
Posts: 42
Joined: 18 Jan 2005, 23:37


Return to Programming and Technical Discussions

Who is online

Users browsing this forum: No registered users and 39 guests