Hacker News new | past | comments | ask | show | jobs | submit login

Fantastic question! Quick and dirty solution is simply to choose a distribution that isn't uniformly random!

Instead of starting with your random number generator, build up the discrete probability distribution function first. The histogram can have any shape you want.

So, for example, in Tetris, rather than choosing a uniformly random next piece, we give a 10% probability to a straight one, 20% to right-sided L, etc. Now we begin to see patterns that can make gameplay challenging or interesting. If a shape has not appeared in a while purely out of chance, alter the distribution. Keeping track of what cards have been played and what moves have been made forms the basis of a feedback loop that constantly evolves.




Tetris is actually an interesting example:

http://tetris.wikia.com/wiki/Random_Generator

Officially branded Tetris games are required to use a "random bag" algorithm where they generate random permutations of the 7 tetrominos, so that for every 7 pieces (aligned with the bag start) you get each type once. You can only get two in a row if they appear at the end of one bag and the start of the next, and conversely there's a maximum of 12 pieces between duplicates (start of one bag, end of the next). Three in a row will never happen.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: