
The Decrement chip reduces the value of a specified memory cell by 1, often used for controlling loops or countdowns in your ChipWit’s program.
Specifications #
- Arguments: None
- Creates a True or False Branch?: No, Decrement does not create a True/False branch.
- Number of Cycles Used: 1
- Fuel: 1
Example of Use #
Your ChipWit needs to Zap three Electrocrabs, but after the third Zap, it should stop Zapping and start Skating to the right. Here’s how to set it up:
- Set Up Push Number Chip:
- Use the Push Number chip with “3” as the argument (representing the number of Electrocrabs to zap).
- Zap Electrocrabs:
- Place an If See Electrocrab chip in your program to detect nearby Electrocrabs.
- When an Electrocrab is detected, the ChipWit will zap it using the Zap operator.
- Use the Decrement Chip:
- After each Zap, use the Decrement chip to reduce the value in the register by 1. This will count down from 3 to 0 with each zap.
- Conditional Check:
- Add an If Number Equals chip to check when the register equals 0 (indicating all Electrocrabs have been zapped).
- Once the register hits 0, the ChipWit will stop Zapping and switch to Skate Right to continue moving.
The Decrement chip is crucial for managing loops or countdowns, allowing your ChipWit to perform repeated actions with precision and stop when necessary.
PLEASE NOTE: The stack cannot exceed 7, and decrementing to zero (NIL — or the bottom of the stack) does nothing.
History #
“Decrement” as it appears in various historic incarnations of ChipWits!
COMMODORE 64:
MANUAL:
Decrement subtracts one from the number at the top of the Number Stack. However, if an attempt is made to increment the top of the Number Stack beyond seven, it “rolls around’ and becomes a zero. Likewise, if it is decremented below zero, it becomes seven.”
APPLE II:
MANUAL:
“DECREMENT decreases the value at the top of the Number Stack by one. Numbers decrease from seven to zero and then wrap around (return) to seven. There must be a value in the Number Stack in order to DECREMENT.”
MAC:
MANUAL:
“DECREMENT decreases the value at the top of the Number Slack by one. Numbers decrease from seven to zero and then wrap around (return) to seven. There must be a value in the Number Slack to be DECREMENTed.”
CHIPWITS II (WINDOWS 95):