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
#11
Don't use compiled I missed a DLL in it so try the code
Reply
#12
(translated by Google translator)

To z-s

Hello.  Wink
I have never used a server in my programs (I didn't need to).
Tell me, please, do you use a server to connect different computers or, for example, to connect two different programs on one computer with each other?
Thank you.
Reply
#13
(translated by Google translator)

Hi all.
z-s, I want to tell you that I propose a Championship between Artificial Intelligences, but not between people.
Therefore, a person at this Championship will only be a spectator and a judge.
This is why every person should have three separate programs: "Nature", "Rabbit Mind" and "Snake Mind".
The "Nature" program will be the engine of events that will occur due to the decisions made by the mind of the rabbit and the mind of the snake. The same program will provide the minds with information about the current situation and receive Solutions from them in order to carry them out.
The "Nature" program will be the same for all people. But it will be possible to connect to it any minds that different developers can create for this Championship.

How will these three programs communicate with each other?
As an AbsoluteBeginner, I don’t know of different professional ways to organize communication between programs on one computer.
Therefore, I chose the method of communication using messages in text files.
If there is a better way to communicate between programs, then I'll be happy.  Smile
[-] The following 1 user Likes AbsoluteBeginner's post:
  • z-s
Reply
#14
I would prefer server because if we want to use file then for every one second we have to check whether it changed while in server we can use on message received
I could transform graphics windows,control method and property in keys so that we can create shape move etc on nature through mind but I am confused about how to use event.

I think we should do something to increase member of this forum
Reply
#15
(translated by Google translator)

Let's just do what we like.  Smile
Our wonderful SB-Prime gives us this opportunity.
If we come up with something interesting, then other Small Basic fans will come to us.
Reply
#16
I also believe that everyone should do what they enjoy.
The kids are lost to Small Basic because no school or book author relies on a product that is no longer supported.
However, maybe they can come back if they find interesting projects.
The AI championship would be something like this, for example.
However, I don't think the technical implementation with server and files is recommended because the file system is involved.
If several programs share files, blockages can occur.
I therefore propose a method that is used in the chess world when two chess programs play against each other.
There is a game interface (Arena<->"Nature") which addresses the two competitors directly via an ASCII interface (STDIN/STDOUT) (Dragon<->"RabbitMind" against Stockfish<->"SnakeMind").
However, the commands (UCI) must be precisely defined, which is the responsibility of the game developer.
In the following example I tried to start the engines with LDProcess, which succeeded, but I cannot send any commands because access to STDIN/STDOUT is not possible. If it were possible with LDProcess in a future version of the extension,
a direct exchange between the programs could take place.
The clipboard text is an excerpt from the communication between the ARENA GUI and the chess engine "Dragon".


Code:
'Textwindow.WriteLine( LDProcess.GetProcesses())
engine = Program.Directory + "\engines\dragon\dragon_46.exe" 'Chess-Engine
argu[0] = "uci"
ret1 = LDProcess.Start(engine,argu[0])
Textwindow.WriteLine( "Engine: " + engine + " Return: " + ret1)
Program.Delay(1000)
ret2 = LDProcess.Start(engine,"go")
Textwindow.WriteLine( "Engine: " + engine + " Return: " + ret2)
TextWindow.WriteLine( LDClipboard.GetText())
Program.Delay(10000)
stop1 = LDProcess.Stop(ret1)
stop2 = LDProcess.Stop(ret2)
TextWindow.WriteLine( "engine1 stopped:  " + stop1 + "    engine2 stopped:  " + stop2)
   
[-] The following 2 users Like Scout's post:
  • AbsoluteBeginner, litdev
Reply
#17
For message passing between 2 or more programs, perhaps have a quick looks at the samples that come with LitDev extension in the client-server folder (maybe LDServerAuto.sb and LDClientAuto.sb).  Run to compile the sever and client versions, then run the server program and one or more client apps.  It is possible to have communication between multiple clients on one PC, several PCs on a home network or even hosted over the internet.

The advantage of this kind of thing is that syncronicity is handled for you through events so each client can know what the others are doing and hence the current state of the game.  This will be more reliable than files or other message passing and allow for faster interaction in a snake/rabbit type game.  All that really needs to be passed is the client key presses, so the game could initially be written for 2 or more human players - when that works turn it over to write the AI to take over from human players, just sending key presses.
[-] The following 2 users Like litdev's post:
  • AbsoluteBeginner, stevantosic
Reply
#18
(translated by Google translator)

Thanks for your support, Scout.

I was interested to know that there is such a way to communicate between programs.
But I see that your method is difficult for a beginner.
Please tell me why using a filesystem is not desirable? After all, if “Nature” creates a file that “Rabbit” reads once and deletes, then how could any blocking occur?
Thank you.  Smile
Reply
#19
(translated by Google translator)

to LitDev

I looked at the code from the "client-server" folder.
As a true beginner, I felt that I would have to work hard to properly use this method of communication.
There must be a good reason for me to stop using text files.
Using text files is common practice for me. I mean my communication with people through email.
It's simple: sent the text; received the text.
If this method does not contain problems that I am not aware of, then I choose to use text files.
What about you?  Smile
Reply
#20
Scout I can't total get what you said .
Maybe till tomorrow I will give server ai .
I think this examples of ai program on sb may help you in ai work
http://www.nonkit.com/en/smallbasic/
(I never tried them☺☺☺☺)

Chess in sb
http://smallbasic.com/program/?CLP327-0

Ai vs ai game in sb
http://smallbasic.com/program/?PTB804-2
[-] The following 1 user Likes z-s's post:
  • AbsoluteBeginner
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)