A large portion of the code I've written is in Java, which I first started working with in 2000 at ThoughtWorks.
Kessel
Status: Version 0.2.0 - Just barely playable. Made the bots smarter from version 0.1.x.
The game mainly suffers from not being that fun yet. It's as much of an exercise as anything else, but
clearly it'd be nice to make something actually worthwhile. I'm still holding out hope that some levels
and general game-play tweaking can cause some big improvements. If not, the basic concept may need to be
seriously retooled.
Description:
Kessel is a game loosely based on George Lucas not knowing what a
Parsec
is. Nothing shameful
in and of itself, but perhaps he should have looked the word up before using it. Didn't he know that
millions of nerds would obesess over every line he was writing!?
In Star Wars, Han Solo answers doubts about the Millenium Falcon's speed by boasting that it once
made the Kessel Run in "less than 12 parsecs". I had heard that this mistake was later
retconned
by stating that the Kessel Run passed through a field of black holes, and so the fastest route was also
the shortest route through the gravity-warped
spacetime amongst said black holes.
Recently, I was looking at the "Advanced Java" track of cs11, whose main purpose was to write a game where a ship must pass through some number of target zones in as little time as possible. It occurred to me that a Kessel Run game might be kind of fun, or at least, fun to write.
The Game:
Some time ago, in a place where the physics weren't quite right, but most people didn't know enough to care:
Tang Mono was the most wanted smuggler in the galaxy, thanks to his ship, the Centurion Osprey, and a
wardrobe comprised mostly of chest hair and vests. Now you can relive his most famous exploit, the
Kessel Run, from the comfort of your home... no vests required.
Kessel is a torroidal piece of space riddled with black holes. The only reason to enter it, aside from a general interest in topology, is to harvest the bountiful cargo that passes through it. Kessel is constantly intersected by hyperspheres (due to something wacky in phyics I guess) from, lets say, some other dimension. Since the hyperspheres exist in higher dimensions, they're valuable. Yeah, that's the ticket.
Anyway... ships entering this 2D space can (somehow) pick up these things by running into them, and then get paid for them by passing through a drop zone. Some of the spheres can even be used to alter your ship. Ships can survive being sucked into a hole, but lose all their cargo, and must pay to be put back into the Kessel space. If this made any sense, you're probably high and should get a damn job...
Controls:
- UP ARROW: Fire's your ship's thrusters.
- LEFT ARROW: Turns your ship anti-clockwise.
- RIGHT ARROW: Turns your ship clockwise.
- SPACE BAR: Uses your most-recently picked-up cargo as an item, if that's possible. You do not get paid for used items, and item effects are erased if you are sucked into a hole.
How to play:
- Your ship (and the enemy bot ships) start in the drop zone and will be reset there if they come in contact with the center of a hole.
- Control your ship so as to pick up hyperspheres.
- Enter the drop zone to get paid for the hyperspheres.
- Your score bar (cyan) will grow with the amount in your bank. The first ship to have a full score bar wins.
- So far there are only two items, DOUBLE_THRUST and DOUBLE_RADIUS. Tip: Doubling your radius multiplies your mass by four, doubling your thrust multiplies the force it imparts by two, f = ma.
Source:
kessel_0.2.0_source.tar.gz
Jar file:
Run this as 'java -jar kessel.jar'
What's next?
- General code clean-up -- The game concept was in development as much as the code up to this point, so things are a bit messy. Some refactoring is definitely in order. The game might be a bit slow on slower machines, I'm certainly getting away with some things just because the game is somewhat simple. Some future version will be significantly optimized.
- Make it fun -- At this point, the game suffers from basically not being fun. Mainly, if there are enough black holes to be interesting, the game is just too hard. Dropping the size of the game arena, when there are less holes and slowing things down a bit could help this.
- Smarter bots -- BotContoller.java has some methods in it for bot AI that are now non-trivial. Tuning the variables for each bot with a genetic algorithm might be a good next step.
- Levels -- Clearly it'd be a lot more fun/easy to start with a smaller space, less bots, less holes, and then build up. Right now the numbers of all these things are quite arbitrary.
- More items -- Energy walls, bombs that create new holes, there's lots of things that can be done.
- Better graphics/sound -- There's no sound, and the graphics could use some animation in places, or just general prettying up.
- Network play -- As with many games, I imagine this would be much more fun when played against actual humans...
UpStream
Status: On hold since Aug 2005
Description:
Upstream is a tool designed to analyze
Omaha Hi-Lo Poker.
Omaha Hi-Lo is basically Texas Hold'em with four pocket cards instead of two, and where the best hand splits the pot with the worst hand. Due to this added complexity, there's not much information on how to play each of the 16,432 equivalency classes of four-card pockets.
Omaha is a good trap for Texas Hold'em players, who sit down and play like they're the only ones that got four cards. Given that, and since the little info that exists on how to play Omaha disagrees, the game seemed like a perfect target for statistical analysis.
UpStream was an ambitious summer project that was put on hold when school started up again. Since then, it's been sidelined by a lack of time and a lack or motivation, since most poker sites won't even take American money anymore. The original goal was to be able to make $20/hr while bouncing around various poor countries, so if I ever expatriate, it may be revived.
Source:
Below is the source and documentation for the backbone of the app. Basically just the
classes for modeling the game. They might be useful to anyone writing a poker app in Java.
The project progressed beyond this point, but it got kind of complicated and I'd like to keep
it under wraps in case the poker craze takes over again and I want to release it
UpStream.tar.gz
UpStream JavaDoc
Bezier Curves
Link to Applet:
Bezier Curve Applet
Description:
This was the first lab for cs175,
a CS/Applied Math class on B-splines. I didn't have time
to actually stick with the course, so this is about as far as I got. The applet
recursively approximates a Bezier curve
based on given control points using
Bernstein basis polynomials via
de Casteljau's algorithm.
The applet is easy to break because it was designed to show the application of the algorithm rather than to be used by the public. Somewhat interesting nonetheless.
Source:
Bezier.tar.gz
Reverse Missle Command
Link to Applet:
Reverse Missle Command
Description:
This was an extra-credit submission for the Missle Command lab in
CS2.
The assignment was to write the game logic for Missle Command.
Most of the model/view was written by the TA's, since the students weren't expected
to know Swing/AWT that well.
In standard Missle Command, bombs rain down on buildings and the player clicks on points on the screen to target missles to protect said buildings. The CS2 version has a power bar that is decreased by firing missles, and refills with time. The radius of the missle strikes is proportional to the current power.
The extra credit assigment was to somehow change the game creatively.
Reverse Missle Command:
- Bombs come straight down between the buildings.
- If a bomb contacts the ground, it causes a random building to grow some amount proportional to the bomb's speed.
- Player missles deflect bombs radially away from the missle strike, adding velocity proportional to the distance from the center of the strike
- If a bomb hits a building it will shrink proportionally to the deflected bomb's speed.
- The game is over when any building reaches the top of the screen