Rock-paper-scissors: Difference between revisions
Content added Content deleted
Line 637: | Line 637: | ||
void move( int p, int m ) { _moves[p][m]++; } |
void move( int p, int m ) { _moves[p][m]++; } |
||
int getMove( int p, int m ) { return _moves[p][m]; } |
int getMove( int p, int m ) { return _moves[p][m]; } |
||
string format( int a ) |
|||
{ |
{ |
||
char t[32]; |
|||
wsprintf( t, "%.3d", |
wsprintf( t, "%.3d", a ); |
||
string d( t ); |
|||
return d; |
|||
} |
|||
void print() |
|||
wsprintf( t, "%.3d", _win[PLAYER] ); string pw( t ); |
|||
{ |
|||
wsprintf( t, "%.3d", _moves[PLAYER][ROCK] ); string pr( t ); |
|||
string d = format( _draw ), |
|||
pw = format( _win[PLAYER] ), cw = format( _win[COMPUTER] ), |
|||
wsprintf( t, "%.3d", _moves[PLAYER][SCISSORS] ); string ps( t ); |
|||
pr = format( _moves[PLAYER][ROCK] ), cr = format( _moves[COMPUTER][ROCK] ), |
|||
pp = format( _moves[PLAYER][PAPER] ), cp = format( _moves[COMPUTER][PAPER] ), |
|||
ps = format( _moves[PLAYER][SCISSORS] ), cs = format( _moves[COMPUTER][SCISSORS] ), |
|||
pl = format( _moves[PLAYER][LIZARD] ), cl = format( _moves[COMPUTER][LIZARD] ), |
|||
wsprintf( t, "%.3d", _win[COMPUTER] ); string cw( t ); |
|||
pk = format( _moves[PLAYER][SPOCK] ), ck = format( _moves[COMPUTER][SPOCK] ); |
|||
wsprintf( t, "%.3d", _moves[COMPUTER][PAPER] ); string cp( t ); |
|||
wsprintf( t, "%.3d", _moves[COMPUTER][SCISSORS] ); string cs( t ); |
|||
wsprintf( t, "%.3d", _moves[COMPUTER][LIZARD] ); string cl( t ); |
|||
wsprintf( t, "%.3d", _moves[COMPUTER][SPOCK] ); string ck( t ); |
|||
system( "cls" ); |
system( "cls" ); |