Welcome, Guest. Please Login or Register.
May 16th, 2024, 6:09am

Home Home Help Help Search Search Members Members Login Login Register Register
Arimaa Forum « Shared Memory »


   Arimaa Forum
   Arimaa
   Bot Development
(Moderator: supersamu)
   Shared Memory
« Previous topic | Next topic »
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print
   Author  Topic: Shared Memory  (Read 1420 times)
Polyfractal
Forum Senior Member
****



Arimaa player #3241

   


Gender: male
Posts: 27
Shared Memory
« on: Apr 16th, 2008, 3:10pm »
Quote Quote Modify Modify

I'm beginning the development of a bot and wanted to make sure I wasn't violating any rules.  My current design requires the bot to be 'running' the entire match, rather than instanced each time the getMove program is called.  To accomplish this (and still utilize the Arimaa bot framework) I was planning on creating two executables.
 
The first program will be the standard getMove program, called by the existing bot framework.  This will act as a entry point for the bot framework so as to not break things.  The bulk of the processing will occur in a separate executable thread which is persistently running throughout the match.  The two will communicate via shared memory.  Ie. The getMove program will be instanced each turn and signal to the main, persistent executable by shared memory.
 
Is this within the rules?  It is a bit of a cludgy hack, but the only good way I feel a 'persistent' bot can be run while still conforming to the bot framework.
IP Logged
Fritzlein
Forum Guru
*****



Arimaa player #706

   
Email

Gender: male
Posts: 5928
Re: Shared Memory
« Reply #1 on: Apr 16th, 2008, 4:54pm »
Quote Quote Modify Modify

It's certainly not against the rules for a bot to ponder during the opponent's thinking time.  Omar will have to speak to what mechanism he will support to allow this.
IP Logged

Polyfractal
Forum Senior Member
****



Arimaa player #3241

   


Gender: male
Posts: 27
Re: Shared Memory
« Reply #2 on: Apr 18th, 2008, 1:39am »
Quote Quote Modify Modify

Excellent, thanks for the response!
 
To avoid creating a new thread, I'm curious what happens if a bot attempts to perform an illegal move.  Does the server reject it and return control to the bot?  Does the bot forfeit its move?  Is it just assumed that bots always perform legal moves?
 
I'm not asking because I want my bot to cheat, but rather, am curious what happens if my code falters and accidentally does something that is against the rules.
IP Logged
IdahoEv
Forum Guru
*****



Arimaa player #1753

   


Gender: male
Posts: 405
Re: Shared Memory
« Reply #3 on: Apr 18th, 2008, 2:05am »
Quote Quote Modify Modify

The next version of my bot will ponder, as well, and in general it's always been agreed that the best way to do this is to have getMove be a separate script that communicates with the main brain of your bot.
 
 
In terms of illegal moves, the server will definitely reject an illegal move.  I'm not sure exactly what will be returned to your bot, if anything, though.  The easiest thing:   try it and see.   Write a getMove script that simply submits an illegal first move and see what happens.   Be sure to let us know!
IP Logged
Polyfractal
Forum Senior Member
****



Arimaa player #3241

   


Gender: male
Posts: 27
Re: Shared Memory
« Reply #4 on: Apr 18th, 2008, 3:22am »
Quote Quote Modify Modify

It appears the GameServer enforces the rules with an iron fist. Smiley  If there is a violation of any sort, the GameServer sends back an "error=" message.  Here is an example:
 
Code:

error=Gameserver: Bad Move: bad step Ra2 Rb2 Mc2 Dd2

 
The perl scripts provided by Omar default to any error message with a "USR1" code and automatically abort.  Unfortunately, it looks like it takes a while for the GameServer to clean up aborted games.
 
In case anyone is curious, adding these two lines after line 658 on bot.pl will dump all network traffic to the screen and log.   Helpful if you want to debug or look at the protocol:
 
Code:

watchLog($res->content());
gameLog($res->content());

« Last Edit: Apr 18th, 2008, 3:23am by Polyfractal » IP Logged
omar
Forum Guru
*****



Arimaa player #2

   


Gender: male
Posts: 1003
Re: Shared Memory
« Reply #5 on: Apr 21st, 2008, 7:38pm »
Quote Quote Modify Modify

on Apr 16th, 2008, 3:10pm, Polyfractal wrote:
I'm beginning the development of a bot and wanted to make sure I wasn't violating any rules.  My current design requires the bot to be 'running' the entire match, rather than instanced each time the getMove program is called.  To accomplish this (and still utilize the Arimaa bot framework) I was planning on creating two executables.
 
The first program will be the standard getMove program, called by the existing bot framework.  This will act as a entry point for the bot framework so as to not break things.  The bulk of the processing will occur in a separate executable thread which is persistently running throughout the match.  The two will communicate via shared memory.  Ie. The getMove program will be instanced each turn and signal to the main, persistent executable by shared memory.
 
Is this within the rules?  It is a bit of a cludgy hack, but the only good way I feel a 'persistent' bot can be run while still conforming to the bot framework.

 
Yes, you can definitely do that. I prefer to use named pipes for interprocess communication, but shared memory also works.
IP Logged
omar
Forum Guru
*****



Arimaa player #2

   


Gender: male
Posts: 1003
Re: Shared Memory
« Reply #6 on: Apr 21st, 2008, 7:46pm »
Quote Quote Modify Modify

on Apr 18th, 2008, 1:39am, Polyfractal wrote:

To avoid creating a new thread, I'm curious what happens if a bot attempts to perform an illegal move.  Does the server reject it and return control to the bot?  Does the bot forfeit its move?  Is it just assumed that bots always perform legal moves?

 
As you discovered the game server checks the move and returns an error message if there is a problem with the move. However the current interface script doesn't do much if the move is rejected. It will get logged if you have logging turned on. I figured that if bot is making an illegal  move to begin with, it probably will not help to tell the bot the move was rejected. Of course you can modify the interface script a bit if you want that passed back.
IP Logged
Polyfractal
Forum Senior Member
****



Arimaa player #3241

   


Gender: male
Posts: 27
Re: Shared Memory
« Reply #7 on: Apr 21st, 2008, 11:41pm »
Quote Quote Modify Modify

Thanks for the reply.  I'm currently using simple state files on the hard drive to communicate between the two programs (for ease and speed of development) but I'll look into named pipes in the future.  My only concern is having to rewrite the named pipes class when I port from Windows to *nix.
 
Out of curiosity, if I modify the perl scripts to return error messages to the bot, will those modifications be viable in the bot championship?  Or will I have to revert back to the stock scripts?
IP Logged
omar
Forum Guru
*****



Arimaa player #2

   


Gender: male
Posts: 1003
Re: Shared Memory
« Reply #8 on: Apr 22nd, 2008, 9:53pm »
Quote Quote Modify Modify

on Apr 21st, 2008, 11:41pm, Polyfractal wrote:

Thanks for the reply.  I'm currently using simple state files on the hard drive to communicate between the two programs (for ease and speed of development) but I'll look into named pipes in the future.  My only concern is having to rewrite the named pipes class when I port from Windows to *nix.
 
Out of curiosity, if I modify the perl scripts to return error messages to the bot, will those modifications be viable in the bot championship?  Or will I have to revert back to the stock scripts?

 
I haven't used named pipes directly on Windows; you might want to experiment with it on both platforms before using it.
 
For the bot championship I provide the default bot scripts in the linux account, but you can login to the account and replace it with your own as long as they still provide the same command line interface. Also I could incorporate the changes you make into the default bot scripts and use those next year.
IP Logged
aaaa
Forum Guru
*****



Arimaa player #958

   


Posts: 768
Re: Shared Memory
« Reply #9 on: May 22nd, 2008, 1:23pm »
Quote Quote Modify Modify

I assume pondering will have to be turned off during the computer championships?
IP Logged
Janzert
Forum Guru
*****



Arimaa player #247

   


Gender: male
Posts: 1016
Re: Shared Memory
« Reply #10 on: May 22nd, 2008, 3:06pm »
Quote Quote Modify Modify

OpFor used pondering in this last CC.
 
Janzert
IP Logged
aaaa
Forum Guru
*****



Arimaa player #958

   


Posts: 768
Re: Shared Memory
« Reply #11 on: May 22nd, 2008, 3:29pm »
Quote Quote Modify Modify

Oh wait, I just saw the following on the rules page:
 
Quote:

Each program will run on it's own computer

Never mind then.
IP Logged
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print

« Previous topic | Next topic »

Arimaa Forum » Powered by YaBB 1 Gold - SP 1.3.1!
YaBB © 2000-2003. All Rights Reserved.