I was hoping you'll ask:
I recently did an AI project for school myself. It has no real Boolean logic, example:
IF True THEN Sin 29 * CALC Memory(121) OUT Do_Nothing TYPE action DIRECTION clone_up
IF True THEN 250 7 216 * CALC Memory(170) OUT Do_Nothing TYPE action DIRECTION clone_down
IF True THEN Sin 29 * CALC Memory(121) OUT Do_Nothing TYPE action DIRECTION clone_up
IF True THEN Sin 29 * CALC Memory(121) OUT Do_Nothing TYPE action DIRECTION clone_up
IF Memory(167) < Memory(36) THEN 142 0 CALC Memory(99) OUT Do_Nothing TYPE data DIRECTION clone_up
IF True THEN 29 * CALC Memory(197) OUT Do_Nothing TYPE action DIRECTION clone_up
IF Memory(234) = Memory(211) THEN 206 * CALC Memory(178) OUT Do_Nothing TYPE action DIRECTION clone_up
IF True THEN 351.508334281997 1 Cos 39.1118722540835 Cos CALC Memory(76) OUT Do_Nothing TYPE data DIRECTION clone_up
IF False THEN 202 * 217 * CALC Memory(7) OUT Gear2_Reverse TYPE data DIRECTION clone_up
IF True THEN Distance 161 0 * * Sin * 241 * CALC Memory(174) OUT Do_Nothing TYPE data DIRECTION clone_up
IF False THEN 34.3416983468838 202 * 217 * CALC Memory(7) OUT Gear2_Reverse TYPE data DIRECTION clone_up
IF Memory(133) != Memory(213) THEN * 61 * CALC Memory(110) OUT Do_Nothing TYPE data DIRECTION clone_up
After CALC is the destination of the data (math) result
One of the operators I have is called "Angle_Compare" (btw: I am considering this for DB as well) It compares two angles using this algorithm:
hold1 = popstack(a) '100
hold2 = popstack(a) '99
calc = IIf(angle_compare(hold1, hold2), 2, -2)
If MD_state = 5 And a = cntrl_math Then debug_print.Text = debug_print.Text & vbNewLine & hold1 'debug
If MD_state = 5 And a = cntrl_math Then debug_print.Text = debug_print.Text & vbNewLine & hold2 'debug
If MD_state = 5 And a = cntrl_math Then debug_print.Text = debug_print.Text & vbNewLine & "DIR:" & calc 'debug
pushstack(a, calc)
Private Function angle_compare(ByVal ang1 As Single, ByVal ang2 As Single) As Boolean
Dim data2 As Integer = ang2
Dim data1 As Integer = ang1
Dim out As Boolean
Dim sp As Boolean = False
If data1 > 180 Then
sp = True
data2 = 360 - data2
data1 = 360 - data1
End If
If (data2 > data1) And (data2 < (data1 + 180)) Then out = True Else out = False
If sp Then angle_compare = IIf(out, True, False) Else angle_compare = IIf(out, False, True)
End Function
As you can see since there is no real Boolean stack; The functions result is always stored as Integer (2 , -2) and then can be stored into a memory location. Then the system can always compare the result > v. zero. This kind of model worked pretty good for me.
The button line is it will add flexibility of using a Boolean operator as a data operator and vise-versa.
Think about "angle_compare": In DB it will take two Integers and return an Integer (2 or -2) , but it will be cool to turn it into a Boolean right away.
You may catch me here on the fact that I am making an imaginary concept (intotobool) on concept that's imaginary as well (angle_compare) but I hope it'll be alright.