Yahtzee, Sorting, and so on...
by InvadErGII · in Technical Issues · 10/17/2006 (7:23 pm) · 0 replies
I'm working with a friend on a pinball machine (in T2D) based on the classic dice game Yahtzee. A standard Yahtzee roll is going to be a big part of the pinball table's uniqueness, and I'm a bit stuck as to how to implement this. To summarize what I want the code to do, I want it to work something like this:
- 5 random dice rolls from 1-6 (I have this part working just fine)
- A function (perhaps a bubble sort, though I don't know how to make one of these in TorqueScript) that puts the numbers in order, either in an array or something else
- A series of functions that check to see if you have any of the "good rolls" in Yahtzee
The second one of those is giving me the most trouble...I'm not sure how to set up a sorting algorithm like that. Can someone give me a hand?
- 5 random dice rolls from 1-6 (I have this part working just fine)
- A function (perhaps a bubble sort, though I don't know how to make one of these in TorqueScript) that puts the numbers in order, either in an array or something else
- A series of functions that check to see if you have any of the "good rolls" in Yahtzee
The second one of those is giving me the most trouble...I'm not sure how to set up a sorting algorithm like that. Can someone give me a hand?
About the author