06-28-2024, 06:17 PM
I was lucky.
I managed to assemble the code from fragments of the original Rabbit AI code and this code reproduces for me all the strange results of the SaveAllVariables method work.
The contents of my file with saved variables also look surprising. If necessary, I can post here the text of the file with variables and small screenshots of the test program window.
Thank you.
I managed to assemble the code from fragments of the original Rabbit AI code and this code reproduces for me all the strange results of the SaveAllVariables method work.
Code:
'
_s_allVariablesFilePath = Program.Directory + "\RabbitAll_variables.txt"
number_of_sequences = 625
n_sequenceNumber = 0
_s_dbText = " "
_stat_caughtRabbits = 0
_stat_deadSnakes = 0
_x = 0
If LDFile.Exists(_s_allVariablesFilePath) = "True" Then
LDFile.LoadAllVariables(_s_allVariablesFilePath)
OnRabbitCaptured()
Else
number_of_sequences = 300
n_sequenceNumber = 30
_s_dbText = "Test"
_stat_caughtRabbits = 300
_stat_deadSnakes = 30
_x = 300
OnRabbitCaptured()
LDFile.SaveAllVariables(_s_allVariablesFilePath)
EndIf
Sub OnRabbitCaptured
_s_dbText = _s_dbText + Text.Append("number_of_sequences = ", number_of_sequences) + LDText.LF
_s_dbText = Text.Append("number_of_caught_rabbits = ", _stat_caughtRabbits) + LDText.LF
_s_dbText = _s_dbText + Text.Append("number_of_dead_snakes = ", _stat_deadSnakes) + LDText.LF
_x = Math.Floor((626 - number_of_sequences)/614*100)
_s_dbText = _s_dbText + Text.Append("Level of training(%) = ", _x) + LDText.LF
_s_dbText = _s_dbText + Text.Append("Ratio = ", Math.Floor(_stat_caughtRabbits/1)) + LDText.LF
_s_dbText = _s_dbText + Text.Append("number_of_sequences = ", number_of_sequences)
DrawBndText()
EndSub
Sub DrawBndText
GW.BrushColor = "White"
GW.FillRectangle(0, 0, GW.Width, GW.Height)
GW.BrushColor = "Black"
GW.FontBold = "False"
GW.DrawBoundText(5, 5, GW.Width - 10, _s_dbText)
EndSub
Thank you.