@Override
	public JSONObject doCommand(JSONObject input) throws JSONException {
		
		int x = -1;
		int error = -1;
		int id = -1;
		boolean won = false;
		JSONArray command = null;
		JSONObject retObj = new JSONObject();

		try {
			id = input.getInt("ID");
			command = input.getJSONArray("COMMAND");
		} catch (JSONException e) {
			// the input is malformed
			/* HTTPResponse.FAIL */
			System.out.println("Malformed input JSON");
			error = 3;
		}

		String commandName = null;
		commandName = (String) command.getString(0);
		
		
		if(commandName.equalsIgnoreCase("move")){
			
			x = command.getInt(1);
			int type = command.getInt(2);
			if (whoseTurn == id) {
				
				int y = doMove(x,type);
				
				if (y!=-1) {
					if (checkWin(x,y,id)) {
						System.out.println("player " + id + " won!");
						won = true;
						gameRunning = false;
					}
				}else{
					error = 2;
				}
			}else{
				error = 1; 
			}
		}else if(commandName.equalsIgnoreCase("doworkson!")){
			won=true; //thatswhatsup
		}else{
			
			//command not recognized
		}
		
		
		
		//return object creation
		JSONObject rWhat = new JSONObject();
		try {
			rWhat.put("ERROR", error);
			rWhat.put("WON", won);
		} catch (JSONException e) {
			e.printStackTrace();
			System.out.println("Error creating return object");
		}
		
		
		
		return rWhat;
	}