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

Safe HaskellNone
LanguageHaskell98

Language.ArrayForth.Core

Description

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.

Synopsis

Documentation

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.

Constructors

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.