oreillymedia / etudes-for-elixir

Companion exercises for Introducing Elixir
http://chimera.labs.oreilly.com/books/1234000001642
515 stars 159 forks source link

Shuffle player hand on pickup #45

Open tomcola512 opened 8 years ago

tomcola512 commented 8 years ago

With a full deck the runtime of the game can be enormous. Shuffling the player's hand is pretty effective at breaking gameplay cycles. This changes the expected runtime from "unbearable" with 4 suits to "reasonable" with even 15 suits.

This also would allow for a paragraph on flow control and is an interesting type of deadlock preventing deadlock.