Pages: [1]   Go Down
Author Topic: Slot machine spin down rate  (Read 688 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 46
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thought I would try to emulate a slot machine wheel. I know it starts out fast and slows gradually simulating friction, and then when almost on a number,  it could pass it to the next or slip back to the first number. I would use a single digit 7 segment LED/LCD display.

Not sure of all the math involved? Could someone help?
Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

1) initialize it with a random speed;
2) exponentially decay it down to a threshold; keep count of how long it takes to go down to that threshold;
3) random generate a number between 0..1;
4) if that number if >= 0.5, round up / or down the count;
5) all the time, display that count.

It should be fairly simple.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 46
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks you, that's what I needed, a bit of shove in the right direction.    smiley
Logged

Pages: [1]   Go Up
Jump to: