We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Small Basic AI Championship
I was lucky.  Smile
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
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.  Shy
[-] The following 1 user Likes AbsoluteBeginner's post:
  • z-s
Reply


Messages In This Thread
Small Basic AI Championship - by AbsoluteBeginner - 09-13-2023, 06:24 PM
RE: Small Basic AI Championship - by litdev - 09-13-2023, 08:18 PM
RE: Small Basic AI Championship - by litdev - 09-14-2023, 11:30 PM
RE: Small Basic AI Championship - by z-s - 04-01-2024, 10:38 AM
RE: Small Basic AI Championship - by litdev - 04-01-2024, 08:13 PM
RE: Small Basic AI Championship - by z-s - 04-02-2024, 09:16 AM
RE: Small Basic AI Championship - by z-s - 04-02-2024, 05:05 PM
RE: Small Basic AI Championship - by z-s - 04-04-2024, 05:16 AM
RE: Small Basic AI Championship - by Scout - 04-04-2024, 02:08 PM
RE: Small Basic AI Championship - by litdev - 04-04-2024, 03:05 PM
RE: Small Basic AI Championship - by z-s - 04-04-2024, 04:30 PM
RE: Small Basic AI Championship - by litdev - 04-04-2024, 05:02 PM
RE: Small Basic AI Championship - by jrmrhrb00 - 04-04-2024, 10:04 PM
RE: Small Basic AI Championship - by litdev - 04-04-2024, 10:13 PM
RE: Small Basic AI Championship - by jrmrhrb00 - 04-04-2024, 11:07 PM
RE: Small Basic AI Championship - by litdev - 04-10-2024, 07:31 PM
RE: Small Basic AI Championship - by litdev - 04-11-2024, 10:03 AM
RE: Small Basic AI Championship - by z-s - 04-11-2024, 02:29 PM
RE: Small Basic AI Championship - by litdev - 04-16-2024, 01:16 PM
RE: Small Basic AI Championship - by z-s - 04-16-2024, 03:04 PM
RE: Small Basic AI Championship - by litdev - 04-16-2024, 05:42 PM
RE: Small Basic AI Championship - by z-s - 04-17-2024, 06:24 AM
RE: Small Basic AI Championship - by z-s - 04-17-2024, 02:28 PM
RE: Small Basic AI Championship - by litdev - 04-19-2024, 07:01 PM
RE: Small Basic AI Championship - by litdev - 04-20-2024, 10:09 AM
RE: Small Basic AI Championship - by litdev - 04-22-2024, 08:24 AM
RE: Small Basic AI Championship - by z-s - 04-23-2024, 06:29 AM
RE: Small Basic AI Championship - by Scout - 04-24-2024, 02:48 PM
RE: Small Basic AI Championship - by Scout - 04-24-2024, 05:55 PM
RE: Small Basic AI Championship - by litdev - 04-24-2024, 08:39 PM
RE: Small Basic AI Championship - by z-s - 04-25-2024, 04:28 AM
RE: Small Basic AI Championship - by z-s - 04-25-2024, 05:19 AM
RE: Small Basic AI Championship - by z-s - 05-01-2024, 06:06 AM
RE: Small Basic AI Championship - by z-s - 05-01-2024, 07:18 AM
RE: Small Basic AI Championship - by litdev - 05-01-2024, 04:24 PM
RE: Small Basic AI Championship - by litdev - 05-18-2024, 01:33 PM
RE: Small Basic AI Championship - by litdev - 06-07-2024, 10:44 AM
RE: Small Basic AI Championship - by litdev - 06-13-2024, 08:03 AM
RE: Small Basic AI Championship - by Scout - 06-13-2024, 05:46 PM
RE: Small Basic AI Championship - by litdev - 06-13-2024, 07:16 PM
RE: Small Basic AI Championship - by litdev - 06-21-2024, 09:35 AM
RE: Small Basic AI Championship - by litdev - 06-21-2024, 12:44 PM
RE: Small Basic AI Championship - by z-s - 06-21-2024, 05:20 PM
RE: Small Basic AI Championship - by litdev - 06-24-2024, 05:17 PM
RE: Small Basic AI Championship - by litdev - 06-27-2024, 08:03 PM
RE: Small Basic AI Championship - by litdev - 06-28-2024, 10:32 AM
RE: Small Basic AI Championship - by litdev - 06-28-2024, 02:16 PM
RE: Small Basic AI Championship - by AbsoluteBeginner - 06-28-2024, 06:17 PM
RE: Small Basic AI Championship - by litdev - 06-29-2024, 08:50 AM
RE: Small Basic AI Championship - by litdev - 06-29-2024, 04:59 PM
RE: Small Basic AI Championship - by z-s - 07-02-2024, 12:21 PM
RE: Small Basic AI Championship - by z-s - 07-02-2024, 02:38 PM
RE: Small Basic AI Championship - by z-s - 07-06-2024, 02:19 AM
RE: Small Basic AI Championship - by z-s - 07-06-2024, 01:02 PM
RE: Small Basic AI Championship - by z-s - 07-06-2024, 04:01 PM
RE: Small Basic AI Championship - by z-s - 07-06-2024, 04:45 PM
RE: Small Basic AI Championship - by litdev - 07-06-2024, 11:07 PM
RE: Small Basic AI Championship - by z-s - 07-11-2024, 02:55 AM
RE: Small Basic AI Championship - by z-s - 07-11-2024, 06:39 AM
RE: Small Basic AI Championship - by litdev - 07-13-2024, 10:53 PM
RE: Small Basic AI Championship - by z-s - 07-14-2024, 03:37 AM
RE: Small Basic AI Championship - by litdev - 07-14-2024, 09:05 AM
RE: Small Basic AI Championship - by z-s - 07-15-2024, 06:16 AM
RE: Small Basic AI Championship - by litdev - 07-17-2024, 08:31 PM
RE: Small Basic AI Championship - by litdev - 07-18-2024, 11:45 AM
RE: Small Basic AI Championship - by litdev - 08-25-2024, 06:44 PM
RE: Small Basic AI Championship - by litdev - 08-26-2024, 08:24 AM
RE: Small Basic AI Championship - by litdev - 09-01-2024, 06:53 PM
RE: Small Basic AI Championship - by litdev - 09-01-2024, 08:25 PM
RE: Small Basic AI Championship - by litdev - 09-02-2024, 01:59 PM

Forum Jump:


Users browsing this thread: 28 Guest(s)