You can randomly generate three symbols with the sample function-just like you randomly “rolled” two dice in Project 1: Weighted Dice. First, it will need to randomly generate three symbols and, second, it will need to calculate a prize based on those symbols. The play function will need to do two things.
When you’re finished, you’ll be able to play it like this: play() In this chapter, you will build a real, working slot machine that you can play by running an R function.