base.h
bool serialControl() {
#if enableSerial
	switch( readSerial() ) {
		case -1: // nothing...
			return false;
		case 119: // "w"
			writeSerial( "Moving tiles up..." );
			return moveUp();
		case 97: // "a"
			writeSerial( "Moving tiles left..." );
			return moveLeft();
		case 115: // "s"
			writeSerial( "Moving tiles down..." );
			return moveDown();
		case 100: // "d"
			writeSerial( "Moving tiles right..." );
			return moveRight();
		case 112: // "p"
			writeSerial( "Refreshing board..." );
			printBoard();
		default:
			return false;
	}
#endif
	return false;
}
// read control chars via serial and take coressponding actions
// 1 if action taken (board changed), 0 if nothing done to board
read control chars via serial and take coressponding actions
1 if action taken (board changed), 0 if nothing done to board
read control chars via serial and take coressponding actions 1 if action taken ( board changed ) 0 if nothing done to board
bool serialControl() {
#if enableSerial
	switch( readSerial() ) {
		case -1: 
			return false;
		case 119: 
			writeSerial( "Moving tiles up..." );
			return moveUp();
		case 97: 
			writeSerial( "Moving tiles left..." );
			return moveLeft();
		case 115: 
			writeSerial( "Moving tiles down..." );
			return moveDown();
		case 100: 
			writeSerial( "Moving tiles right..." );
			return moveRight();
		case 112: 
			writeSerial( "Refreshing board..." );
			printBoard();
		default:
			return false;
	}
#endif
	return false;
}
bool serialControl ( ) { #if enableSerial switch ( readSerial ( ) ) { case -1 : return false ; case 119 : writeSerial ( " " ) ; return moveUp ( ) ; case 97 : writeSerial ( " " ) ; return moveLeft ( ) ; case 115 : writeSerial ( " " ) ; return moveDown ( ) ; case 100 : writeSerial ( " " ) ; return moveRight ( ) ; case 112 : writeSerial ( " " ) ; printBoard ( ) ; default : return false ; } #endif return false ; }
read control chars via serial and take coressponding actions
1 if action taken (board changed), 0 if nothing done to board
read control chars via serial and take coressponding actions 1 if action taken ( board changed ) 0 if nothing done to board
// nothing... // "w" // "a" // "s" // "d" // "p"