I thought it would be interesting if we post all the 1G codes for conditional operators.
I wonder if a 1G version of the code could be built so conditional operators worked like these math operations (nullifying the last stack value if not true), and there weren't any 'conds' 'starts' or 'stops', nor a boolean stack, just stores.
Telling from memory... I guess there may be simpler versions...
Usage: *value .sysvar x y (1G code) store
Example: -1 .shoot *.refeye *.myeye sub abs sgn mult store
If target has 4 eyes and me 3: sub (4 3) = 1; sgn(1) = 1; abs(1) = 1; mult (.shoot 1) = .shoot
If target has 1 eye and me 3: sub (1 3) = -2; sgn(-2) = -1; abs (-1) = 1; mult (.shoot 1) = .shoot
If target has 3 eyes and me 3: sub (3 3) = 0, sgn(0) = 0, abs(0) = 0; mult (.shoot 0) = 0
Code:
Equal: sub abs sgn 1 sub abs mult (or: sub abs sgn -- abs mult)
Not equal: sub abs sgn mult
X bigger than Y: sub sgn 1 sub sgn 1 add mult (or: sub sgn -- sgn ++ mult)
X smaller than Y: sub sgn -1 mult 1 sub sgn 1 add mult (or: sub sgn -1 mult -- sgn ++ mult)
X bigger than or equal to Y: sub 1 add sgn 1 sub sgn 1 add mult (or: sub ++ sgn -- sgn ++ mult)
X smaller than or equal to Y: sub 1 add sgn -1 mult 1 sub sgn 1 add mult (or: sub ++ sgn -1 mult -- sgn ++ mult)
X beyond Y range: div sgn abs mult
X within Y range: div sgn abs 1 sub abs mult (or: div sgn abs -- abs mult)