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
Hi AB,
Glad you could reproduce issue.  I can look into it if you share full source code with description of what to do to see problem.
Reply
Good afternoon.
Fine. I'll do it as soon as I can.  Shy
Reply
So, first I will talk about the results of executing the test program code that I posted in my post No. 114.

I specifically copied parts of the code from the Rabbit AI program and pasted them into the test program code with virtually no changes.
When we first run a test program, while there is no file with saved variables in the program's folder, we first assign values to the variables ( 300, 30, Test ) and then display the data in the program window using the "OnRabbitCaptured" subroutine.
The test program displays the data shown in the first screenshot.

   

The test program then creates a file with saved variables "RabbitAll_variables.txt". And this is what I see in the file created on my computer:

- - - - - - -
_s_allvariablesfilepath C:\SB_Projects\Vremennoe\RabbitAll_variables.txt
number_of_sequences 300
n_sequencenumber 30
_s_dbtext number_of_caught_rabbits = 300
number_of_dead_snakes = 30
Level of training(%) = 53
Ratio = 300
number_of_sequences = 300
_stat_caughtrabbits 300
_stat_deadsnakes 30
_x 53
- - - - - - -

If I'm not mistaken, the first three lines in this file are normal.
But, starting from the fourth line, the "SaveAllVariables" method split the variable string "_s_dbText" into separate parts and turned each of these parts into a new variable that does not exist in the test program ( number_of_dead_snakes, Level of training(%), Ratio ).
In addition, the method writes the variable name "number_of_sequences" a second time and assigns it the value "= 300".

Now, during the second run, the test program reads the stored incorrect value of the variable "number_of_sequences" from the file.
In the second screenshot we see that the value of this variable is now not “300”, but “= 300”. And this changed the result of calculating the "Level of training(%)" parameter from 53% to 101%.

LitDev, if you don’t like the current test file, then tell me and I’ll make a new test file that you need. (or I'll send you all the "Rabbit AI" code)

Thank you.  Shy
Reply
AB,
OK, each variable saved gets a new line in the file.  In your case the variable _s_dbText contains several lines (with LDText.LF) so this mucks up the file as you see.

Also, in the subroutine OnRabbitCaptured you only modify _s_dbText, so the starting value is different if you run the program reading this variable "number_of_caught_rabbits = 300" first line of _s_dbText , or setting to "Test".

number_of_sequences is actually read as "= 300" that confuses the sum of %.

Easiest to see debugging the program.  But the basic issue is the SaveAllVariables having one variable per line and being confused by LDText.LF in string and that fact that some of the parts of the _s_dbText actually include the variable names.

EDIT

I have made a change and uploaded to Beta version (1.2.29.0) of LitDev extension a fix to escape LF/CR characters when using SaveAllvariables and LoadAllVariables.
[-] The following 2 users Like litdev's post:
  • AbsoluteBeginner, z-s
Reply
Thank you very very much.  Shy
Reply
(translated by Google translator)

Hello, dear friends.  Smile
Oh, I've had a lot of trouble with this latest update.
The "Nature" Server and the "Snake AI" Client have not received any major changes.

"Nature" ID: RPSQ181.000-9
"Snake AI" ID: TJSG543.000-3

But the “Rabbit AI” in this version is already a completely new mutation. ID: XBWP716.000-4

The "Rabbit" of this mutation (mutation #2) has much more learning opportunity.
At the very beginning of training, “Rabbit” randomly selects one of 625 possible sequences of four actions.
If, after performing the selected sequence of actions, the “Rabbit” remains alive, then the rating of this sequence increases by 1.
If the "Rabbit" dies, the sequence rating is reduced by 5.
A sequence whose rating has become negative is removed from the list and is no longer used in the game.
This is how a “natural selection” of the best sequences is carried out.
When “Rabbit” has 10 of the best sequences left, then the “Rabbit” training level indicator will show the number 100% and training will stop.

It will be very interesting if these are the 10 best sequences for the survival of the "Rabbit" in the fight against this particular "Snake".  Rolleyes
I think the set of best sequences will be different for the Snakes, which will differ in Intelligence.
And it’s also interesting how the level of the “Ratio” parameter will depend on the level of Intelligence of the “Snake”.
Now, "Ratio" has a value of about 20 eaten "Rabbits" per one dead "Snake" at the very beginning of the "Rabbit" training. And this value decreases as the "Rabbit" trains.

I have never reached 100% learning level yet.
To achieve this level, the program saves the game results in files in the "Rabbit" folder.
Remember that it is better to save and run Clients from separate folders.
When the Rabbit AI program starts, the program loads the saved results of the last session if the necessary files are present in the folder.
If there are no files, then the program will create new files for the new “Rabbit” and training will start from scratch.

In this way, you can move the files of an already trained rabbit to the archive and a new training of the “Rabbit” against some new “Snake” will begin. And the files of the trained “Rabbit” can be used when needed.
[-] The following 1 user Likes AbsoluteBeginner's post:
  • z-s
Reply
I will try it today but is the project now over.
ZS
Reply
(07-02-2024, 12:21 PM)z-s Wrote: I will try it today but is the project now over.

Of course NOT FINISHED!  Smile (if Google translated everything correctly for me)
I haven’t even made a neural network for “Rabbit” yet.
In addition, there is also "Snake".
And then there are also bushes around which the “Rabbit” can hide from the “Snake”.
And “Rabbit” can dig holes and hide in them.
And we also need to add something that we haven’t thought of yet.  Wink
In general, if I don’t get torn apart by some kind of rocket, then this game may be enough for me for the rest of my life.
[-] The following 1 user Likes AbsoluteBeginner's post:
  • z-s
Reply
I will pray to god that the war in your land stop as soon as possible and you will complete this project and also be a member of this Form for everlasting time.
ZS
[-] The following 1 user Likes z-s's post:
  • litdev
Reply
(07-02-2024, 02:38 PM)z-s Wrote: I will pray to god that the war in your land stop as soon as possible and you will complete this project and also be a member of this Form for everlasting time.

Thank you to all the kind people for your help and kind words.  Heart
I never thought that I myself would personally feel how my body is afraid of the sound of a flying rocket.  Cry
My cold mind watched this as if from the outside...
If an explosion does not occur within a second, then the horror that just shackled the whole body turns into hot blood, which spreads inside the arms and legs, and cold sweat appears on the head.
And the Mind still “looks” at all this as if from the outside.

This is all creepy, unfair and wrong, my friends.
Thank you for your sympathy...
[-] The following 1 user Likes AbsoluteBeginner's post:
  • litdev
Reply


Forum Jump:


Users browsing this thread: 8 Guest(s)