View Single Post
Old 12-05-2012, 08:37 PM   PM User | #7
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,198
Thanks: 59
Thanked 3,996 Times in 3,965 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Quote:
Originally Posted by triko View Post
OK! as usual I haven't explained...
I have the problem of the game roulette...
When click start, put out one number random from 0 to 36
Code:
THIS CODE IS WRONG AS NOTED BY WOLFSHADE 
var ball = Math.floor(Math.random()*36);
before I have all my bets, example corners, split, red or black ecc... My problem born for corner, split, column, dozen ecc... Because I have all array of the possible combination, example columns:
Code:
       var col1 = [1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34];
       var col2 = [2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35];
       var col3 = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36];
...
And we *GAVE* you the RIGHT ANSWER!!!

Code:
if ( col1.indexOf( ball ) >= 0 ) 
{
    // ball is in col1
} else if ( col2.indexOf( ball ) >= 0 ) {
    // ball is in col2
} else if ( col3.indexOf( ball ) >= 0 ) {
    // ball is in col3
} else ... other tests ...
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is online now   Reply With Quote