What You've Learned
In this chapter, we used our knowledge of functional programming to develop a board game with AI. Along the way you learned the following:
Functional programming techniques allow you to write a game program with a “rule engine” that is separate from the rest of the code. You accomplish this by using function pipelining and building a game tree that is independently traversed by other parts of your game code as the game progresses.
You can create an AI player for a two-player game using the minimax algorithm. This algorithm is based on the truism “What is good for my enemy is bad for me.” It allows you to efficiently rate positions in a two-player board game.
Lexical variables (which we’ve been calling local variables) can live ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access