Talk:Learning Haskell with Chess

From HaskellWiki
Revision as of 13:28, 19 March 2007 by Chessguy (talk | contribs) (A few comments)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

list handling vs. abstract data types (array)

Lists are very inefficient, but understanding list handling is important for understanding functional programming. On the other hand, using Array would provide understanding for abstract data types.

using state monad for the board

Only possible with advanced students, do not try this in introductory courses.

full ruleset vs. reduced and simplified ruleset

To implement the full ruleset you have to remember and consider previous states (in particular for castling rule and capturing en passant).

-- Actually, this isn't so bad to do. It's entirely possibly by simply checking and updating flags. A single Int with a few bit masks could easily do it. One thing to consider as far as what needs to be encoded in any given position to be able to determine all legal moves is the FEN specification for representing moves: [[1]] -- Andrew Wagner.

representation of positions

Is type Pos = (Int,Int) ok? Or better something like type Pos = (Row, Column), data Row = A | B | ... | H, data Column = ?. How to model the constraints (0<=x,y<=7)?

-- There are several ways to handle this. Much work has been done in figuring out what the best way is, but I'll just point you to the first two articles at [[2]] I should point out that the theory behind using bitboards has advanced significantly since those articles were written, and I would strongly recommend looking at that. -- Andrew Wagner