<
a b < leaves true if a is less than b. The comparison for “hasn't reached yet”.
Facts
- Word
<- Family
- Comparisons
- Integer stack
- pops 2, pushes 0
- Boolean stack
- pops 0, pushes 1
- What it does
- Pops two numbers a b and pushes true if a, the lower one on the stack, is less than b. With an empty stack it gives false.
- Cost
- Condition
- Runs
- inside a gene: in the condition (cond) and in the body (start or else)
a b < pops two numbers and pushes true if a (the lower one) is less than b (the upper one), and false if not. 3 5 < is true; 5 3 < and 5 5 < are false.
It's the comparison for limits: “while I have less than”, “if it hasn't reached yet”. This bot pushes forward (.up) only while it is going slower than 20 (.velup). It accelerates for a few cycles and then hovers around that speed, a unit or two above or below:
' pushes only while going slower than 20
cond
*.velup 20 <
start
5 .up store
stopIf you want the limit value to count too, use <=. The exact opposite of a b < is a b >= (>=).
With the integer stack empty it compares 0 with 0 and gives false. The other comparisons are in Comparisons.