compound context sp fn: learn-grid


learn-grid:
    description:
        learn-grid[width, height]
        learn-grid[width, height, operator]
        learn a grid of specified width and height
        all cells initialized to zero, with respect to operator "operator"
        if operator is not specified, use "value"
        and we learn all direction operators, N, NE, E, SE, S, SW, W, NW, that don't point outside the grid

    examples:
        -- learn a sample grid:
        learn-grid[2,2]
        dump
        ------------------------------------------
        |context> => |Global context>

        value |grid: 0: 0> => |0>
        E |grid: 0: 0> => |grid: 0: 1>
        SE |grid: 0: 0> => |grid: 1: 1>
        S |grid: 0: 0> => |grid: 1: 0>

        value |grid: 0: 1> => |0>
        S |grid: 0: 1> => |grid: 1: 1>
        SW |grid: 0: 1> => |grid: 1: 0>
        W |grid: 0: 1> => |grid: 0: 0>

        value |grid: 1: 0> => |0>
        N |grid: 1: 0> => |grid: 0: 0>
        NE |grid: 1: 0> => |grid: 0: 1>
        E |grid: 1: 0> => |grid: 1: 1>

        value |grid: 1: 1> => |0>
        N |grid: 1: 1> => |grid: 0: 1>
        W |grid: 1: 1> => |grid: 1: 0>
        NW |grid: 1: 1> => |grid: 0: 0>
        ------------------------------------------

    see also:
        display-grid
Home