Skip to content

Write

write puts a value into memory — a cell or a bank — at an address. It is the other side of read, with the same fields, only the first one now means “what to write” instead of “where to put what was read”.

Memory is for where variables fall short:

  • surviving an edit to the program. Variables are cleared when the program changes; memory is not;
  • sharing with a neighbour. Two processors cannot see each other’s variables, but a cell is visible to both;
  • holding a list. A variable keeps one value, a cell 64, a memory bank 512.
  1. Writing to a cellOne line, three fields — and the value survives the iteration, the edit and the processor itself
  2. An object in a cellA cell stopped being an array of numbers. You put an item, a store or a unit in — and get the same thing out
  3. Shared memoryA neighbour's variables are visible to nobody. A cell is visible to everyone linked to it — and that is what division of labour is built on
  4. A neighbour's variablesA cell for exchanging values isn't always needed — but the shortcut is paid for with a variable that changes with no trace in the program

«The memory cell» — addresses, bounds and how emptiness differs from zero. The lessons will tell you the rest themselves.

Unofficial fan project, not affiliated with Anuke. Mindustry sprites, fonts and translations © Anuke, used under GPL-3.0; Fira Code under OFL-1.1. Site code is GPL-3.0.