One of the benchmarks in reinforcement learning is gaming. Many different environments related to gaming have been designed by researchers or aficionados. A few of the milestones in gaming have been mentioned in Chapter 1, Getting Started with Artificial Intelligence in Python. The highlights for many would certainly be beating the human champions in both chess and Go—chess champion Garry Kasparov in 1997 and Go champion Lee Sedol in 2016—and reaching super-human performance in Atari games in 2015.
In this recipe, we get started with one of the simplest game environments: blackjack. Blackjack has an interesting property that it has in common with the real world: indeterminism.
Blackjack is a card game where, in its simplest form, you play against a card dealer. You have a deck of cards in front of you, and you can hit, which means you get one more card, or stick, where the dealer gets to draw cards. In order to win, you want to get as close as possible...