Rock-paper-scissors: Difference between revisions

Line 683:
r = rand() % total;
 
iffor( rint <i s= )ROCK; returni < SCISSORS; i++ )
s = statistics.getMove( PLAYER, ROCK );
{
if( r < s ) return SPOCK;
s = statistics.getMove( PLAYER, ROCKi );
r -= s;
if( r < s ) return SPOCK( i + 1 );
 
r -= s;
s = statistics.getMove( PLAYER, SPOCK );
}
if( r < s ) return PAPER;
r -= s;
 
s = statistics.getMove( PLAYER, PAPER );
if( r < s ) return LIZARD;
r -= s;
 
s = statistics.getMove( PLAYER, LIZARD );
if( r < s ) return SCISSORS;
r -= s;
 
return ROCK;