> ## Documentation Index
> Fetch the complete documentation index at: https://aegean.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Dynamic programming on a gridworld (interactive)

> How the reward function shapes the values and the optimal policy of a gridworld.

<DPGridworld />

*Values and current policy on the 4x3 gridworld. The readout shows the number of sweeps run so far and the largest change in the last one.*

The gridworld above lets you change the reward function and see how the values and the optimal policy change with it. It is the 4x3 gridworld of [Introduction to MDP](https://aegean.ai/aiml-common/lectures/mdp/mdp-intro/index.md), and it runs the dynamic programming algorithms of this chapter in your browser. Each move earns the reward of the cell it enters: $+1$ for the exit $s_{43}$, $-1$ for the exit $s_{42}$, and $-0.04$ for every other cell. Entering an exit ends the episode. The intended move happens with probability 0.8, and with probability 0.1 each the agent moves at a right angle to it. A move into the wall or off the grid leaves the agent where it is. The discount factor starts at $\gamma = 1$.

The agent starts with the uniform random policy, drawn as four short arrows in every cell. The cell colors show the current value estimate $v(s)$: green for positive and orange for negative values.

* **Policy evaluation (one sweep)** applies the Bellman expectation backup once to every cell, under the current policy. Press it repeatedly to watch the values of the random policy settle.
* **Policy update** makes the policy greedy with respect to the current values. Arrows of tied actions share the probability. Alternating evaluation sweeps with updates is policy iteration.
* **Value iteration** runs the Bellman optimality backup, one sweep at a time, and keeps the policy greedy after every sweep. It stops on its own when no value changes by more than $10^{-4}$.
* The **step reward** slider sets the reward of entering every ordinary cell, from $-2$ to $+1$. The **discount factor** slider sets $\gamma$. Click a cell to select it, then change its own reward or turn it into a wall. Every change of a reward, a wall or $\gamma$ clears the values and restores the random policy.

## How the rewards shape the policy

Each subsection below shows the widget after value iteration has converged for one setting of the rewards and $\gamma$. The sliders at the bottom of each picture show the setting, so you can reproduce it: press **Reset**, set the sliders, and press **Value iteration**. Unless a subsection says otherwise, $\gamma = 1$ and the only change is the step reward.

### Step reward −0.01

When steps are cheap, the agent avoids every risk. In $s_{32}$ it moves west into the wall, so no slip can take it into the $-1$ exit, and in $s_{41}$ it moves south into the edge of the grid for the same reason. The values are close to $+1$ everywhere, because the long safe route costs little.

<img src="https://mintcdn.com/aegeanaiinc/ZYNwCUJVJkvLdMMz/book/mdp/images/dp-gridworld-step-minus-0.01.png?fit=max&auto=format&n=ZYNwCUJVJkvLdMMz&q=85&s=0a640b2e115035090dee5f4f9476d487" alt="Gridworld after value iteration with step reward minus 0.01. All values are between 0.81 and 0.99. The arrows in s32 and s41 point into the wall and the grid edge, away from the minus 1 exit." width="1184" height="1472" data-path="book/mdp/images/dp-gridworld-step-minus-0.01.png" />

*Step reward −0.01: the agent takes no risk near the −1 exit.*

### Step reward −0.2

Each step now costs enough that the short route past the $-1$ exit pays. From $s_{21}$ the agent heads east and from $s_{31}$ north, instead of going around the wall through $s_{11}$, $s_{12}$ and $s_{13}$.

<img src="https://mintcdn.com/aegeanaiinc/ZYNwCUJVJkvLdMMz/book/mdp/images/dp-gridworld-step-minus-0.2.png?fit=max&auto=format&n=ZYNwCUJVJkvLdMMz&q=85&s=f50122c826fbf30de63e55d28d92f846" alt="Gridworld after value iteration with step reward minus 0.2. The arrow in s21 points east and the arrow in s31 points north, toward the minus 1 exit side of the grid." width="1184" height="1472" data-path="book/mdp/images/dp-gridworld-step-minus-0.2.png" />

*Step reward −0.2: the agent takes the short route past the −1 exit.*

### Step reward −2

Every step costs more than the $-1$ exit, so ending the episode early is best. From $s_{32}$ the agent walks straight into the $-1$ exit, and from the bottom row it heads for the nearest exit.

<img src="https://mintcdn.com/aegeanaiinc/ZYNwCUJVJkvLdMMz/book/mdp/images/dp-gridworld-step-minus-2.png?fit=max&auto=format&n=ZYNwCUJVJkvLdMMz&q=85&s=1433af14f315e53e7e073caaead10574" alt="Gridworld after value iteration with step reward minus 2. Most values are strongly negative. The arrow in s32 points east into the minus 1 exit." width="1184" height="1472" data-path="book/mdp/images/dp-gridworld-step-minus-2.png" />

*Step reward −2: the agent prefers the −1 exit to more steps.*

### Step reward +0.2 with γ = 1

A positive step reward pays the agent for staying on the grid. Every cell has a move that can never slip into an exit, such as west from $s_{32}$ into the wall, so the agent can collect $+0.2$ forever. The values grow by $0.2$ in every sweep and never converge, and the widget stops after its limit of 3000 sweeps.

<img src="https://mintcdn.com/aegeanaiinc/ZYNwCUJVJkvLdMMz/book/mdp/images/dp-gridworld-step-plus-0.2-gamma-1.png?fit=max&auto=format&n=ZYNwCUJVJkvLdMMz&q=85&s=faa9641bd6cddef74ea161c19f7915c0" alt="Gridworld after 3000 sweeps of value iteration with step reward plus 0.2 and gamma 1. Every value is about 600, and a message says the values did not converge." width="1184" height="1578" data-path="book/mdp/images/dp-gridworld-step-plus-0.2-gamma-1.png" />

*Step reward +0.2 with γ = 1: the values grow without bound.*

### Step reward +0.2 with γ = 0.9

With $\gamma = 0.9$ the same reward has a finite value. Staying forever is worth $0.2 / (1 - 0.9) = 2$, more than the $+1$ of the exit, so every value converges to $2$ and the agent never leaves. It moves away from the exits in $s_{33}$, $s_{32}$ and $s_{41}$. In most other cells all four moves tie, because walking around the wall at $s_{22}$ and bumping into it earn the same reward.

<img src="https://mintcdn.com/aegeanaiinc/ZYNwCUJVJkvLdMMz/book/mdp/images/dp-gridworld-step-plus-0.2-gamma-0.9.png?fit=max&auto=format&n=ZYNwCUJVJkvLdMMz&q=85&s=fdd3f6b701af2fb1c893b42a7f1bb228" alt="Gridworld after value iteration with step reward plus 0.2 and gamma 0.9. Every value is 2.0. Arrows in s33, s32 and s41 point away from the exits, and most other cells show four tied arrows." width="1184" height="1472" data-path="book/mdp/images/dp-gridworld-step-plus-0.2-gamma-0.9.png" />

*Step reward +0.2 with γ = 0.9: the agent stays on the grid forever.*

### Step reward +0.04 with γ = 0.9

A smaller positive reward is not worth giving up the exit. Staying forever is worth only $0.04 / (1 - 0.9) = 0.4$, and the policy in most cells leads to the $+1$ exit again.

<img src="https://mintcdn.com/aegeanaiinc/ZYNwCUJVJkvLdMMz/book/mdp/images/dp-gridworld-step-plus-0.04-gamma-0.9.png?fit=max&auto=format&n=ZYNwCUJVJkvLdMMz&q=85&s=e4d7bed57f8549d753cd83796e3a1a33" alt="Gridworld after value iteration with step reward plus 0.04 and gamma 0.9. Values are between 0.52 and 0.96, and the arrows lead toward the plus 1 exit." width="1184" height="1472" data-path="book/mdp/images/dp-gridworld-step-plus-0.04-gamma-0.9.png" />

*Step reward +0.04 with γ = 0.9: the +1 exit is worth more than staying.*

### Reward +0.04 in s12 with γ = 0.9

A positive reward in one cell can pull the agent toward that cell, but only if the agent can stay there. Click $s_{12}$ and set its reward to $+0.04$, while every other ordinary cell keeps the step reward of $-0.04$. The agent can stay in $s_{12}$ only by moving east into the wall or west off the grid, and each such move slips north or south with probability $0.2$. Because it cannot stay long, $v(s_{12}) = 0.517$ remains below $v(s_{23}) = 0.766$ on the way to the exit. The agent in $s_{12}$ moves north, and from $s_{13}$ it heads east for the $+1$ exit.

<img src="https://mintcdn.com/aegeanaiinc/ZYNwCUJVJkvLdMMz/book/mdp/images/dp-gridworld-s12-plus-0.04-gamma-0.9.png?fit=max&auto=format&n=ZYNwCUJVJkvLdMMz&q=85&s=851af59fcec8295d2cde3599be6ad5d8" alt="Gridworld after value iteration with reward plus 0.04 in s12 and gamma 0.9. The arrow in s13 points east toward the plus 1 exit." width="1184" height="1472" data-path="book/mdp/images/dp-gridworld-s12-plus-0.04-gamma-0.9.png" />

*Reward +0.04 in s12 with γ = 0.9: the agent still heads for the +1 exit.*

### Reward +0.2 in s12 with γ = 0.9

At $+0.2$ the reward of $s_{12}$ is worth the slips. From $s_{13}$ the agent moves down into $s_{12}$, and from $s_{23}$ and $s_{33}$ it moves west, away from the $+1$ exit. In $s_{12}$ the two-headed arrow shows the tie between moving east into the wall and west off the grid: both keep the agent in place with probability $0.8$.

<img src="https://mintcdn.com/aegeanaiinc/ZYNwCUJVJkvLdMMz/book/mdp/images/dp-gridworld-s12-plus-0.2-gamma-0.9.png?fit=max&auto=format&n=ZYNwCUJVJkvLdMMz&q=85&s=3b4c529cc9b24035501e3766c3c0df08" alt="Gridworld after value iteration with reward plus 0.2 in s12 and gamma 0.9. The arrow in s13 points down into s12, the arrows in s23 and s33 point west, and s12 shows a two-headed east-west arrow." width="1184" height="1472" data-path="book/mdp/images/dp-gridworld-s12-plus-0.2-gamma-0.9.png" />

*Reward +0.2 in s12 with γ = 0.9: the whole top row flows to s12.*

### Reward +0.04 in s12 with γ = 0.97

Raising $\gamma$ has the same effect as raising the reward. Near $s_{12}$ the agent earns $+0.04$ on most steps and $-0.04$ on the steps it slips out, about $+0.02$ per step on average, which is worth roughly $0.02 / (1 - \gamma)$. At $\gamma = 0.97$ this is enough for the agent in $s_{13}$ to turn down into $s_{12}$, while $s_{23}$ and $s_{33}$ still head for the exit.

<img src="https://mintcdn.com/aegeanaiinc/ZYNwCUJVJkvLdMMz/book/mdp/images/dp-gridworld-s12-plus-0.04-gamma-0.97.png?fit=max&auto=format&n=ZYNwCUJVJkvLdMMz&q=85&s=20308d05095686b4c5abc9eec20483c3" alt="Gridworld after value iteration with reward plus 0.04 in s12 and gamma 0.97. The arrow in s13 points down into s12, while s23 and s33 point east toward the plus 1 exit." width="1184" height="1472" data-path="book/mdp/images/dp-gridworld-s12-plus-0.04-gamma-0.97.png" />

*Reward +0.04 in s12 with γ = 0.97: only s13 turns toward s12.*

### Reward +0.04 in s12 with γ = 0.99

At $\gamma = 0.99$ staying near $s_{12}$ is worth about $2$, twice the $+1$ exit. Every cell now leads to $s_{12}$, and even $s_{33}$, next to the $+1$ exit, moves west.

<img src="https://mintcdn.com/aegeanaiinc/ZYNwCUJVJkvLdMMz/book/mdp/images/dp-gridworld-s12-plus-0.04-gamma-0.99.png?fit=max&auto=format&n=ZYNwCUJVJkvLdMMz&q=85&s=ba635bbf6259c86066f06c99cae2b9bd" alt="Gridworld after value iteration with reward plus 0.04 in s12 and gamma 0.99. All values are between 1.6 and 2.2, and every arrow leads toward s12, including west in s33." width="1184" height="1472" data-path="book/mdp/images/dp-gridworld-s12-plus-0.04-gamma-0.99.png" />

*Reward +0.04 in s12 with γ = 0.99: every cell leads to s12.*

The demo is modeled on Andrej Karpathy's [ReinforceJS gridworld](https://cs.stanford.edu/people/karpathy/reinforcejs/gridworld_dp.html).

// initial discount factor
// sweeps in the current value iteration run
// Moves N, E, S, W as (dx, dy) with y up. The right angles of move a are (a + 1) % 4 and (a + 3) % 4.
// slow at first, then fast
// A change of the rewards or walls restarts from v = 0 and the random policy. With gamma = 1 the
// optimality equation can have several solutions, and old values can sit on the wrong one.
export const DPGridworld = () => {
  const COLS = 4;
  const ROWS = 3;
  const GAMMA = 1;
  const STEP = -0.04;
  const MAX_SWEEPS = 3000;
  const idx = (x, y) => (y - 1) * COLS + (x - 1);
  const xy = s => [s % COLS + 1, Math.floor(s / COLS) + 1];
  const EXITS = [idx(4, 3), idx(4, 2)];
  const isExit = s => EXITS.includes(s);
  const initWalls = () => {
    const w = new Array(COLS * ROWS).fill(false);
    w[idx(2, 2)] = true;
    return w;
  };
  const initRewards = () => {
    const R = new Array(COLS * ROWS).fill(STEP);
    R[idx(4, 3)] = 1;
    R[idx(4, 2)] = -1;
    return R;
  };
  const uniform = () => Array.from({
    length: COLS * ROWS
  }, () => [0.25, 0.25, 0.25, 0.25]);
  const [walls, setWalls] = useState(initWalls);
  const [rewards, setRewards] = useState(initRewards);
  const [step, setStep] = useState(STEP);
  const [gamma, setGammaState] = useState(GAMMA);
  const [V, setV] = useState(() => new Array(COLS * ROWS).fill(0));
  const [policy, setPolicy] = useState(uniform);
  const [sweeps, setSweeps] = useState(0);
  const [delta, setDelta] = useState(null);
  const [running, setRunning] = useState(false);
  const [runSweeps, setRunSweeps] = useState(0);
  const [diverged, setDiverged] = useState(false);
  const [selected, setSelected] = useState(idx(1, 1));
  const box = useRef(null);
  const [W, setW] = useState(480);
  useEffect(() => {
    if (!box.current || typeof ResizeObserver === "undefined") return undefined;
    const ro = new ResizeObserver(entries => setW(Math.max(260, Math.min(560, Math.round(entries[0].contentRect.width)))));
    ro.observe(box.current);
    return () => ro.disconnect();
  }, []);
  const MOVES = [[0, 1], [1, 0], [0, -1], [-1, 0]];
  const moveTo = (s, d) => {
    const [x, y] = xy(s);
    const nx = x + MOVES[d][0], ny = y + MOVES[d][1];
    if (nx < 1 || nx > COLS || ny < 1 || ny > ROWS) return s;
    const t = idx(nx, ny);
    return walls[t] ? s : t;
  };
  const active = s => !walls[s] && !isExit(s);
  const qValues = (vals, s) => [0, 1, 2, 3].map(a => [[a, 0.8], [(a + 1) % 4, 0.1], [(a + 3) % 4, 0.1]].reduce((acc, [d, p]) => {
    const t = moveTo(s, d);
    return acc + p * (rewards[t] + (isExit(t) ? 0 : gamma * vals[t]));
  }, 0));
  const greedy = vals => vals.map((_, s) => {
    if (!active(s)) return [0, 0, 0, 0];
    const q = qValues(vals, s);
    const best = Math.max(...q);
    const ties = q.map(x => best - x < 1e-9 ? 1 : 0);
    const n = ties.reduce((p, x) => p + x, 0);
    return ties.map(x => x / n);
  });
  const sweep = backup => {
    const next = V.map((_, s) => active(s) ? backup(qValues(V, s), s) : 0);
    const d = Math.max(...next.map((x, s) => Math.abs(x - V[s])));
    setV(next);
    setSweeps(k => k + 1);
    setDelta(d);
    return {
      next,
      d
    };
  };
  const evaluate = () => sweep((q, s) => q.reduce((acc, x, a) => acc + policy[s][a] * x, 0));
  const update = () => setPolicy(greedy(V));
  const iterate = () => {
    const {next, d} = sweep(q => Math.max(...q));
    setPolicy(greedy(next));
    setRunSweeps(k => k + 1);
    if (d < 1e-4) setRunning(false); else if (runSweeps + 1 >= MAX_SWEEPS) {
      setRunning(false);
      setDiverged(true);
    }
  };
  useEffect(() => {
    if (!running) return undefined;
    const id = setTimeout(iterate, runSweeps < 30 ? 120 : 5);
    return () => clearTimeout(id);
  });
  const clearValues = () => {
    setV(new Array(COLS * ROWS).fill(0));
    setPolicy(uniform());
    setSweeps(0);
    setDelta(null);
    setDiverged(false);
  };
  const reset = () => {
    setRunning(false);
    setWalls(initWalls());
    setRewards(initRewards());
    setStep(STEP);
    setGammaState(GAMMA);
    clearValues();
    setSelected(idx(1, 1));
  };
  const restart = () => {
    setRunning(false);
    clearValues();
  };
  const setReward = x => {
    setRewards(R => R.map((y, s) => s === selected ? x : y));
    restart();
  };
  const setStepReward = x => {
    setStep(x);
    setRewards(R => R.map((y, s) => isExit(s) ? y : x));
    restart();
  };
  const setGamma = x => {
    setGammaState(x);
    restart();
  };
  const toggleWall = () => {
    if (isExit(selected)) return;
    setWalls(w => w.map((y, s) => s === selected ? !y : y));
    restart();
  };
  const cell = W / COLS;
  const H = cell * ROWS;
  const vmax = Math.max(1e-6, ...V.map(x => Math.abs(x)));
  const fill = s => {
    if (walls[s]) return "rgba(128,128,128,0.55)";
    if (isExit(s)) return rewards[s] >= 0 ? "rgba(0,158,115,0.35)" : "rgba(213,94,0,0.35)";
    const a = Math.min(1, Math.abs(V[s]) / vmax) * 0.55;
    return V[s] >= 0 ? "rgba(0,158,115," + a + ")" : "rgba(213,94,0," + a + ")";
  };
  const fmt = (x, digits = 3) => Math.abs(x) < 0.5 * 10 ** -digits ? (0).toFixed(digits) : (x < 0 ? "−" : "+") + Math.abs(x).toFixed(digits);
  const label = s => "s" + xy(s)[0] + xy(s)[1];
  const border = "1px solid rgba(127,127,127,.3)";
  const button = (text, onClick, pressed) => <button type="button" onClick={onClick} aria-pressed={pressed} style={{
    border,
    borderRadius: 8,
    padding: "6px 10px",
    background: pressed ? "rgba(0,114,178,0.18)" : "transparent",
    color: "inherit",
    cursor: "pointer",
    fontSize: 13
  }}>{text}</button>;
  const [sx, sy] = xy(selected);
  return <div className="not-prose" role="group" aria-label="Interactive figure: policy evaluation, policy iteration and value iteration on the 4x3 gridworld" style={{
    border,
    borderRadius: 12,
    padding: 12,
    display: "grid",
    gap: 10,
    fontSize: 14,
    maxWidth: "100%",
    boxSizing: "border-box"
  }}>
      <div style={{
    display: "flex",
    flexWrap: "wrap",
    gap: 8
  }}>
        {button("Policy evaluation (one sweep)", () => {
    setRunning(false);
    evaluate();
  }, false)}
        {button("Policy update", () => {
    setRunning(false);
    update();
  }, false)}
        {button(running ? "Stop value iteration" : "Value iteration", () => {
    setDiverged(false);
    setRunSweeps(0);
    setRunning(x => !x);
  }, running)}
        {button("Clear values", () => {
    setRunning(false);
    clearValues();
  }, false)}
        {button("Reset", reset, false)}
      </div>
      <div style={{
    fontVariantNumeric: "tabular-nums"
  }}>
        Sweeps: <strong>{sweeps}</strong>{delta === null ? null : <span>, largest change in the last sweep: <strong>{delta.toExponential(1)}</strong></span>}
        {diverged ? <div style={{
    marginTop: 4
  }}>The values did not converge in {MAX_SWEEPS} sweeps. With γ = 1, a positive reward that the agent can collect again and again makes the values grow without bound.</div> : null}
      </div>
      <div ref={box} style={{
    width: "100%",
    minWidth: 0
  }}>
        <svg viewBox={"0 0 " + W + " " + H} width={W} height={H} role="img" aria-label={"4x3 gridworld after " + sweeps + " sweeps. The selected state " + label(selected) + " has value " + fmt(V[selected]) + "."} style={{
    display: "block",
    maxWidth: "100%",
    height: "auto",
    fill: "currentColor"
  }}>
          <defs>
            <marker id="dpg-head" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="5" markerHeight="5" orient="auto-start-reverse">
              <path d="M0,0 L10,5 L0,10 z" fill="currentColor" />
            </marker>
          </defs>
          {V.map((v, s) => {
    const [x, y] = xy(s);
    const px = (x - 1) * cell, py = (ROWS - y) * cell;
    const cx = px + cell / 2, cy = py + cell / 2 + cell * 0.08;
    return <g key={s} onClick={() => setSelected(s)} style={{
      cursor: "pointer"
    }}>
                <rect x={px} y={py} width={cell} height={cell} fill={fill(s)} stroke="currentColor" strokeOpacity={0.25} />
                {!walls[s] ? <text x={px + 5} y={py + 14} fontSize={11} fillOpacity={0.7}>{label(s)}</text> : null}
                {isExit(s) ? <text x={px + cell / 2} y={py + cell / 2 + 6} fontSize={18} textAnchor="middle" fillOpacity={0.85}>{fmt(rewards[s], 2)}</text> : null}
                {active(s) ? <text x={px + cell - 5} y={py + 14} fontSize={11} textAnchor="end" fillOpacity={0.9}>{fmt(v)}</text> : null}
                {active(s) ? policy[s].map((p, a) => p > 0 ? <line key={a} x1={cx} y1={cy} x2={cx + MOVES[a][0] * p * cell * 0.3} y2={cy - MOVES[a][1] * p * cell * 0.3} stroke="currentColor" strokeOpacity={0.75} strokeWidth={1.6} markerEnd="url(#dpg-head)" /> : null) : null}
                {active(s) && Math.abs(rewards[s] - step) > 1e-9 ? <text x={px + 5} y={py + cell - 6} fontSize={10} fillOpacity={0.8}>{"r = " + fmt(rewards[s], 2)}</text> : null}
              </g>;
  })}
          <rect x={(sx - 1) * cell + 1} y={(ROWS - sy) * cell + 1} width={cell - 2} height={cell - 2} fill="none" stroke="#0072B2" strokeWidth={3} pointerEvents="none" />
        </svg>
      </div>
      <label style={{
    display: "grid",
    gap: 4
  }}>
        <span>Step reward, for entering every ordinary cell <span style={{
    fontVariantNumeric: "tabular-nums",
    fontWeight: 600
  }}>{fmt(step, 2)}</span></span>
        <input type="range" min={-2} max={1} step={0.01} value={step} aria-label="Step reward" onChange={e => setStepReward(Number(e.target.value))} style={{
    width: "100%"
  }} />
      </label>
      <label style={{
    display: "grid",
    gap: 4
  }}>
        <span>Discount factor γ <span style={{
    fontVariantNumeric: "tabular-nums",
    fontWeight: 600
  }}>{gamma.toFixed(2)}</span></span>
        <input type="range" min={0} max={1} step={0.01} value={gamma} aria-label="Discount factor" onChange={e => setGamma(Number(e.target.value))} style={{
    width: "100%"
  }} />
      </label>
      <div style={{
    display: "grid",
    gridTemplateColumns: "minmax(0, 1fr) auto",
    gap: 12,
    alignItems: "end"
  }}>
        <label style={{
    display: "grid",
    gap: 4
  }}>
          <span>Reward for entering the selected state {label(selected)} <span style={{
    fontVariantNumeric: "tabular-nums",
    fontWeight: 600
  }}>{fmt(rewards[selected], 2)}</span></span>
          <input type="range" min={-2} max={1} step={0.01} value={rewards[selected]} disabled={walls[selected]} aria-label="Reward of the selected state" onChange={e => setReward(Number(e.target.value))} style={{
    width: "100%"
  }} />
        </label>
        {isExit(selected) ? <span style={{
    fontSize: 12,
    opacity: 0.7
  }}>An exit cannot be a wall</span> : button(walls[selected] ? "Remove wall" : "Make wall", toggleWall, false)}
      </div>
    </div>;
};


***

<Callout icon="bug" iconType="regular">
  Found an error on this page? [Report an issue](https://github.com/aegean-ai/eaia-feedback/issues/new?template=page-issue.yml\&page=/book/mdp/dp-gridworld-demo).
</Callout>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.