Well it took me a few tries, but I finally managed to get a successful Skull Bowl printed. Next up, trying to make it in to bank. I’ve got a good idea of how to proceed, I just have to actually get around to it.
Winning Games
Aside
My bot is doing surprisingly well. It is currently the highest rated Clojure bot, and is ranked a little below 850th out of ~5700. I’m a hair under the 15th percentile.
Ants Gain Courage, Film at 11
I’ve uploaded a new version of my bot to the AI Challenge site. My bot was, I believe, the 10th best Clojure bot before I updated my code and wiped out my rating. The new code probably won’t play it’s first game until early tomorrow morning. I put in a fix for the possible issue of my ants failing to defend their hills, giving my ants courage when they could see one of my hills.
The problem with ants getting trapped that I mentioned before actually bit me. In my bot’s 5th game, it’s first move was into such a corner. As a result, it did precisely nothing the entire match, until an enemy ant kindly came along and wiped me out.
At least that’s fixed now. New intelligence rating: very tired toddler.
My MadCat
I really loved the MechWarrior series. Thanks to Pipakin’s MadCat Mech on Thingiverse, I now have my very own.
AI Design Flaw
Aside
My bot has played two more games, and legitimately won both. But while I was thinking last night I came up with a bad realization: since my bot runs from enemy ants, it would run away from protecting the hills. This could allow a single ant to capture a hill that had lots of ants around it.
This hasn’t happened yet. I’d better put a fix in before it does.
My AI Challenge Ants are Alive
My entry for Google’s Fall 2011 AI Challenge has been posted. In it’s first game it pulled out a decisive victory, in that it was gathering food but none of the other bots were. Still, it’s up there.
Current intelligence rating: badly sleep deprived toddler.
Right now, the logic is pretty simple. For each ant it works through a list of objectives, making the first move that an objective returns. It tries to raze opponent’s hills and gather food, all while running away from enemies. If it can’t do either of those, it will basically make a random move. There is code to prevent the ants from cycling between two squares, but it has an unintended consequence. The ants aren’t allowed to go back to the last square they were on. The leads to ants trapped on little islands surrounded by water (there are five such trapped ants in the shot above).
On the whole it works well. Since my colony spends so much time gathering food, it grows fast. The cowering I built into them helps keep them alive, and the random walking combined with the food seeking provides some exploration. In the end, the colony can grow pretty large and they tend to stay clumped up. I’d imagine I’m no match for the good bots, but I should be able to survive OK.
As I post this, there are only 25 Clojure based bots. I’m hoping to make a good showing on the list. That’s my main goal.
Print Your Own Monkey Cage
Do you have a stuffed monkey who is always causing trouble? Do you have a 3D printer? Well thanks to my latest item on Thingiverse, you can easily keep him corralled. With a gate that slides open for easy access, you’ll still be able to take him out to show off to friends at parties.
Trying AI Challenge Fall 2011 with Clojure
About two weeks ago a post popped up on Reddit that the fall 2011 Google AI Challenge had opened. This time, you command your own little ant army in an attempt to beat out the other colonies on the map through attrition (total or partial). I’ve been interested in Lisp and functional programming for a few years now, with a special eye towards Clojure. My interested had been rekindled after reading Writing Tetris in Clojure, and once I saw that Clojure was a first class citizen in the content I was off.
I don’t think Clojure 1.2 was out the last time I played with it, so there are some small changes to the language. I’ve been using the La Clojure plugin for IntelliJ as my IDE, and I’m trying to learn the Leiningen tool for Clojure project management. To top it off all, I’m using git instead of SVN to keep my changes. This means I’m learning quite a bit, but things aren’t perfect.
La Clojure doesn’t know anything about Leiningen, and I had to search for a while to find a good tutorial on Leiningen. Most seem to be in the form “Download, run this command, you’re all set”. That doesn’t give you much information. The blog entry I finally found was more useful, but I lost the link (it’s somewhere in my history).
Debugging Clojure is just as frustrating as I remember it. There is no debugger, you’re basically on your own. You can try to use a Java debugger, but that makes little sense. There is a package of macros for Clojure that is supposed to make things a little better, but I haven’t used it yet. This is all complicated by the fact that the AI Challenge tools run your program for you in a little sandbox, so I’m not even spawning the process. I’ve fallen back to the tried-and-true method of printing out values I’m interested in, which isn’t ideal. Leiningen supports running tests, so as I’m starting to get a grip on my program I’m going to have try writing some soon.
I took the Clojure starter bot and split it out into a couple of files to help me keep the code organized. At this point, each ant moves towards the closest piece of food, or randomly if it can’t move in that direction. The ants aren’t intelligent and they like to run into each other. But I’m making progress. It took me quite a while to sort things into files, but only an hour or two to do some additional refactoring and add the basic food seeking.
But still stymie me though. The other day I was stuck with my program just exiting after the setup phase. There was no error message, it would just quit. It came down to some changes I made to the code. I took a piece of code that look like this:
(loop [blah blah] (if (test? program-exiting-condition) (do-something-and-return) (more-calculations-and-recur)))
and I removed the part I didn’t need, the (do-something-and-return), replacing it with a comment to put code there later. This effectively turned the code into this:
(loop [blah blah] (if (test? program-exiting-condition) (more-calculations-and-recur) )); Fall through and exit program
That took me way too long to find. Once I figured out where the problem was, it took me a few minutes to get back into the Clojure mindset and remember that wouldn’t work.
Kitten Model on Thingiverse
Aside
Plywood Air Filter on Thingiverse
Aside
I’ve got a new object up on Thingiverse, it’s my Plywood Air Filter. I’ve been using it for a while now and it’s much better than my hacked together duct tape and cardboard mess that it replaced.

