Playing a round of checkers
Now, it's time to take a break and play checkers. For this recipe, we are going to implement an artificial intelligence kernel capable of analyzing a checkers board, determining, under the game rules, where to move while staying out of the reach of the opponent's attacks, and spotting the opportunity as to when it can capture some of the enemy's soldiers.
Let's go through a little refresher of the game of checkers. You and your opponent are located on a square chess board, but you are only able to move diagonally over black squares one step at a time. Also, you can only move forward. Both of you can capture an enemy piece if it is situated just one step away from one of your pieces, provided that when you jump over it ...
Get Clojure Data Structures and Algorithms Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.