Computer Chess Club Archives


Search

Terms

Messages

Subject: Do you have code to check if a FEN is legal position?

Author: Uri Blass

Date: 01:51:35 02/05/05


I want to have a loop on all the legal FEN of tablebases positions (at least fen
of 4 pieces) in order to debug my code to use tablebases and also to debug the
function that I plan to write that should check if a FEN is legal.

I gave the source code of movei to Dann Corbit and he wrote for me a function
that does part of it that is not based on the rest of the code of movei but it
does not check things like if the side to move can capture the opponent king and
I find the program hard to understand because for some reason Dann used a lot of
char ** that I never use  in movei.

It may be because of my lack of knowledge in programming but I see no reason to
use ** for tasks like that and I see no advantage in it and it only cause
problems in understanding such a code.

I understand that ** should be pointer to pointer but not more than it and
I have no experience with code like that.

I think simply to read the FEN string char after char and collect information
when I never need to go backward in the string when Dann's code does not do it
and in order to check if there is a single king it simply count K in the
relevant part of the string that is called piece_placement

It is used as char ** in one function tokenize_position_string and as char * in
another function setup that calls tokenize_position_string(I guess that the
computer simply translate char* to char **)


I still do not fully understand the code that Dann wrote for me at this
moment(note that this code has nothing to do with the moves of the engine and it
is only about checking the FEN that the program does not use during games) and I
feel that I spend too much time about trying to understand things that are not
relevant to the playing strength.

I think that I will write my own code for that task instead of Dann's code and
I already started with it.

I wonder if you do it.

Uri



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.