Arimaa Forum (http://arimaa.com/arimaa/forum/cgi/YaBB.cgi)
Arimaa >> Bot Development >> Arimaa Client for AEI
(Message started by: rabbits on Feb 20th, 2010, 4:41pm)

Title: Arimaa Client for AEI
Post by rabbits on Feb 20th, 2010, 4:41pm
Here is a GUI for AEI: https://bitbucket.org/Rabbits/arimaa-client

Note that this project was originally hosted at https://launchpad.net/arimaa-client

The code isn't perfect, but it works.  Any feedback is welcome.

Title: Re: Arimaa Client for AEI
Post by tize on Feb 21st, 2010, 6:19am
It works very good, thank you very much.

I think it would be great if the pieces got autoselected by just moving the mouse over them, as in the gameroom. And I didn't get any sound. Other than that it is a very good first version, well done.

Now I really need to port marwin to aei so that I can play him and not just the random bot that comes with aei.

Title: Re: Arimaa Client for AEI
Post by jdb on Feb 21st, 2010, 7:48am
Very nice!

I also didn't get sound, but it looks great.

Title: Re: Arimaa Client for AEI
Post by rabbits on Feb 21st, 2010, 11:05am

Quote:
I think it would be great if the pieces got autoselected by just moving the mouse over them, as in the gameroom.

Good idea.  I'll see what I can do.


Quote:
I also didn't get sound

What operating systems are you two using?  I also have sound troubles sometimes in Ubuntu.  In my case, I think it's a pulseaudio issue that I work around using the padsp command.

I am using wx.Sound for sound right now.  Does anybody know a better way to do operating system independent sound in Python?

Title: Re: Arimaa Client for AEI
Post by jdb on Feb 21st, 2010, 1:31pm
I am using ubuntu. I have no idea about sound, so its likely my fault.

I hooked clueless up to it. Everything seemed to work fine.

Title: Re: Arimaa Client for AEI
Post by tize on Feb 22nd, 2010, 11:29am
I'm also using ubuntu, I tried with the padsp and it worked great, thanks.

Title: Re: Arimaa Client for AEI
Post by rabbits on Feb 23rd, 2010, 3:33pm
I added auto-selection.  I like it a lot better because fewer mouse clicks are required.  Thanks for the idea tize.


on 02/21/10 at 13:31:10, jdb wrote:
I have no idea about sound, so its likely my fault.

No, it's not your fault.  You shouldn't need to know anything about the sound setup.  Problems like this are exactly what scare people away from Linux.  I like to assume that it is either wxWidget's fault or PulseAudio's fault.

Title: Re: Arimaa Client for AEI
Post by jdb on Feb 25th, 2010, 6:46am

on 02/22/10 at 11:29:53, tize wrote:
I'm also using ubuntu, I tried with the padsp and it worked great, thanks.


How do I setup padsp? I'm running ubuntu but know next to nothing about installing things like that. Thanks.

Title: Re: Arimaa Client for AEI
Post by rabbits on Feb 25th, 2010, 7:49am

on 02/25/10 at 06:46:15, jdb wrote:
How do I setup padsp? I'm running ubuntu but know next to nothing about installing things like that. Thanks.

First, grab the package that contains padsp from the repositories.

Code:
sudo aptitude install pulseaudio-utils

Then, in your AEI config file, start the gui with padsp.

Code:
cmdline = padsp python ../arimaa-client/gui.py

Let us know if that helps.

Title: Re: Arimaa Client for AEI
Post by tize on Feb 25th, 2010, 11:14am

Quote:
I added auto-selection.

Thank you, it works great.

Title: Re: Arimaa Client for AEI
Post by jdb on Feb 25th, 2010, 12:32pm

on 02/25/10 at 07:49:21, rabbits wrote:
First, grab the package that contains padsp from the repositories.

Code:
sudo aptitude install pulseaudio-utils

Then, in your AEI config file, start the gui with padsp.

Code:
cmdline = padsp python ../arimaa-client/gui.py

Let us know if that helps.


Yes it worked.
Thanks, I never would have figured out to put padsp in the config file.

Title: Re: Arimaa Client for AEI
Post by 99of9 on Feb 25th, 2010, 4:29pm
Wow, this sounds fantastic.  This could be sufficient motivation to get me to switch to AEI next year!  Congrats rabbits, keep up the good work.

Title: Re: Arimaa Client for AEI
Post by rabbits on Mar 27th, 2010, 4:50pm
I just hacked a "proxy" feature into my GUI.  Basically, it lets you watch a game between bots with the GUI.

I also added a basic getmove adapter script.

Title: Re: Arimaa Client for AEI
Post by rajmahendra on Apr 17th, 2010, 4:28am
How to download ? sorry. i dont see any option!

Title: Re: Arimaa Client for AE.
Post by rbarreira on Apr 17th, 2010, 4:31am

on 04/17/10 at 04:28:44, rajmahendra wrote:
How to download ? sorry. i dont see any option!


I believe you can download the latest revision here:

http://bazaar.launchpad.net/~rabbits/arimaa-client/trunk/files/4

But maybe there's a better way, because this means downloading files individually?

Title: Re: Arimaa Client for AEI
Post by rabbits on May 20th, 2010, 6:30am
The client is meant to be fetched with the Bazaar http://bazaar.canonical.com revision control system.  Bazaar is multi-platform.  Once you have it installed, run the command

Code:
bzr branch lp:arimaa-client
to get a copy of the Arimaa client code.

You will have to have a copy of AEI to use the client.

The client itself should work fine on every OS too, but I am not sure if anyone has tried it in Windows yet.  Does anyone know for sure if it works in Windows?

Title: Re: Arimaa Client for AEI
Post by rbarreira on May 22nd, 2010, 3:51am
I keep getting errors like these on startup and every time I click:


Quote:
Number of rounds:  100
At timecontrol 3s/30s/100/60s/10m
Giving these settings to all bots:
hash: 50
Traceback (most recent call last):
 File "./gui.py", line 349, in OnPaint
   self.DoDrawing(dc)
 File "./gui.py", line 367, in DoDrawing
   piece = self.pieceAt(row, col)
 File "./gui.py", line 488, in pieceAt
   return self.position.piece_at(1 << (8*row+col))
AttributeError: 'Position' object has no attribute 'piece_at'
Traceback (most recent call last):
 File "./gui.py", line 275, in OnTimer
   if event.GetEventObject() == self.aeiTimer:     self.checkAEI()
 File "./gui.py", line 655, in checkAEI
   self.newgame()
 File "./gui.py", line 557, in newgame
   self.DoDrawing()
 File "./gui.py", line 367, in DoDrawing
   piece = self.pieceAt(row, col)
 File "./gui.py", line 488, in pieceAt
   return self.position.piece_at(1 << (8*row+col))
AttributeError: 'Position' object has no attribute 'piece_at'

Title: Re: Arimaa Client for AEI
Post by rabbits on May 23rd, 2010, 1:24pm
I haven't double checked, but I think that your problem comes from using an older version of AEI.  If you pull the latest AEI code, this error should go away.

Title: Re: Arimaa Client for AEI
Post by rbarreira on Aug 1st, 2010, 7:31am
After upgrading to AEI 1.1 it works indeed. Very nice!

The proxy feature is great, to watch the games while running tests between bots.

Title: Re: Arimaa Client for AEI
Post by moretti on Sep 9th, 2011, 5:05pm
I didn't want to start a new thread for this simple thing, but I created a ~30 lines of code add on for those using the Arimaa Client to play without an internet connection.

http://img20.imageshack.us/img20/2831/sampleht.png (http://imageshack.us/photo/my-images/20/sampleht.png/)

It basically starts roundrobin.py and opens a new tk window to let you select your opponent. This way you only create roundrobin.cfg once, and just use the selector to choose from the valid bots to play when you want a quick match and you don't have an internet connection.

It's a quick hack for those who like things simple and fast.

so:
just add all your bots to the global bots section in roundrobing.cfg
ie:

Code:
bots = human akimot OpFor2008 OpFor2009 OpFor2010 occam threaded_sample

(remember to add the arimaa-client as human in the bot list)

then modify roundrobin.py and find this line:

Code:
       else:
           print "Did not find a bot section for %s" % (bname)
           return 1

   start_time = time.time()


Change them to call to our selector window


Code:
       else:
           print "Did not find a bot section for %s" % (bname)
           return 1

   bots = human_match(bots)

   start_time = time.time()


and then, define human_match function (place it at the top of the file)

Code:
def human_match(bots):
   import Tkinter as tk
   import tkMessageBox as mBox
   master =tk.Tk()
   master.title('dc740')
   master.minsize(200,20)

   master.v = tk.StringVar()
   master.om = tk.OptionMenu ( master, master.v, [] )
   
   
   for bot in bots:
       if (bot['name'].lower() == 'human'):
           human = bot
       else:
           def myF(bot):
               master.selectedBot = bot
               master.v.set(bot['name'])
           master.om["menu"].add_command(label=bot['name'], command= lambda temp = bot: myF(temp) )
   
   def ok():
       if (master.v.get() != ""):
           bots = [ human , master.selectedBot ]
         master.retVal = bots
           master.quit()
           master.destroy()
       else:
           mBox.showerror("Bot selection error.", "Select a valid bot!")

   master.om["menu"].delete(0) # delete first element (basically the empty list used to create the optionMenu)

   
   label = tk.Label(master, text="Select a valid bot from the list:")
   button = tk.Button(master, text="OK", command=ok)

   label.pack()
   master.om.pack()
   button.pack()

   master.mainloop()

   return master.retVal


I've uploaded the full script and a sample configuration here:
http://www.multiupload.com/FE68Y44GCL

Title: Re: Arimaa Client for AEI
Post by Hippo on Mar 6th, 2012, 1:18am

on 09/09/11 at 17:05:20, moretti wrote:
I've uploaded the full script and a sample configuration here:
http://www.multiupload.com/FE68Y44GCL


Seems the link vanished.

I am fighting with ON_KEY_* events ... whenever I press a key with opened client, the client freezes. I were afraid it was caused by my code modification, but seems it was an issue of the original code.

Do anybody else have this problem or it's my local one?

It is particulary annoying when you add chat feature, but pressing a key frozes the client ... . I have problems with the layout as well. When I put the original "layout" into a panel, it stops receiving events. This is why I am stuck with vertical layout so far. I will post the code hoping someone familiar with wx and python is able to proceed.

Title: Re: Arimaa Client for AEI
Post by Hippo on Mar 6th, 2012, 1:32am

on 08/01/10 at 07:31:22, rbarreira wrote:
After upgrading to AEI 1.1 it works indeed. Very nice!

The proxy feature is great, to watch the games while running tests between bots.


Wow, seems I have missed it ... you could run two bots and proxy to watch them play? How is it achieved?

Title: Re: Arimaa Client for AEI
Post by rabbits on Mar 6th, 2012, 2:36pm
You can play a bot through the proxy by setting it up something like this in your roundrobin.cfg:

Code:
[BotHippoProxy]
cmdline = python ../arimaa-client/gui.py --proxy BotHippo

I'm not sure why your client freezes with ON_KEY events.. Is the code you're running posted anywhere?

Title: Re: Arimaa Client for AEI
Post by Hippo on Mar 6th, 2012, 5:25pm
Wow proxy works fine :) ... I was thinking why it parses the roundrobin.cfg :).

I have put the modified ... buggy version here:
http://hrosi.dyndns.org/arimaa/gui.py

compared to
http://hrosi.dyndns.org/arimaa/gui_ori.py

I have put chatting roundrobin here as well:
http://hrosi.dyndns.org/arimaa/roundrobin.py

As chatting gameroom aei:
http://hrosi.dyndns.org/arimaa/gameroom.py

Next time I will provide it with the directory listing ;)

Title: Re: Arimaa Client for AEI
Post by rabbits on Feb 26th, 2014, 12:20pm
I just moved the repository to BitBucket: https://bitbucket.org/Rabbits/arimaa-client

I originally chose LaunchPad to align with AEI.  Now that AEI is hosted on Github, well, I guess I could put this code there... but it's on BitBucket for now.

I intend to incorporate code in this thread (moretti's code and Hippo's fix) into the repository... Or someone else could do that for me...!  I'll accept pull requests or even grant write access if someone wants it.

Title: Re: Arimaa Client for AEI
Post by abstractius on Apr 13th, 2014, 8:42am
I am getting python gui.py
Traceback (most recent call last):
 File "gui.py", line 37, in <module>
   class ArimaaClient(wx.Frame):
 File "gui.py", line 38, in ArimaaClient
   GOLD_COLOR   = wx.Color(200, 175, 100)
AttributeError: 'module' object has no attribute 'Color'

It should be nothing serious :)

Title: Re: Arimaa Client for AEI
Post by harvestsnow on Apr 15th, 2014, 3:44am

on 04/13/14 at 08:42:23, abstractius wrote:
I am getting python gui.py
Traceback (most recent call last):
 File "gui.py", line 37, in <module>
   class ArimaaClient(wx.Frame):
 File "gui.py", line 38, in ArimaaClient
   GOLD_COLOR   = wx.Color(200, 175, 100)
AttributeError: 'module' object has no attribute 'Color'

It should be nothing serious :)


In gui.py, try adding after the license:

Code:
import wxversion
wxversion.select('2.8')



... or maybe after the imports:

Code:
wx.Color = wx.Colour
.
They changed the class name between two versions.



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