Lessons · Industrial control · moving a rung is a change
Moving a rung is a change
Rung order decides who wins a double coil and how many scans a chain costs. Reordering is never cosmetic.
Hone is a place to practise programming. This is one of its lessons, written out in full and free to read without an account.
What it is for
Tidying a program has broken more machines than writing one badly, because nobody tests a tidy-up.
How to think about it
Treat a reorder like any other edit: take the known-good copy first, compare rung by rung afterwards, and test the behaviour rather than the listing.
Worked example
[B] (Lamp) [A] (Lamp)Move the rungs of a double coil and the answer moves with them. A on, B off. Lamp: 1 -- where the other order gave 0.
Your turn
What do you take before a download?
a of the program that is running
Run a rung and watch the scan
The trap
A rung that must stay below another looks exactly like a rung that happens to be below it. Only a comment tells them apart.
Practise moving a rung is a change on HoneA question on it now, a coding challenge where there is one, and it is remembered for review. Free, no email needed.