-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
api documentation #18
Comments
Hi.. The library functionality is well documented at code level. So at the moment there are no plans to provide more documentation. Unless of course there is a specific issue with it. |
Hi, For instance, how can I create a new game? Also game has a lot of the same methods as position, should we be calling these methods from game or the position? Cheers again for your hard work on this. |
The Position class implements the IPosition interface so you can simply create a new Position. For starting a new game with start position you can do something like var position = new Position();
var game = GameFactory.Create(position);
var actual = game.NewGame(); The NewGame method has a overload for a FEN string which allows to set the position in the game without having to re-create a new Position object. You can use the Pos property as it will always contain the current position data (updated when moves are made etc). To retrieve what pieces that currently is in the game, I would recommend you use the game property Occupied or the various methods on the Position property directly through the game object. var pieces = game.Occupied;
foreach (var sq in pieces)
{
var piece = game.Pos.GetPiece(sq);
Console.WriteLine(piece.ToString());
}
I believe you are thinking about the MakeMove() and TakeMove() methods, as they seem very identical. Where possible, always use the methods located in the game object. If needed, they will use the position variants of those same methods. The reason for this is that its possible to use the Position class by itself for various things with respects to UI stuff etc.
Thanks |
hi, could you provide some summary of the api
The text was updated successfully, but these errors were encountered: