List possible moves for player - Haskell implementation I'm trying to implement a function in Haskell that returns a list containing all possible moves for the player who's up. The function's only argument is a String composed of an actual state of the board (in Forsyth-Edwards Notation) followed by the moving player(b/w).
Notation example : rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w (starting board state)
So far I used a function to split the string into ranks, but I'm having a hard time coming up with an implementation.
Any tips?
FEN is fine for unambiguous communication of a position (if you include castling and e.p. state too) but the internal representation should be as a board, with some kind of movement so you can efficiently check for legal moves, blocks, checks etc. Would hate to do all that with regex!
This quite a well-travelled area, and there must be much material online. You have made the choice to use Haskell here: what is the motivation for this? Are you trying to learn Haskell, or do you think it’s appropriate for certain aspects of a chess engine.
Chess is a finite directed binary graph, with each position just a node. There is certain machinery to reach that level of abstraction, but ultimately I would think a functional language like Haskell might really begin to show its worth when you have reached that conceptual level.
Depends also what you want your engine to do: find good moves, solve problems, analyse endgames, tablebases, retrograde analysis, support fairy chess. So please say more! :)