Skip to content

Encoding a board

gg314 edited this page Mar 20, 2020 · 3 revisions

A board is a 16x16 array of spaces that can be occupied by robots and goals. Each cell can have up to four walls. The four central cells are always inaccessible.

To store the boundary (wall) information around each space, a 33x33 array may be stored, where a 1 indicates a wall exists and a 0 indicates there is no wall.

For visually encoding this information, each entry in boundaryBoard is encoded by whether its corresponding space has a wall to the left, top, right, bottom, or some diagonal. By convention, we compute an 8bit value by summing bitwise:

value = 1*TOP || 2*RIGHT || 4*BOTTOM || 8*LEFT || 16*TOPRIGHT || 32*BOTTOMRIGHT || 64*BOTTOMLEFT || 128*TOPLEFT

This approach leads to duplicate images for different information. For example, encoding a wall along the TOP looks the same as encoding a wall along the TOPLEFT, TOP, and TOPRIGHT. We render the same image for multiple underlying encodings.

Clone this wiki locally