Is there any library which can be used to validate chess moves and simulate games in .NET? It would be great if the library can understand moves in Algebraic notation and also provide simple API for making moves. For example, game.Move("E2","E4") etc. In the second case, the library should be able to generate Algebraic notation for the moves. I don't want it to make moves or to play chess etc, just a library for game validation and game simulation. Any links?
Have a look at the C# Chess Game Starter Kit. It is a C# Open Source Application that does exactly what you requested and it is free for commercial use.
For a detailed explanation of the source code see:
There is also sharpchess which is open source (under GNU GPL) and written for .Net v2 It has a core engine as well as a WinForm GUI. Although it does play chess, I believe that you potentially strip out the "game engine" to leave a shell for simulation.
Some bullet points from the site
* Graphical chess board.
* Helpful high-lighting of legal chess moves, when clicking on a piece.
* Move history displayed.
* Undo/Redo moves.
* Load/Save chess games during play.
* Replay your saved games.
* Paste FEN positions from the clipboard.
Chess engine features
* WinBoard compatible.
* 0x88 board representation.
* Opening book containing over 1300 varied opening positions.
Programming features
* A well-designed, and hopefully easy-to-understand, object-model that will enable other developers to quickly get involved in the project.
i published my chess-movement-validator on github.
Example:
var board = Board.GetNewBoard();
board.SetPiece<Rook>( ChessColor.White, 'A', 1 );
var result = board.MovePiece( 'A', 1, 'A', 8 );
来源:https://stackoverflow.com/questions/1486483/chess-move-validation-library