private void updatePlayer(GameContainer container, StateBasedGame game, int delta, Player player, int up, int left,
            int down, int right, int build, int collapse) throws SlickException {

        player.actionCount += delta;
        player.actionCount = Math.min(player.actionCount, Player.MAX_ACTION_COUNT); // arbitrary actionCount limit

        if (container.getInput().isKeyDown(collapse)) {
            if (player.actionCount == 1000) {
                if (board.isConnectedToCapital(player.getXCursorIndex(), player.getYCursorIndex(), player)) {
                    Board.Direction dir = null;
                    if (container.getInput().isKeyDown(right)) {
                        dir = Direction.RIGHT;
                    } else if (container.getInput().isKeyDown(left)) {
                        dir = Direction.LEFT;
                    } else if (container.getInput().isKeyDown(down)) {
                        dir = Direction.DOWN;
                    } else if (container.getInput().isKeyDown(up)) {
                        dir = Direction.UP;
                    }
                    if (dir != null) {
                        // collapsing
                        Building b = board.buildings[player.getXCursorIndex()][player.getYCursorIndex()];
                        if (b != null && b.owner == player && !b.isRubble && !b.isCapital) {
                            board.knockOverBuilding(player.getXCursorIndex(), player.getYCursorIndex(), dir, player);
                            collapseSound.play();
                            player.actionCount = 0;
                            if (!board.player1.hasCapital || !board.player2.hasCapital) {
                                board.state = Board.BoardState.DONE;
                            }
                        }
                    }
                }
            }
        } else {
            // moving cursor
            if (container.getInput().isKeyDown(right)) {
                player.xCursor += .01 * delta;
            } else if (container.getInput().isKeyDown(left)) {
                player.xCursor -= .01 * delta;
            } else {
                player.xCursor = player.getXCursorIndex();
            }
            player.xCursor = bound(player.xCursor, 0, board.width);
            if (container.getInput().isKeyDown(down)) {
                player.yCursor += .01 * delta;
            } else if (container.getInput().isKeyDown(up)) {
                player.yCursor -= .01 * delta;
            } else {
                player.yCursor = player.getYCursorIndex();
            }
            player.yCursor = bound(player.yCursor, 0, board.height);
        }

        if (container.getInput().isKeyPressed(build)) {
            if (player.actionCount == 1000) {
                // building
                if (board.isConnectedToCapital(player.getXCursorIndex(), player.getYCursorIndex(), player)) {
                    Building b = board.buildings[player.getXCursorIndex()][player.getYCursorIndex()];
                    if (b == null) {
                        board.buildings[player.getXCursorIndex()][player.getYCursorIndex()] = new Building(player);
                        player.actionCount = 0;
                        buildSound.play();
                    } else if (b.owner == player && !b.isRubble) {
                        b.height++;
                        player.actionCount = 0;
                        buildSound.play();
                    }
                }
            }
        }

        // if (!container.getInput().isKeyDown(action)) {
        // if (container.getInput().isKeyPressed(action)) {
        // if (player.actionCount == 1000) {
        // Board.Direction dir = null;
        // if (container.getInput().isKeyDown(right)) {
        // dir = Direction.RIGHT;
        // } else if (container.getInput().isKeyDown(left)) {
        // dir = Direction.LEFT;
        // } else if (container.getInput().isKeyDown(down)) {
        // dir = Direction.DOWN;
        // } else if (container.getInput().isKeyDown(up)) {
        // dir = Direction.UP;
        // }
        // if (board.isConnectedToCapital(player.getXCursorIndex(), player.getYCursorIndex(), player)) {
        // if (dir == null) {
        // // building
        // Building b = board.buildings[player.getXCursorIndex()][player.getYCursorIndex()];
        // if (b == null) {
        // board.buildings[player.getXCursorIndex()][player.getYCursorIndex()] = new Building(
        // player);
        // player.actionCount = 0;
        // } else if (b.owner == player) {
        // b.height++;
        // player.actionCount = 0;
        // }
        // } else {
        // // collapsing
        // Building b = board.buildings[player.getXCursorIndex()][player.getYCursorIndex()];
        // if (b != null && b.owner == player) {
        // board.knockOverBuilding(player.getXCursorIndex(), player.getYCursorIndex(), dir);
        // player.actionCount = 0;
        // if (!board.player1.hasCapital || !board.player2.hasCapital) {
        // board.state = Board.BoardState.DONE;
        // }
        // }
        // }
        // }
        // }
        // } else {
        // // moving cursor
        // if (container.getInput().isKeyDown(right)) {
        // player.xCursor += .01 * delta;
        // } else if (container.getInput().isKeyDown(left)) {
        // player.xCursor -= .01 * delta;
        // } else {
        // player.xCursor = player.getXCursorIndex();
        // }
        // player.xCursor = bound(player.xCursor, 0, board.width);
        // if (container.getInput().isKeyDown(down)) {
        // player.yCursor += .01 * delta;
        // } else if (container.getInput().isKeyDown(up)) {
        // player.yCursor -= .01 * delta;
        // } else {
        // player.yCursor = player.getYCursorIndex();
        // }
        // player.yCursor = bound(player.yCursor, 0, board.height);
        // }
        // }
    }