How to Use Stack, Queue, and Random Modules for Data
Choose the Right Storage Module
Stack Module stores values in last-in, first-out order. Queue Module stores values in first-in, first-out order. Random Module produces random values on demand. Insert any of these into a Controller or Casing so an Execution Module can reach them through a port.
Move Data Between Modules
Write a value to a Stack Module from one Execution Module, then read it from another. Because a stack returns the most recently written value first, use it when order should reverse. Use a Queue Module when order must be preserved: the first value written is the first value read. Address each module by its port position in the Controller or Casing.
Generate Values
Insert a Random Module and read from it in your program to get unpredictable numbers. This is useful for dice, shuffles, or randomized output on a Display Module. Combine a Random Module with a Stack Module to build a shuffled deck, or with a Queue Module to feed a steady stream of values.
Practical Patterns
A common setup is one Execution Module writing into a Queue Module while a second Execution Module reads from it and drives a Display Module. Swap the Queue Module for a Stack Module to reverse the output order without changing the rest of the program.