The canonical Olympus grid, pure.
n = 0 {:rows 0 :cols 0} n = 1 {:rows 1 :cols 1} n = 2 {:rows 1 :cols 2} n = 3 {:rows 2 :cols 2 :empty-cells #{[1 1]}} n = 4 {:rows 2 :cols 2} n >= 5 {:tabs (ceil n/4) :per-tab 4}, each tab a 2x2 filled row-major
cell-positions is the single placement rule; assign-positions and the
grid model both read it.
The canonical Olympus grid, pure.
n = 0 {:rows 0 :cols 0}
n = 1 {:rows 1 :cols 1}
n = 2 {:rows 1 :cols 2}
n = 3 {:rows 2 :cols 2 :empty-cells #{[1 1]}}
n = 4 {:rows 2 :cols 2}
n >= 5 {:tabs (ceil n/4) :per-tab 4}, each tab a 2x2 filled row-major
`cell-positions` is the single placement rule; `assign-positions` and the
grid model both read it.(assign-positions agents layout)Map of agent id -> Position for AGENTS placed on LAYOUT in order.
Map of agent id -> Position for AGENTS placed on LAYOUT in order.
(calculate-layout n)Layout for N agents. nil or negative N is the empty layout.
Layout for N agents. nil or negative N is the empty layout.
(cell-positions layout n)The first N positions of LAYOUT in placement order, as Position maps.
Grid layouts fill row-major skipping :empty-cells; tabbed layouts fill a
2x2 per tab. Yields at most grid-capacity positions.
The first N positions of LAYOUT in placement order, as Position maps. Grid layouts fill row-major skipping :empty-cells; tabbed layouts fill a 2x2 per tab. Yields at most `grid-capacity` positions.
(grid-capacity layout)Maximum agents LAYOUT holds.
Maximum agents LAYOUT holds.
Agents per tab once the layout overflows a single 2x2.
Agents per tab once the layout overflows a single 2x2.
(place agents)AGENTS on their own canonical layout: id -> Position.
AGENTS on their own canonical layout: id -> Position.
(position-for-cell positions row col tab)The agent id at ROW/COL/TAB in POSITIONS, or nil. TAB nil addresses a non-tabbed layout and never matches a tabbed position.
The agent id at ROW/COL/TAB in POSITIONS, or nil. TAB nil addresses a non-tabbed layout and never matches a tabbed position.
(tab-count layout)Number of tabs LAYOUT shows; a grid layout (even the empty one) is one tab.
Number of tabs LAYOUT shows; a grid layout (even the empty one) is one tab.
(tabbed? layout)True when LAYOUT spreads agents across tabs.
True when LAYOUT spreads agents across tabs.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |