Summary
In this chapter we have seen how to structure your data using structs and enums. These programming language features make it easier to start to see the entities in your code. Our fly catch games now have a spider and a fly, and the change calculator has coins. Adding these entities also helps bring out functionality of the program, with functions like spider_caught_fly
and time_to_appear
.
In the next chapter we will see how we can use some new language features to modularise the handle input and update game functionality in the fly game.