A chute brings things from A to B. It gets interesting when it decides on the way: iron ore to one furnace, copper ore to the other, seeds to storage, spoiled food to the composter. That is what sorters, stackers and digital chute parts are for. The basics of chutes are in Chutes and logistics: basics, inputs and outputs.
The devices at a glance
| Device | Power | Modes | Control |
|---|---|---|---|
| Sorter | 50 W | Split, Filter, Logic | Output 0 or 1 |
| Logic Sorter | 5 W | All, Any, None | rules in its own memory |
| Stacker | 50 W | Automatic, Logic | Setting, Activate, Output |
| Unloader | 50 W | Automatic, Logic | Output |
| Loader (loader) | 50 W | Auto, Logic | Open, Dispense |
| Chute Digital Valve Left | 10 W | – | Open |
| Chute Digital Flip Flop Splitter Left | 10 W | Mode0, Mode1 | Setting, SettingOutput |
All of them have a shared power and data port. Sorter and logic sorter are built from the Kit (Sorter) (10 iron, 1 gold, 5 copper); stacker, unloader and loader from the Kit (Stacker) (10 iron, 2 copper) – the loader takes two of them.
The sorter
The sorter has one input and two outputs. What happens to an item is decided by Mode:
- 0
Splitsends the items alternately to export and export 2. - 1
Filtersorts by a filter list: matches go to export 2, everything else to export. The game has the Sorter Motherboard for it (5 gold, 5 silver from the electronics printer). - 2
Logicleaves the decision to a chip. It reads the waiting item from slot 0 and writesOutput: 0 means export, 1 means export 2.
Logic mode is the most flexible: any rule you can express in IC10 becomes a sorting rule. After every item the sorter sets Output back to −1 itself and waits for the next decision. Careful when switching: if Mode changes to Split or Logic, the filter list is deleted.
A chip sorts ore
The following program sends iron and copper ore to Output 0 and everything else to Output 1. Name the sorter "Ore Sorter" with the labeller.
# Sorter: iron and copper ore to 0, everything else to 1
define SORTER -1009150565 # Sorter (StructureSorter)
define NSORTER HASH("Ore Sorter") # name of the sorter
define IRONORE 1758427767 # Ore (Iron) (ItemIronOre)
define COPPERORE -707307845 # Ore (Copper) (ItemCopperOre)
define MODELOGIC 2 # Mode 2 = Logic
alias occupied r0
alias item r1
alias iron r2
alias copper r3
alias target r4
start:
yield
sbn SORTER NSORTER Mode MODELOGIC
lbns occupied SORTER NSORTER 0 Occupied 0
bnan occupied start # no sorter with this name
beqz occupied start # slot empty: decide nothing
lbns item SORTER NSORTER 0 OccupantHash 0
seq iron item IRONORE
seq copper item COPPERORE
or target iron copper # 1 = wanted ore
seqz target target # wanted ore to 0, rest to 1
sbn SORTER NSORTER Output target
j start
How to read it:
- Every tick the chip makes sure the sorter is in
Logicmode. Occupiedtells whether something is waiting in slot 0. If the slot is empty, the chip writes nothing. That matters: anOutputthe chip sets while the slot is empty would apply to the next item before the chip has seen it.lbnsreads the prefab hash of the waiting item.seqcompares with the two ore hashes,orcombines the results,seqzinverts them.
Iron and copper ore thus land in the export slot and at the "output" connection, everything else in export 2 at "output 2". Which opening on the model is which, the first test run shows. If it is the wrong way round, swap the chutes – or delete the seqz line. More in the IC10 Academy: sorter.
lbns with batch mode 0 averages over all devices with that name. Two sorters called "Ore Sorter" would average their hashes, and none would match any more. So every sorter gets its own name.
You find the hashes of all items in the Hash lookup. More on slot values in the academy: IC10 Academy: slots and IC10 Academy: batch modes.
The logic sorter
The Logic Sorter looks like the sorter and draws only 5 W. It has no Output logic value. It decides by itself, following rules in its own memory with 32 places. A chip writes them in once with put, after that the machine sorts on its own.
Every rule checks one property of the waiting item: prefab hash equal or not equal, sorting class, slot type or stack quantity. Mode combines the rules: All (0) sends to export 2 when all match, Any (1) when at least one matches, None (2) when none matches. Everything else goes to export. Empty places (0) are skipped; old rules stay until overwritten or cleared with clrd.
The advantage over the sorter in Logic mode: the chip does not have to run along every tick, and a single chip can set up many logic sorters one after another. How the rule numbers are built is shown in the IC10 Academy: logic sorter.
Stacker, unloader and loader
The Stacker combines identical items into stacks. Its third slot is called "processing" – that is where the stack grows. In Automatic mode it works on its own; in Logic mode a chip decides via Activate and Output. From slot 2 the chip reads Quantity and MaxQuantity.
Why stacking pays off is shown by a worked example: a chute of 20 tiles holds 20 items. As single pieces that is 20 ores; as full stacks of 50 each, up to 1,000.
The Unloader empties containers such as a crate: in Automatic mode it takes out the content slot by slot, then sends the empty container on. In Logic mode Output 1 takes out one item, Output 0 lets the container pass with its content, after which Output is back at −1.
The Loader ("loader") does the opposite. It has two chute inputs: one for the goods (slot "Payload") and one for the container (slot "Recipient"). Every item of goods goes into the first free, fitting slot of the container.
- In
Automode the container moves on as soon as it is full orOpenis 1. Goods for which there is no container or no fitting slot run straight through to the output. - In
Logicmode the container stays until a chip writesDispense1. Goods without room wait at the input.
A worked example: a crate with ten slots and iron ore in stacks of 50 takes up to 500 ore. The loader fills it, the unloader at the other end empties it again.
Digital valves and splitters
The Chute Digital Valve Left lets items through while Open is 1. That lets you build gates in the chute: a chip reads with OccupantHash what is waiting in the valve and opens only for the right item. The Chute Digital Flip Flop Splitter Left distributes to two outputs and has the writable values Mode, Setting, Quantity and SettingOutput for that.
An example layout
An automated ore store could look like this:
- An import bin for everything you bring back from mining.
- A stacker so loose ores become stacks.
- A sorter in
Logicmode with the program above: iron and copper to the furnace, the rest onward. - A second sorter for the next ore, and at the end a Vending Machine as storage.
That keeps every run short, and every sorter has only one question to answer.
Next steps
- Chutes, kits and storage: Chutes and logistics: basics, inputs and outputs
- Sorting the greenhouse harvest: Hydroponics and planters: setup and automation
- Addressing devices by name: IC10: control a device by name
- Try the code: IC10 editor