Roulette

Hi i want a textbased roulette game, where the user uses the potentiometer to select a number based on the resistance, and the number is displayed on the screen. but the wheel of a roulette wheel doesnt have the numbers in order, so i need someway for the program to know the order of the numbers on a roulette wheel, ie. 1,5,17,3 etc. how can i do this - an array? thanks

alex

An array would be good, and since the numbers don’t need to be changed, you can make it a constant array, which will free up your AVR’s resources a little. So, you would do something like:

const unsigned char single_zero_wheel[37]={0,32,15,19,4,21,2,25,17,34,6,
											27,13,36,11,30,8,23,10,5,24,
											16,33,1,20,14,31,9,22,18,29,
											7,28,12,35,3,26};

Or, if you wanted an American style roulette wheel:

const unsigned char double_zero_wheel[38]={0,28,9,26,30,11,7,20,32,17,5,
											22,34,15,3,24,36,13,1,00,27,
											10,25,29,12,8,19,31,18,6,21,
											33,16,4,23,35,14,2};

-Adam

P.S. Wikipedia is so useful!

ha! i wondered how you knew the wheel, thanks alot…