private void addCommandToState(Command command, AgentInState aPos,
			State newState, State currentState) {

		for (BoxInState bPos : currentState.boxes) {
			newState.boxes.add(new BoxInState(bPos.b, bPos.f));
		}

		if (command.cmd.equals("Move")) {
			newState.agents.add(new AgentInState(aPos.a,
					aPos.f.neighbors[command.dir1.ordinal()]));

		} else if (command.cmd.equals("Pull")) {

			for (BoxInState bPos : newState.boxes) {
				if (aPos.f.neighbors[command.dir2.ordinal()] == bPos.f) {
					bPos.f = aPos.f;
					newState.agents.add(new AgentInState(aPos.a,
							aPos.f.neighbors[command.dir1.ordinal()]));
				}
			}

		} else if (command.cmd.equals("Push")) {

			for (BoxInState bPos : newState.boxes) {
				if (aPos.f.neighbors[command.dir1.ordinal()] == bPos.f) {
					// newState.boxes.add(new BoxPosInState(bPos.b,
					// bPos.f.neighbours[command.dir2.ordinal()]));
					newState.agents.add(new AgentInState(aPos.a, bPos.f));
					bPos.f = bPos.f.neighbors[command.dir2.ordinal()];
				}
			}

		}
	}