@Override
	public void move(int id, int[] direction) throws RemoteException {
		Point point = store.getPlayerPosition(id);
		point.x = (point.x + direction[0] + map.MapWidth) % map.MapWidth;
		point.y = (point.y + direction[1] + map.MapWidth) % map.MapWidth;
		for (Entry<Integer, GameService> r : playerMap.entrySet()) {
			if (r.getKey() != id) {
				if (store.getPlayerPosition(r.getKey()).equals(point)) {
					return;
				}
			}
		}
		if (map.erasePoint(point.x, point.y)) {
			store.incrementScore(id);
			for (Entry<Integer, GameService> r : playerMap.entrySet()) {
				GameService iterable = r.getValue();
				iterable.updatePosition(new PlayerData(point, store
						.getPlayerScore(r.getKey()), id));
				iterable.updateMap(point);
			}

		} else {
			for (Entry<Integer, GameService> r : playerMap.entrySet()) {
				GameService iterable = r.getValue();
				iterable.updatePosition(new PlayerData(point, store
						.getPlayerScore(r.getKey()), id));
			}
			store.setPlayerPosition(id, point);
		}
		if (map.isEmpty()) {
			int winner = store.getWinner();
			GameService remote = playerMap.remove(winner);
			for (GameService r : playerMap.values()) {
				r.lose();
				r.updateScore(0);
			}
			remote.win();
			remote.updateScore(0);
			playerMap.put(winner, remote);
			store.renitializeScores();
			map = new GameMap(numberOfSweets, 20, 20);
			map.generateMap();
			saveInitialState();
		}
		saveGameState();

	}