Code center > Suggestions
My new math commands
Botsareus:
How many people will update there source code with my new commands discussed here
if I evolve a robot who beats the best robot on the F1 league and uses this commands.
Botsareus:
'By the way, here it is: (Please make sure the right code goes into the right .bas file)
'----------changes to DNAExecution(DNA.bas)
Private Sub ExecuteAdvancedCommand(n As Integer) 'replace existing
Select Case n
Case 1 'findang
findang
Case 2 'finddist
finddist
Case 3 'ceil
DNAceil
Case 4 'floor
DNAfloor
Case 5 ' sqr
DNASqr
Case 6 ' power
DNApow
Case 7 ' pyth
DNApyth
Case 8 ' unpow
DNAunpow
Case 9 ' depow
DNAdepow
End Select
End Sub
Private Sub DNAunpow() 'add new
On Error GoTo b:
Dim a As Double
Dim b As Double
Dim c As Double
b = PopIntStack
a = PopIntStack
c = a ^ (1 / b)
PushIntStack c
Exit Sub
b:
PushIntStack 0
End Sub
Private Sub DNAdepow() 'add new
Dim a As Double
Dim b As Double
Dim c As Double
b = Abs(PopIntStack)
a = Abs(PopIntStack)
If b > 1 And a > 0 Then c = Log(a) / Log(b) Else c = 0
PushIntStack c
End Sub
'----------changes to DNATokenizing(DNATokenizing.bas)
Private Function AdvancedCommandDetok(n As Integer) As String 'replace existing
AdvancedCommandDetok = ""
Select Case n
Case 1
AdvancedCommandDetok = "angle"
Case 2
AdvancedCommandDetok = "dist"
Case 3
AdvancedCommandDetok = "ceil"
Case 4
AdvancedCommandDetok = "floor"
Case 5
AdvancedCommandDetok = "sqr"
Case 6
AdvancedCommandDetok = "pow"
Case 7
AdvancedCommandDetok = "pyth"
Case 8
AdvancedCommandDetok = "unpow"
Case 9
AdvancedCommandDetok = "depow"
End Select
End Function
Private Function AdvancedCommandTok(s As String) As block 'replace existing
AdvancedCommandTok.value = 0
AdvancedCommandTok.tipo = 3
Select Case s
Case "angle"
AdvancedCommandTok.value = 1
Case "dist"
AdvancedCommandTok.value = 2
Case "ceil"
AdvancedCommandTok.value = 3
Case "floor"
AdvancedCommandTok.value = 4
Case "sqr"
AdvancedCommandTok.value = 5
Case "pow"
AdvancedCommandTok.value = 6
Case "pyth"
AdvancedCommandTok.value = 7
Case "unpow"
AdvancedCommandTok.value = 8
Case "depow"
AdvancedCommandTok.value = 9
End Select
End Function
'If you are having problems inserting the code or get any kind of error please let me know.
Prsn828:
The problem here is, some people just cannot update their version (Me) because VB6 is incompatible with Vista (And therefore only the .exe's can be run).
On the other hand, if you make new exe's, I would gladly use them
Botsareus:
Ok, I will get the latest available DB source code and update it with my commands and compile it. I will post the .zip here.
I also planning to add DNAsin and DNAcos, to the code.
Prsn828:
--- Quote from: Botsareus ---Ok, I will get the latest available DB source code and update it with my commands and compile it. I will post the .zip here.
I also planning to add DNAsin and DNAcos, to the code.
--- End quote ---
You know, you may be saving DB2 from complete abandonment by doing this.
I tried to convert the code to the recent version of VB, but of course, it was completely hopeless. 103 errors are visible at all times, and several thousand are usually forgotten by the compiler by the time it reports the first 103 errors, so after hours and hours of conversions I was destroyed by Microsoft's total failure at backwards compatibility.
Navigation
[0] Message Index
[#] Next page
Go to full version