rstudio-education / hopr

This is the development site for Hands-On Programming with R, a book that teaches how to program in R, with hands-on examples. Read the book at https://rstudio-education.github.io/hopr.
Other
254 stars 331 forks source link

Slot Machine #57

Open vanerichard opened 3 years ago

vanerichard commented 3 years ago

The slot machine project does not consider the diamonds as wild symbols, so that means that the only way to "duplicate" the prize is if you have 3 diamonds. I don't know if this was intentional.

jderavin commented 3 years ago

Yes I agree. To duplicate the actual slot machine game as described in the text, there needs to be a little more logic so that, for example, "7", "7", "DD" is regarded as a "win" with three of the "same" symbol. Also the same applies to the prize for "all bars": "B", "BBB", "DD" should score a prize for all bars, allowing for the wild card status of diamonds, but doesn't with the existing suggested coding.

jderavin commented 3 years ago

Further to my previous comment, having now read the rest of the book (in particular, Section 11 on loops) I now see that in Section 11.6 there is an exercise that is intended to produce code that will allow for diamonds being "wild". Even so, perhaps it is worth including a sentence in Section 9 noting that "diamonds" in Section 9 are not yet treated as "wild", but that this issue will be addressed in Section 11? That way, readers such as vaneric86 and myself won't be left in doubt as to the accuracy of the code in Section 9.

jderavin commented 3 years ago

Sorry I referred in my previous comment to "Section 11.6" but actually what I meant was, "Exercise 11.6 in Section 11.3".