the ned net/ nedlog/ tags/ code

This feed contains pages in the "code" category.

vim QuickFix

vim QuickFix is a nice feature that figures out how you screwed up your code by looking at compiler errors. It repositions your cursor over the first offending line and will show you the other errors on demand.

By default, it's set up for C/C++, but it's easy enough to set up for Java if you're using Ant. Set your 'makeprg' to ant without logging adornments:

:set makeprg=ant\ -emacs

And make a mistake in your Java code. Run ':make', and vim will background while ant runs. When you return to vim, your cursor should be over the error and you can run ':cl' to see the other errors in the compilation. Cool.

You'll need to make sure that your current working directory contains the build.xml file; I do this by using vimproject.

Posted Thursday evening, July 5th, 2007 Tags: code software
Write your own Unreal Tournament Bot

One of the courses I'm taking this semester in the Computer Science department is "Artificial Intelligence and Computer Games," which deals with, naturally, applications of AI in computer games. We're using Unreal Tournament 2004 because it provides a rich, 3D environment with many possibilities and there exists a good set of supporting materials.

Gamebots is a modification that provides a generic socket-based, client-side API for controlling Unreal Tournament characters. JavaBot goes one step further and provides a Java framework for the Gamebots API and a nice front-end for managing multiple bots simultaneously.

Unfortunately, the JavaBot is very minimal; it takes care of parsing the messages from the server, but you're on your own to do things like keep track of health, nearby items, and other players. I wrote a superclass for the course that makes it easy to pick and choose which parts of the Gamebots API to implement and hides the grunt work of generic state updating. It's available for download and in darcs should you be interested. I'll be updating it throughout the semester.

Posted late Friday afternoon, February 2nd, 2007 Tags: bowdoin code programming