What You've Learned

In this chapter, we made the computer player for our Dice of Doom game much more sophisticated. We implementing the game tree using lazy lists, and applied several optimization techniques to limit the number of board positions that are searched by the AI engine. Along the way, you learned the following:

  • Lazy programming allows you to work with very large (and even infinite) data structures and do so efficiently.

  • Once you have a lazy macro and a force function, you can use them to build more sophisticated lazy operations, including building a lazy list library.

  • Heuristics are imperfect algorithms that can be used to improve the performance of your code, with some creative thinking. In our example, we made some heuristic changes to how we score leaf nodes.

  • Once we converted Dice of Doom to use a lazy tree, we were able to elegantly trim the game tree in order to limit how deep the AI thinks when contemplating its moves.

  • Alpha-beta pruning lets us improve performance even more, by pruning branches that have no way of impacting the final scores on the moves being considered by the AI.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.190.217.253