# is there any bug ?

It is indeed not a bug but a move called 'en passant':

http://en.wikipedia.org/wiki/En_passant

That move can only be made if it's made immediately after a pawn has moved two squares right next to an opponent's pawn.

This rule exists so that there is always at least one chance to for a pawn on one file to capture a pawn on the next file.
And yeah it is indeed probably the most confusing rule in chess -- but once you've seen a few of those you get used to it :)
I think the most confusing rule in chess is:

The draw rule of Insufficient Material (to checkmate).

If the position is such that neither side can checkmate, the game is automatically is a draw.

This is so difficult to implement.
All we can do, as programmers, is check basic patterns--like, only the two kings are left on the board, or, there are two kings and one bishop or one knight.

But there could be 4 pawns for each color, all fixed on each other and unable to move, and checkmate is still impossible to reach by either side, no matter how many "mistakes" are made.

So I think, from a programmatic perspective, that's the most difficult chess rule.
Yeah, didn't think of that one :)
Another one that sort of surprised me was draw by timeout when the side who still has time doesn't have material for mate.
Heh, BTW I wonder if timeout draws by insufficient checkmate material consider the possibility of a smothered mate in cases where material would otherwise be insufficient? Try to program that one :)
Yea the timeout thing I think was just, like, it calculates who had the massive material advantage and decides whether to treat the game as a draw, even though one player flagged on their clock.

Here's an example of what I meant:
http://en.lichess.org/ccimhl3xv9yq

Thibault's current design, automatically declared this game as a draw the moment the last piece was captured.
thibault's algorithm includes two bishops and two Kings = draw by insufficient material to mate?

This is not so.
It is possible to checkmate in that game I linked, although against decent players highly unlikely.

Imagine White's King on a8 instead of a5,
White's bishop on a7 instead of d4,
my (Black's) King on c8 (or c7) instead of c6,
my (Black) bishop on c6 instead of d7

That is a reachable position, legally, which meant I could have won that game by checkmate, although that guy's way too good for that trick to have worked. It probably would have drawn anyway by the 50 move draw rule.
You kind of ninja'd me there.

Except my example was with bishops.

But yeah, two kings + 2 knights (one per each side, not 2 of the same color) = a very slim possibility of checkmating. Using the "smothered" scheme you mentioned. There is even a chess endgame puzzle using a mate problem based off of that idea, so it is possible.

But thibault's current program would instantly declare it as a draw by insufficient material. :P

Tough shit.
ok, thanks :) that is good :)

This topic has been archived and can no longer be replied to.