10 Making some games
This chapter covers
- Adding randomness to our programs
- Designing and programming a code-breaking logic game
- Designing and programming a press-your-luck dice game
People learn to program for many reasons. Some people want to automate tedious tasks as we did in the previous chapter. Some people want to work with artificial intelligence (AI; you’ll get a taste of that in chapter 11). Other people want to make interactive websites, Android or iOS apps, or Alexa skills. There’s an endless amount of stuff that programmers can make.
Another popular reason to learn programming is to create games. For that reason, we thought we’d continue our Copilot programming journey with you by designing two small computer games. The first is a code-breaking game where you use clues to identify the computer’s secret code. The second is a two-player dice game where each player needs to balance risk and luck to reach the required number of points before the other player does. Instead of using graphics and animation, these games use text. We’ve made this decision to help us stay focused on the game logic, rather than the way that the game is represented or the way that the player interacts with the games. Along the way, we offer some next steps if you’re interested in taking your game-making abilities further. And don’t worry, your current skills are a great start to that!