[Edu-sig] using python/jython for educational game robocode
Jurgis Pralgauskis
jurgis.pralgauskis at gmail.com
Thu Sep 10 13:31:42 CEST 2009
hello,
finally I managed use python for http://robocode.sf.net
with the help of <jinq0123.at.163.com> I can run it on ubuntu 8.04 and 9.04.
* install jython2.2 (not 2.5)
* install robocode (1.7 was better for me than 1.6 in one aspect )
copy files to your robocode directory
ftp://ftp.akl.lt/users/jurgis/robocode/jython-OK/
you can straightforward try jy.Jymbo and jy.JymboWall
or update paths to your needs in .sh files
==== and go on ===
* write yourbot.py and put it in robots directory
there are several types of robots, for example
http://robocode.sourceforge.net/docs/robocode/robocode/Robot.html
when writing jython version, don't forget "self" keywords defining
your own methods or calling Robot methods ;)
* edit compyle-jy221.sh to your needs
(on win some path syntax canges are needed and name compile-jy221.bat)
- it adds robocode.jar to shell classpath before compilation to java
- and compiles using jythonc (indicating robot filename and package name)
* find the new .java and .class files
* make the appropriate .property file for your bot (not compulsory)
* call robocode-jython.sh (adds: 1) NoSecurity option and 2)
jython.jar in classpath )
ps.: with robocode 1.6 I had to restart the robocode before each battle,
or otherwise jython bot's didn't work..
1.7 didn't have this problem
ps.: still haven't tried to implement more complex robot actions...
just cloned MyFirstRobot and Wall
by the way, JymboWall acts a bit strangely -- when figuring its direction,
it usually is not perpendicular to walls :/
ok, waiting for your comments
--
Jurgis Pralgauskis
Don't worry, be happy and make things better ;)
http://kompiuterija.pasimokom.lt
More information about the Edu-sig
mailing list