So I am making a checkers game and I am still pretty new to c so can you tell me whats wrong with this player move function.
If it would help i can paste the hole thing if you want.
Code:int PLAYER_MOVE() { int oldnum,newnum,k,l; char old,new; printf( "Enter current and next location your checker>>" ); scanf( " %d%c%d%c", &oldnum, &old, &newnum, &new ); switch ( old ) { case 'a': k=0; case 'b': k=0; case 'c': k=1; case 'd': k=1; case 'e': k=2; case 'f': k=2; case 'g': k=3; case 'h': k=3; } switch ( new ) { case 'a': l=0; case 'b': l=0; case 'c': l=1; case 'd': l=1; case 'e': l=2; case 'f': l=2; case 'g': l=3; case 'h': l=3; } int t; while( t == 0 ) { if ( BOARD[oldnum][k].PLAYER_THAT_OWNS == '1' ) { if ( ( oldnum - newnum == 1 ) || ( ( BOARD[oldnum][k].RANK == 'k' ) && ( ( oldnum - newnum == 1 ) || ( newnum - oldnum == 1 ) ) ) ) { char theoldrankonplayer; theoldrankonplayer == BOARD[oldnum][k].RANK; BOARD[newnum][l].RANK == theoldrankonplayer; BOARD[newnum][l].PLAYER_THAT_OWNS == '1'; BOARD[oldnum][k].RANK == ' '; BOARD[oldnum][k].PLAYER_THAT_OWNS == ' '; t++; } } else { printf( "Bad move!" ); } } }



LinkBack URL
About LinkBacks


