Rectangular Board¶
Usage¶
New Board¶
import {newBoard} from 'mazes101/boards/rectangular';
let board = newBoard({height: 20, width: 20});
newBoard method takes only one argument:
size: size of the board
Anatomy¶
In the figure above we have a rectangular board with:
- size parameters
{width: 10, height: 10}, - a highlighted cell at position
{x: 8, y:1} - the highlighted cell has value
0000 0111which means its enabled (hence 0 at 1st bit) and has 3 walls removed top, right, bottom (hence 1 at 6, 7 and 8th bits).
Size Parameters¶
A rectangular board has two size parameters:
width: width of board as number of cellsheight: height of board as number of cells
Position¶
Position of each cell is represented by cartesian coordinates (X and Y values).
Directions¶
Each cell in a rectangular board utilizes 4 directions as following:
- Top (mask:
0b0001or1) - Right (mask:
0b0010or2) - Bottom (mask:
0b0100or4) - Left (mask:
0b1000or8)