On Mar 19, 8:19 pm, Jeff Foster <[email protected]> wrote:
> Could you post the source code?
This is the Clojure code
(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
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
To unsubscribe from this group, send email to
clojure+unsubscribegooglegroups.com or reply to this email with the words
"REMOVE ME" as the subject.