Table of Contents
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.
History #
“Decrement” as it appears in various historic incarnations of ChipWits!
COMMODORE 64:
MANUAL:
APPLE II:
CHIPWITS II (WINDOWS 95):
Leave a Reply