Now that we have pieces and a board, we need a convenient way of setting pieces on the board in specific positions. We’ll use this, not only for the initial position of a game, but also to configure a board with specific game scenarios for testing and debugging.
…We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%.
Chess programming is most assuredly in the 3%! Our challenge in this series will be to strike a reasonable balance between efficiency and clarity. Our first opportunity to that end is the chess piece.
Programming a competent chess engine in lisp has been a goal of mine for some time. I finally did so in 2021, and it was a lot of fun! My new goal is to rewrite the code in a step by step way that emphasizes clarity, and to present it as a clear tutorial for writing a chess engine, and as a general Racket tutorial.
I occasionally compile some statistics on programming language popularity by running a bunch of Google searches to rank programming languages according to the number of results. I wouldn’t read too much into these stats, but they are not without value.
Here’s a great, two part, video by Matthew Flatt about embedding DSLs in Racket. Being able to hack the language is one of Racket’s/Lisp’s killer features: