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]; }
void print()
string format( int a )
{
{
char t[256];
char t[32];
wsprintf( t, "%.3d", _draw ); string d( t );
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 );
wsprintf( t, "%.3d", _moves[PLAYER][PAPER] ); string pp( t );
string d = format( _draw ),
pw = format( _win[PLAYER] ), cw = format( _win[COMPUTER] ),
wsprintf( t, "%.3d", _moves[PLAYER][SCISSORS] ); string ps( t );
wsprintf( t, "%.3d", _moves[PLAYER][LIZARD] ); string pl( t );
pr = format( _moves[PLAYER][ROCK] ), cr = format( _moves[COMPUTER][ROCK] ),
wsprintf( t, "%.3d", _moves[PLAYER][SPOCK] ); string pk( t );
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 );
wsprintf( t, "%.3d", _moves[COMPUTER][ROCK] ); string cr( 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" );