What you learn today
- Classes like Ores and Ices
- Classes instead of single hashes
- Special cases
Yesterday the sorter recognised iron ore. But there is copper, gold, silver, lead, nickel, silicon, cobalt, uranium – one line for each? The game has a better answer: every item belongs to a sorting class.
The classes
SortingClass can be read from any slot just like OccupantHash. The values live in the namespace SortingClass.:
| Name | Number | Examples |
|---|---|---|
SortingClass.Default | 0 | everything without a class of its own, e.g. empty cans |
SortingClass.Kits | 1 | kits |
SortingClass.Tools | 2 | tools |
SortingClass.Resources | 3 | ingots, sheets, cable coils |
SortingClass.Food | 4 | food |
SortingClass.Clothing | 5 | suits, helmets |
SortingClass.Appliances | 6 | appliances to set up |
SortingClass.Atmospherics | 7 | gas canisters |
SortingClass.Storage | 8 | containers |
SortingClass.Ores | 9 | ores |
SortingClass.Ices | 10 | ice of all kinds |
Classes instead of single hashes
One line replaces a long list:
lbns class SORTER HASH("Weiche1") 0 SortingClass Average
seq target class ORES
If a new ore comes along tomorrow, the chip sorts it correctly without a change.
Special cases
The classes are not always what you expect. According to the game data Ores also contains:
- Charcoal – it is carbon, no ore for the arc furnace.
- Dirty ore from the deep miner – it has to go into the centrifuge first.
- Reagent mix, i.e. slag – also a case for the centrifuge.
Conversely biomass is no ore but Resources, although it fits into the ore slot. The chip catches the exceptions with hash comparisons:
sne tmp kind DIRTY
and target target tmp
Two diverters, three destinations
A sorter has two outputs. For ores, ice and the rest two stand in a row: diverter 1 sends real ores to the smelter, everything else on to diverter 2. Diverter 2 sends ice to the ice crusher, the rest into storage.
When a chip controls two diverters, a missing diverter must not paralyse the other. That is why, with an empty or missing slot at diverter 1, the chip simply jumps on to diverter 2 instead of back to the start.
Exercise
Task
Two sorters in logic mode: “Weiche1” sends items of class Ores to output 2 – except dirty ore, reagent mix and charcoal –, everything else to output 1. “Weiche2” sends items of class Ices to output 2, the rest to output 1. Decisions only with an occupied input slot; an empty or missing diverter 1 must not hold up diverter 2.
Hints
Hint 1
Diverter 1: with an empty slot beqz tmp diverter2, not start.
Hint 2
seq target class ORES, then three exceptions with sne and and.
Hint 3
Diverter 2: seq target class ICES.
Quiz
4 questions. You pass from 60 % – the server does the grading.
Complete the day
- Passed the simulator exercise
- Passed the quiz with at least 60 %
Without an account progress is saved in this browser only.
Report a mistake in this lesson
Please sign in to report. Sign in