Class

GridFactory

GridFactory()

The Taxi Game class

Methods

# create(size, rng, startingPos) → {Grid}

Create a new grid.

Parameters:
Name Type Description
size number

The size of the grid.

rng seedrandom.PRNG

The random number generator.

startingPos Vec2

The starting position.

View Source core/src/Games/GridWorld/Grid/GridFactory.ts, line 158

a new grid.

Grid

# generateGoalPosition(grid, rng) → {void}

Generate the goal position

Parameters:
Name Type Description
grid Array.<Array.<GridField>>

The grid.

rng seedrandom.PRNG

The random number generator.

View Source core/src/Games/GridWorld/Grid/GridFactory.ts, line 97

void

# generateGrid(size, rng) → {Array.<Array.<GridField>>}

Generates the grid.

Parameters:
Name Type Description
size number

The size.

rng seedrandom.PRNG

The random number generator.

View Source core/src/Games/GridWorld/Grid/GridFactory.ts, line 39

A filled 2D GridField Array.

Array.<Array.<GridField>>

# getNewField(rng, vec) → {GridField}

Generate a random grid field.

Parameters:
Name Type Description
rng seedrandom.PRNG

The random number generator.

vec Vec2

the position of the field

View Source core/src/Games/GridWorld/Grid/GridFactory.ts, line 56

a new random field.

GridField

# goalIsReachable(grid, startingPos) → {boolean}

Apply Breadth-first-search algorithm to find out whether the goal is reachable

Parameters:
Name Type Description
grid Array.<Array.<GridField>>

The grid.

startingPos Vec2

The starting position.

View Source core/src/Games/GridWorld/Grid/GridFactory.ts, line 119

Whether the goal is reachable.

boolean