Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: How confident are you that you could have done this?

Author: Dann Corbit

Date: 11:09:00 02/10/06

Go up one level in this thread


On February 10, 2006 at 14:00:14, Dieter Buerssner wrote:

>On February 10, 2006 at 01:40:35, Dann Corbit wrote:
>
>
>>I would have greatly simplified it to an absurd degree.
>[...]
>>I would have found the enemy king location and looked ONLY for check moves.
>
>I don't see, how this simpliefies the problem (in the sense of less programming
>effort). To me it looks, like this would complicate the program significantly.

Instead of looking at all the moves, I would only trace backwards from the enemy
king along the 8 rays and along the 8 knight attacks.  One friendly piece on the
ray is OK (since it can be captured) but we stop there.  And so I mark these
positions on the board.

After marking the positions that can lead to check, I look at each friendly move
to see if it can get there.

After my set of checks has been generated, I look to see for any single
refutation by capture, moving the king or interposition.

If there are none, it is not checkmate and if there are any then it is not a
mate in one.

>>I would also have made a very ugly board representation (just array with huge
>>edges so I would not overwrite the bounds sliding 8 past the edge of the board.)
>
>This again might not simplify the problem, but is more debatable. At some stage,
>you have to look, if the piece is inside or outside. I see no big difference (in
>programming effort), if you do this, before you place the piece, or after you
>place it.

I would have made a 24x24 board, with the corner of the real board at 7,7 so
that I can iterate without fear of memory over-write or accessing out of bounds
pointer.

I won't turn in a program that produces undefined behavior intentionally

>Regards,
>Dieter
>
>PS. Perhaps I try it after dinner. But then, it would be no fair conditions. I
>have read parts of this thread already, and had some thoughts about how I would
>solve it. In the real test, I would not have had this.



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.