array-forth- A simple interpreter for arrayForth, the language used on GreenArrays chips.

Safe HaskellNone



This module defines a type representing the location of a core in the 8 × 18 grid.

All of the actually interesting code is in the typeclass instances.



data Core Source

The address of a core. There are 144 cores in an 8 × 18 array. The address has the row number followed by the column number.

As a string, the core addresses are displayed as a single three-digit number, just like in the GreenArray documentation. So Core 7 17 becomes "717".

Core addresses behave like numbers: you can use numeric literals and add them together. For example, [0..] :: [Core] gets you the list of all the core addresses. (move core = core + Core 1 1) is a function that moves you up and over by one core.


Core !( / 8) !( / 18) 

neighbors :: Core -> [Maybe Core] Source

Returns all the neighbors of a core. Most cores have four neighbors; the ones along the edges only have three and the ones at the corners two.

They always come in the order right, down, left up, with Nothing in place of non-existant cores.