8 Unordered maps and coroutines

This chapter covers

  • Unordered maps
  • Hashes
  • Coroutines

In this chapter, we will make a matching-pennies game. The game has two players: us and the computer. We each have a coin and choose heads or tails. If the computer matches our choice, we lose. If the computer’s choice differs, we win. We can use a random distribution for the computer’s guess, so we don’t need much code for the first game.

Once we have the initial matching-pennies game working, we’ll see whether the computer can predict our guess by building a mind-reading machine. To be honest, the computer won’t really be able to read our minds. Claude E. Shannon wrote a short paper in 1953 called “A Mind-Reading (?) Machine” (see http://mng.bz/vPDp). The ...

Get Learn C++ by Example 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.