I need a little help with my tetris game that I am coding in C++ , here is my problem:
The list of tetris blocks are 7 types: {'I', 'J', 'L', 'S', 'Z', 'O', 'T'}
and i need to pick ONE of the above character such that S and Z are selected with probability 1/12 each, and the other blocks are selected with probability 1/6 each.
What is my best way to generate the blocks according to these probabilities?
Declare and define a twelve-item array with a single occurrence of S and Z; two occurrences each of the rest; and pick a random element from that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With