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
#71
(translated by Google translator)

Hi all.  Smile
I just published a new version of the "Nature" program prototype.

This is the program ID: RPSQ181.000-3

In this version, the image of the Rabbit has been changed.
In addition, the Z coordinates of the Rabbit and the Snake's head have been changed.
Now the Rabbit can jump over the Snake's body.

I think that now we can try to replace the manual control of the Snake with artificial intelligence temporarily built into the “Nature” program.
[-] The following 1 user Likes AbsoluteBeginner's post:
  • litdev
Reply
#72
(translated by Google translator)

Hi all.
I just published the latest version of the "Nature" program. This is the program ID: RPSQ181.000-4
In this version, a person manually controls only the speed of the game.
This control is performed by pressing the "W" and "S" keys.
The control code is temporary. Therefore, the code is as simple as possible.

In this version of the program, the movement of the Rabbit and the Snake is controlled only by written code.
The code that controls the Rabbit is in the "Nature" program. This code uses only randomness.
But, the code that controls the Snake's movement is more complex. Although this is not AI, this code already evaluates the current situation on the playing field.
In order to study the "LDCall.CallInclude()" function, I placed the code of the Mind of the Snake in the included file.

This is the program ID:  LDWX717.000

This file doesn't do anything on its own. It contains one subroutine that the main program "Nature" calls to get the Snake's decision about its next move.
(oops, I forgot to check with the "Nature" program for the presence of a compiled included file in the folder  Cry )

  1. In short, you first need to compile the include file into the folder in which the compiled main "Nature" file will be launched.
  2. Then, using SB-Prime, you need to write the name of the included exe-file into a variable that is located at the very beginning of the “Nature” file. For example, like this: s_includedFileName = "Included Snake AI 004.exe"
  3. Then you need to compile the “Nature” file into the same folder.

That's it, now you can run the "Nature" file and watch the funny struggle between two technologies.
-------
The rules of the game have been slightly changed.
So far, the Snake sees the Rabbit always and anywhere on the playing field.
The Rabbit never sees the Snake at all. While the Snake is sneaking up on the Rabbit, the Rabbit does not see it, because the Snake has a good camouflage.
When the Snake makes its attack on the Rabbit, then it is too late for the Rabbit to see the Snake.
And if the Rabbit makes a random jump and runs away from under the very nose of the Snake, then the Rabbit also cannot see the Snake, because the Snake has an excellent camouflage.
Thus, the combination of immobility and unexpected jumps is the Rabbit's means of protecting himself from the teeth of the Snake.
But the Rabbit's ability to jump over the Snake's body gives the Rabbit an excellent opportunity to defend itself.
Even when I controlled the Snake manually, I immediately felt how much nerves the Rabbit could ruin the Snake until the Snake caught the Rabbit.
I wonder what the Rabbit will be able to do against the Snake when the Rabbit gains Intelligence. But their fights can be very interesting.

( Tip: I recommend launching the “Nature” program not from the SB-Prime editor. It's better to run the executable file directly. When I ran the program from the editor, then I sometimes got strange errors.)
Let's test it!
[-] The following 1 user Likes AbsoluteBeginner's post:
  • litdev
Reply
#73
Thank you, dear LitDev.  Rolleyes
But, my work and my pleasure from this work became possible thanks to the library you created and the wonderful Editor, which includes aliases.
These tools have made the process of creating programs incredibly easy for a hobbyist who doesn't speak English.

Regarding errors when launching the program from the Editor.
I'll keep an eye on this. And I will report anything that may be important.

Yes, I almost forgot.
What do you think about using include files instead of a server-client system to communicate between "Nature" program Main Loop and the Snake Mind and Rabbit Mind routines?
Is there anything that makes one way significantly better than the other?

Thank you.
Reply
#74
I understand.
In this case, I will continue to develop the project in the direction of using include files, if they can be connected several at once.
Also, I don't yet know if the include file has the ability to save data to disk and read it from there.
Saving data on disk will be required to accumulate experience in the “genetic memory” of the object.

Are there any restrictions that appear on a Small BASIC file when this file works in INCLUDE file mode?
Maybe in this mode the file is not able to perform any operations?

Thank you.
Reply
#75
Hi all.  Smile

Yesterday I realized that the game "AI Snake" should have a server-client system.
If Snake Mind and Rabbit Mind were created by the same developer, then he could work with variable names quite simply.
But everyone should be able to create their own versions of the Snake Mind and the Rabbit Mind.
It will be easier for these people to study the protocol for communicating with the Server than to keep track of variable names.
In addition, we can create a TEMPLATE in which the code for communicating with the Server will already be written.
And the developer of the new Mind will be able to simply paste his code into the template.
[-] The following 1 user Likes AbsoluteBeginner's post:
  • litdev
Reply
#76
(translated by Google translator)

Hi all.  Shy
I have just successfully carried out a test run of the Server and two Clients.
The Clients have the code of the Rabbit Mind and the Snake Mind, which were previously in the include file and in the Server code, inserted.
Now these are real Clients.
All I have to do is design the code beautifully and I will release a new version of the prototype.
Anyone will be able to create their own version of the Mind for any animal in this game.

( I already have a couple of ideas for my favorite Rabbit )  Wink
Reply
#77
(translated by Google translator)

Hi all.  Shy
I published the first version of the prototype of the "AI Snake" SYSTEM.
I call it a System because now it requires three files to use.

- The first is the "Nature" program: RPSQ181.000-5
This is the server part of the System. This program provides communication with the Rabbit and the Snake. And in this program all modeling of the game process is carried out.

- Two other programs are Clients of this Server. This is the "Snake AI" program: TJSG543.000
And the "Rabbit AI" program: XBWP716.000-0

It is better to create a separate folder for each client program. When I first launched the client from the same folder from which the server was already running, then I received a message that the libraries were already in use by another program. The process was stopped.

The code of both Clients has already been created using a universal template.
I tried to describe in the template all the operations that are necessary for communication between the Client and the Server.
In addition, I tried to highlight those places where any developer of a different version of AI can easily insert their code.

But it’s still impossible to tell all the features at once. Therefore, I will wait for information about errors from you.
I will be grateful to you for all your comments and suggestions for improving the code, the design of the game and improving the gameplay.

Thank you.  Wink

( Addition. My Clients, whose IDs I indicated in this message, are not AI. These are simple hard algorithms that are used to debug the system. )
Reply
#78
Hi all.
Now that it is possible to hold competitions of Minds, we must somehow collect Statistics of their achievements.  Huh
But, I have never solved the problem of collecting and storing statistical data using the Small BASIC programming language.
Please tell a Beginner what file format is best to use to store Statistics?
And which methods from the LitDev library are best suited for this task?

( I want to do this as quickly as possible. Therefore, I ask you to tell me the Direction of my movement.  Angel )

Thank you.
Reply
#79
AB,

Store data locally in a file (I would start with this), perhaps written by the server that has overall control, maybe using File.GetSettingsFilePath.

To store on the web so users can share, there is:

LDNetwork.HighScore - a single user name and integer highest score for games.

LDNetwork.SetGameData & GetGameData - store specific data for a game. this will be an array of data associated with a game name.

================================

I loaded your 3 programs, followed your clear instructions and for me I could run them all from the same folder and same instance of SB-Prime.  Your initial default AIs work well and the game messaging is good.

Only comment I have about the interface is that for me the main server On/Off switch doesn't display so well, reduced font sizing and text positioning below works better for me (could be my display).

   

Code:
  GraphicsWindow.FontSize = 6
  GraphicsWindow.FontBold = "True"
  LDImage.AddText(img_txt_OFF, "OFF", 1, 1, "White")

I am wondering how you see this evolving.  If the rabbit moves randomly then the best the snake can do is move towards the rabbit as you do.  If the rabbit can see the snake, then it can always move away from it, so we need to introduce some other features and limit what each can know about the other in some way.  This would be done in the server I would think - it sets the parameters of the game which the AI bots have to live within.

See this thread Post 66 where I had some ideas, but I am interested to see what you or others think.
[-] The following 1 user Likes litdev's post:
  • AbsoluteBeginner
Reply
#80
LitDev,

My display's physical resolution = 2736x1824. Software setting = 1440x900.
Maybe this circumstance is the reason that the font on the switch is displayed correctly for me?  Huh
-------

As for the rules of the game, I agree to any modernization.  Shy
It will be very good if people are interested.

Personally, I plan to move in small steps. After creating the Statistics module, I want to make my first AI for Rabbit.
If this AI significantly buffs the Rabbit, then I'll make a counter AI for the Snake.
In this way, both AIs will have to evolve in order to compete at the Championship with the best AIs that other people will create.

This is my plan now.
[-] The following 1 user Likes AbsoluteBeginner's post:
  • litdev
Reply


Forum Jump:


Users browsing this thread: 7 Guest(s)