src/demo/Maze.java
public void commitAction(Agent agent, int action) {
        int x = mazeAgentCurrent.x;
        int y = mazeAgentCurrent.y;
        switch (action) {
            case 0 -> x--;
            case 1 -> x++;
            case 2 -> y--;
            case 3 -> y++;
        }
        mazeAgentCurrent = new MazeAgent(x, y, action);
        if (mazeAgentHistory.size() == agentHistorySize) mazeAgentHistory.pollFirst();
        mazeAgentHistory.addLast(mazeAgentCurrent);
        maze[x][y].updateCellTimeStep(++timeStep);
        maze[x][y].incrementCount();
        updateState();
        setReward(agent);
    }
/**
     * Takes specific action.
     *
     * @param agent  agent that is taking action.
     * @param action action to be taken.
     */
Takes specific action.
@param agent  agent that is taking action.
@param action action to be taken.
Takes specific action . @param agent agent that is taking action . @param action action to be taken .
public void commitAction(Agent agent, int action) {
        int x = mazeAgentCurrent.x;
        int y = mazeAgentCurrent.y;
        switch (action) {
            case 0 -> x--;
            case 1 -> x++;
            case 2 -> y--;
            case 3 -> y++;
        }
        mazeAgentCurrent = new MazeAgent(x, y, action);
        if (mazeAgentHistory.size() == agentHistorySize) mazeAgentHistory.pollFirst();
        mazeAgentHistory.addLast(mazeAgentCurrent);
        maze[x][y].updateCellTimeStep(++timeStep);
        maze[x][y].incrementCount();
        updateState();
        setReward(agent);
    }
public void commitAction ( Agent agent , int action ) { int x = mazeAgentCurrent . x ; int y = mazeAgentCurrent . y ; switch ( action ) { case 0 -> x -- ; case 1 -> x ++ ; case 2 -> y -- ; case 3 -> y ++ ; } mazeAgentCurrent = new MazeAgent ( x , y , action ) ; if ( mazeAgentHistory . size ( ) == agentHistorySize ) mazeAgentHistory . pollFirst ( ) ; mazeAgentHistory . addLast ( mazeAgentCurrent ) ; maze [ x ] [ y ] . updateCellTimeStep ( ++ timeStep ) ; maze [ x ] [ y ] . incrementCount ( ) ; updateState ( ) ; setReward ( agent ) ; }
Takes specific action.
Takes specific action .