=
a b = leaves true if the two numbers are equal. The one in *.eye5 0 =, “I see nothing”.
Facts
- Word
=- Family
- Comparisons
- Integer stack
- pops 2, pushes 0
- Boolean stack
- pops 0, pushes 1
- What it does
- Pops two numbers and pushes true if they are equal. With an empty stack it compares 0 with 0 and gives true.
- 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 they are equal and false if not. Here the order doesn't matter: 3 3 = is true and 3 4 = is false.
Two classic uses:
*.eye5 0 =: the middle eye (.eye5) sees nothing.*.refeye *.myeye =: what it sees has the same number of eye reads in its DNA as the bot (.refeyeand.myeye); the simplest way to recognize your own species.
This bot turns right (.aimdx) while it sees nothing, looking for something to look at:
' turns while it sees nothing
cond
*.eye5 0 =
start
60 .aimdx store
stopTo compare values that wobble a little, such as a speed or a distance, an exact = is usually too strict; in those cases %= and ~= are useful. The opposite of = is !=.
With the integer stack empty it compares 0 with 0 and gives true. The other comparisons are in Comparisons.