@Override
	public void doUserCommand(int num) {
		command = num;
		switch(num){
		case 0:
			initGame();
			break;
		case 1:
			if(moveUp()){
				setSquare(squareVal(),squarePlace(getFreeSpotsNum()));
				setChanged();
				notifyObservers();
			}
			break;
		case 2:
			if(moveDown()){
				setSquare(squareVal(),squarePlace(getFreeSpotsNum()));	
				setChanged();
				notifyObservers();
			}
			break;
		case 3:
			if(moveRight()){
				setSquare(squareVal(),squarePlace(getFreeSpotsNum()));	
				setChanged();
				notifyObservers();
			}
			break;
		case 4:
			if(moveLeft()){
				setSquare(squareVal(),squarePlace(getFreeSpotsNum()));
				setChanged();
				notifyObservers();
			}
			break;
		case 5:
			restartGame();
			break;
		case 6:
			undoMove();
			break;
		case 7:
			save();
			break;
		case 8:
			load();
			undoMove();
			break;
		case 11:
			// continue the game after hit 2048.
			succeed = false;
			check 	= false;
			break;
		case 12:
			stop = true;
			break;
		case 13:
			// minimax - alpha beta -  run
			getAI(host, port); 
			break;
		default:
			break;
		}
	}