
The If Number Equals chip compares the number currently at the top of the stack to a specified value. If the number matches the value you’ve entered, the ChipWit will proceed with the next instruction in the sequence. If it doesn’t match, the ChipWit will skip the next instruction.
The Arguments represent the value that you want the ChipWit to compare to the value at the top of the Number Stack (which are 0-7, the meters and range finder)
Specifications #
- Argument: Numbers 0-7, Damage Register, Range Register, Fuel Register, Nil (Nil represents there is nothing in the Stack)
- Creates a True or False Branch?: Yes, it does create a T/F branch
- Number of Cycles Used: 2
- Fuel: 1
Why the If Number Equals Chip Matters #
- Conditional Logic: This chip allows your ChipWit to make decisions based on numerical values, enabling more complex and dynamic behavior.
- Stack Comparisons: It uses numbers stored on the stack, which means you can push different values to the stack and check them against different criteria.
- Flow Control: This chip is particularly useful for controlling loops, counters, or checking for specific conditions within your ChipWit’s program.
How to Use the If Number Equals Chip #
- First, push a number onto the stack using the Push Number chip or another stack operation like Increment or Decrement.
- Place the If Number Equals chip in your program and specify the number you want to compare against (e.g., 5).
- When executed, the ChipWit checks if the top number on the stack matches the number you specified. If true, it will proceed with the next instruction. If false, it will skip the next instruction and move on.
Example of Use #
- Let’s say you’re controlling how many pies your ChipWit collects. You push the number 5 to the stack using Push Number.
- You use If Number Equals 5 to check if your ChipWit has collected 5 pies.
- If the number on the stack equals 5, the ChipWit will proceed with collecting more pies. If not, it might execute the true connector or the false connector, like skating to a new room.
The If Number Equals chip allows your ChipWit to adapt its behavior based on specific conditions, adding flexibility and depth to its programming logic.
History #
“If Number Equal” as it appears in various historic incarnations of ChipWits!
COMMODORE 64:
MANUAL:
“Using the Compare Number Operator, a CHIPWIT can check an argument against the top of any Stack, and branch (TRUE) if they are identical (i.e., Equal To).”
APPLE II:
MANUAL:
“COMPARE NUMBER: EQUAL? commands the ChipWit to examine the value on the top of the Number Stack and compare it to a specified value. If the values are the same (equal), the program branches through the COMPARE NUMBER: EQUAL? chip’s true wire. If the values are different, the program branches through the COMPARE NUMBER: EQUAL? chip’s false wire.
The Arguments represent the value you want the ChipWit to compare to the value at the top of the Number Stack. They are the values 0 through 7 (as represented by the beakers), the value from the Fuel and Damage Meters, the current reading from the Range Finder, and the bottom of the Number Stack (represented by the empty square).”
MAC:
MANUAL:
“COMPARE NUMBER: EQUAL? commands the ChipWit to examine the value on the top of the Number Stack and compare it to a specified value, if the values arc the same (equal), the program branches through the true wire of the COMPARE NUMBER: EQUAL? chip. If the values are different, the program branches through the false wire of the COMPARE NUMBER: EQUAL? chip.
The Arguments represent the value that you want the ChipWit to compare to the value at the top of the Number Stack. They are the values 0 through 7 (as represented by the beakers), the value from the Fuel and Damage Meters, the current reading from the Range Finder, and the bottom of the Number Stack (represented by the empty square)”.
CHIPWITS II (WIN 95):