Liking cljdoc? Tell your friends :D

hive-olympus.layout

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.
raw docstring

assign-positionsclj

(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.
sourceraw docstring

calculate-layoutclj

(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.
sourceraw docstring

cell-positionsclj

(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.
sourceraw docstring

grid-capacityclj

(grid-capacity layout)

Maximum agents LAYOUT holds.

Maximum agents LAYOUT holds.
sourceraw docstring

per-tabclj

Agents per tab once the layout overflows a single 2x2.

Agents per tab once the layout overflows a single 2x2.
sourceraw docstring

placeclj

(place agents)

AGENTS on their own canonical layout: id -> Position.

AGENTS on their own canonical layout: id -> Position.
sourceraw docstring

position-for-cellclj

(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.
sourceraw docstring

tab-countclj

(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.
sourceraw docstring

tabbed?clj

(tabbed? layout)

True when LAYOUT spreads agents across tabs.

True when LAYOUT spreads agents across tabs.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close