Has anyone been able to use Clojure with Robocode?
I've followed this http://www.fatvat.co.uk/2009/05/clojure-and-robocode.html
but got the error
Round 1 initializing..
Let the games begin!
java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:
39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:
27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at
net.sf.robocode.host.security.RobotClassLoader.createRobotInstance(RobotClassLoader.java:
272)
at
net.sf.robocode.host.proxies.HostingRobotProxy.loadRobotRound(HostingRobotProxy.java:
201)
at
net.sf.robocode.host.proxies.HostingRobotProxy.run(HostingRobotProxy.java:
242)
at java.lang.Thread.run(Thread.java:637)
Caused by: java.lang.NullPointerException
at clojure.lang.Var.setMeta(Var.java:179)
at clojure.lang.Var.internPrivate(Var.java:96)
at ubolonton.MyRobot.<clinit>(Unknown Source)
... 10 more
Thanks
On Mar 19, 7:56 am, ubolonton <ubolon...@gmail.com> wrote:
> Hi,
>
> Has anyone been able to use Clojure with Robocode?
> I've followed thishttp://www.fatvat.co.uk/2009/05/clojure-and-robocode.html
> Hi,
>
> Has anyone been able to use Clojure with Robocode?
> I've followed this http://www.fatvat.co.uk/2009/05/clojure-and-robocode.html
> but got the error
Hi,
I hope that in a week or two I am able to release a 'mini game' as a tech demo for something some friends and me are working on, if you're interested in Robocode you might like it. It will be a tournament game where two fleets fight each other. The user will be able to assemble the ships from different modules and script their AI giving them a high level of customizability. Let me know if you're interesting, I'll be offering a few beta logins on the list too :) (the game will be 100% free and open source (at least at some point), no advertising or anything).
Regards,
Heinz
(ns ubolonton.MyRobot
(:gen-class :extends robocode.Robot))
(defn -run
[robot]
(doto robot
(.ahead 100)
(.turnGunRight 360)
(.back 100))
(.turnGunRight 360)
(recur robot))
(defn -onScannedRobot
[robot event]
(doto robot
(.fire 1)))
It should be equivalent to this Java code
public class MyRobot extends Robot
{
public void run() {
while(true) {
ahead(100);
turnGunRight(360);
back(100);
turnGunRight(360);
}
}
public void onScannedRobot(ScannedRobotEvent e) {
fire(1);
}
}
I think Robocode uses ClassLoader to create instances of Robot, which
does not work with classes generated by gen-class
On Mar 20, 9:46 pm, "Heinz N. Gies" <he...@licenser.net> wrote:
> Hi,
> I hope that in a week or two I am able to release a 'mini game' as a tech demo for something some friends and me are working on, if you're interested in Robocode you might like it. It will be a tournament game where two fleets fight each other. The user will be able to assemble the ships from different modules and script their AI giving them a high level of customizability. Let me know if you're interesting, I'll be offering a few beta logins on the list too :) (the game will be 100% free and open source (at least at some point), no advertising or anything).
I'll be very interested if it's in Clojure :)
Hope this helps...
--
Nurullah Akkaya
http://nakkaya.com
On Mar 19, 10:56 am, ubolonton <ubolon...@gmail.com> wrote:
> Hi,
>
> Has anyone been able to use Clojure with Robocode?
> I've followed thishttp://www.fatvat.co.uk/2009/05/clojure-and-robocode.html
> but got the error
>
> Round 1 initializing..
> Let the games begin!
> java.lang.ExceptionInInitializerError
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
> at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAcce ssorImpl.java:
> 39)
> at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstru ctorAccessorImpl.java:
> 27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
> at java.lang.Class.newInstance0(Class.java:355)
> at java.lang.Class.newInstance(Class.java:308)
> at
> net.sf.robocode.host.security.RobotClassLoader.createRobotInstance(RobotCla ssLoader.java:
> 272)
> at
> net.sf.robocode.host.proxies.HostingRobotProxy.loadRobotRound(HostingRobotP roxy.java: