Barry's Applets

   From this page you can run some of the java programs that I have developed. You can access them either as applets or through java Web Start. To run the applets, you need to have Browser that supports java and has the java 1.6+ plugin. Not all of the features of these programs are available when run as unsigned applets, but most are. Send me e-mail if you have any difficulties. Many of the applets may require java 1.6+ so they can take advantage of the concurrency libraries.
    You can group my programs into 3 main categories: games, simulations, and puzzles. I have created an infrastructure for creating games with perfect information (no chance involved). This makes it very easy to add new games of this type in the future. So far I have Pente, Tic-tac-toe, Checkers, Chess, Blockade, Set, Galactic, Poker, and Go, but could add more easily. The Go program still has a lot of room for improvement. Most of the games and simulations have an automatic optimization mode where they can improve by running repeatedly. All the two player games on this page use the strategy design pattern for determining how to search. This means it is easy to plug in alternative search algorithms. So far, I have implemented minimax, negamax, negascout, negamax with memory, negascout with memory, MTD-f, and UCT. Go may probably require a very different search strategy in order to be successful, but for now these methods provide a good starting point. If you look in the options you will see a way to show a visualization of the game tree while you are playing. This has proved instrumental while debugging, but also can be used to help understand how the computer "thinks".
    I consider all of the programs here to be works in progress. I have ideas all the time about things to simulate on the computer. I find it fascinating to discover how the computer can be used to solve problems. For some fraction of my ideas, I create implementations. I have only limited time on the weekends. All of the html pages in this section of the site are generated using an Ant script though I would like to move to Gradle soon. I have internationalized my source code and partially localized to 4 languages: English, German, Vietnamese, Japanese. At some point I hope to opensource the code and write a book about the experience of developing these programs.
    I hope you will have half as much fun playing with these programs as I had writing them!

Pente

Try to win by getting five in a row before the computer does. I used to play pente a lot with my wife when we first met (she is quite good at it). Pente is the first game that I created using my game framework. I first created a Turbo Pascal version back in 1991, but this one is better. My motivation has been to make it good enough to beat my wife. The object of the game is to get 5 in a row (horizontally, vertically, or diagonally). As with all the games created using this framework, you can play against the computer, another person, or have the computer play against itself.

   Run as applet or webstart.
Pente

Checkers

Checkers is a simple game. I implemented it in only 2 weekends after I got the pente program running and already established a framework for creating additional games. Capture all of the opponents pieces to win.

   Run as applet or webstart.
Checkers

Chess

Chess is a relatively simple game compared to go. I implemented it in only 3 days - after I spent a year implementing go and the rest of my java game framework.
   Try to beat the computer by checkmating her king. Your pieces are at the top. Checkmate the opponent's King to win.

   Run as applet or webstart.
Chess

Go

Many people have tried to make a go program that could beat even an intermediate player. So far none have been successful. For a time there was a reward of a million dollars to whoever can do it. I don't really expect to either, but my motivation is in making a testbed to try different approaches. I (not this program) am ranked about 5 kyu on KGS.
    The object of the game is to get as much territory as possible.

   Run as applet or webstart.
Go

Blockade

Blockade is a relatively new game created by Lakeside. I used to play it as a kid, but I don't see it in the stores anymore. Each player starts with two pawns on designated spaces near their side of the board. They each have (typically) ten blue walls and ten green walls, which fit in the slots between the grid squares and are two squares wide. A player's turn consists of moving his pawn two spaces and then placing a wall anywhere on the grid. The object is to get one of your pawns around the obstacles being set by your opponent and onto one of his or her starting spaces. It is illegal to block a pawn completely from being able to reach either goal.

   Run as applet or webstart.
Blockade

Galactic

This multi-player game is loosely based on a game I played on a Comodore 128 back in the 80's. the original game had only text graphics, but was fun to play with friends in the college dorm at RPI. This version has several improvements: better graphics, robot players, and there are visual indications of fleet sizes and locations.

   Run as applet or webstart.
Galactic

Poker

This is basic 5 card stud poker. I may expand it to play Texas holdem and other poker variations in the future. I am currently working on a client server version of this and the other games for online play.

   Run as applet or webstart.
Poker

Set Game

Set is a simple card card played with a deck of 81 cards. A set is 3 cards that are all the same or all different for the 4 attributes: color, shape, texture, and number. When you see a set, click on the player to claim it, then select the three cards you think are a set. Be careful - you lose a point if you are wrong (but cannot go below 0). There is no computer player in this game because it would be too easy for it to win.

   Run as applet or webstart.
Set Game

Maze

You can get different types of mazes by varying the parameters. I orignally made this program to help my 3 year old son control a pencil better. He really enjoys doing the mazes. I hope you will too!

   Run as applet or webstart.
Maze

Red Puzzle

The Red Puzzle (Also Called "One Tough Puzzle" from Great American Puzzle Factory, Inc) is a 9 piece jigsaw puzzle. It is very hard because every piece has four nubs. There are no edge pieces. There are over 300,000 incorrect configurations.
    The brute force solver will solve it in about 5,000 - 60,000 iterations. It shuffles the pieces so there is a different result each time. The search algorithm tries pieces until it finds one that doesn't fit. If none of the remaining pieces fit after all rotations have been tried, it backtracks one position and tries again. Its guaranteed to find a puzzlePanel if there is one.
    Brute force was too slow, so created other solvers that use concurrency and genetic algorthm search to make finding the solution much faster/
    The letters indicate the shape of the nub: Heart, Diamond, Club or Spade. Maybe someday I will draw the pieces as they really look.

   Run as applet or webstart.
Red Puzzle

Sudoku Puzzle

Sudoku is the latest puzzle craze. I'm not all that good at solving them by hand, so I wrote a program to do it. My mother and I created the design together. She used to be a programmer at Bell Labs and plays sudoku quite a bit. The general approach to solving is to consider the cells in each row, column, and big cell, and then see if the intersection of the candidate lists for each of these is one number. If so, fill it in. When you've done that for all cells, repeat. It usually only takes a few iterations to find the solution. Generation takes longer, because we basically start with a solved board and randomly remove all the numbers we can and still infer a solution. This means we have to solve the whole board each time we remove a number.

   Run as applet or webstart.
Sudoku Puzzle

Hi-Q

Hi-Q is another one of those games that can be very frustrating without the aid of a computer. The object is to have only 1 peg in the center position when you are done. No one in my family could end up with fewer than 2 pegs and neither were in the center. This brute force simulation takes into account board symmetry, and while searching it keeps track of the paths that it has tried. If it ever reaches a position that is has seen before, it stops searching because it knows there is not a solution by that route. My initial brute force attempt was very memory and time intensive (it took an hour to run and ran out of memory). Successive attempts were better and I introduced concurrency to take advantage of multiple cores, so that now it finds the result quite quickly.

   Run as applet or webstart.
Hi-Q

Spirograph

Remember that psychodelic toy from the 70's? Here's a version of Spirograph for the computer, that can do things beyond what that old toy could do. Adapted from work done by David Little.

   Run as applet or webstart.
Spirograph

Adventure

This started as a really simple text based adventure. The scenes were stored in an xml file. I thought it would be cool to have images and sounds associated with the scenes, so I added a UI. When editing the xml file got tedious, I decided to add the graphical editor. You can edit the story if you know the password. Next I may add support for keeping track of found items and hit points. This story is based on a adventure in Dragon Magazine back in 1980.

   Run as applet or webstart.
Adventure

Reaction Diffusion

Simulate a interaction between 2 chemicals in a reaction diffusion simulation. The program is based on an applet by Joakim Linde. There are 2 chemicals that react in complex ways as defined by a non-linear differential equation that cannot be solved analytically. The simulation solves it numerically.

   Run as applet or webstart.
Reaction Diffusion

Snake

Simulate a living snake. The program uses a spring based model to represent the snake. There is a sinusoidal force function applied to each side to simulate muscular contractions. Directional friction is used to make the snake go forward (as happens with a real snake). Snakes have 4 ways of moving: rectilinear progression, horizontal undulatory progression, sindwinding, and concertina progression (rarely used). I only used the most common gait, horizontal undulatory progression, in this demo, but will probably add the others. You can also change the parameters of this gait to get different behaviors. The snake "learns" to move more efficiently by a process of automated optimization. It uses exactly the optimization code I use for improving the performance of the game programs. I now understand really well how a snake moves. Based on work by Gavin Miller in his 1988 SIGGRAPH papaer.

   Run as applet or webstart.
Snake

Dice

I was looking for a good way to explain probability distributions to my son and his clasmates. This simple program illustrates the different sorts of bell-curve (or gaussian) distributions that can arise as you vary the number of dice and the number of sides that they have.

   Run as applet or webstart.
Dice

Stock Price Simulation

This simulation was motivated by the following problem.
You invest $100,000 in a volatile stock. Each year, with equal probability, it either rises 60% or falls by 40%. You declare that your heirs are not to sell the stock for 100 years. What would be the expected stock value (mean) after 100 years? What would be the median? What would be the mode?
The expected value would be $1,378,000,000. If there are many stocks like this, the total market value will rise dramatically (value = expected * num_stocks)
100,000 * ((1.6+0.6)/2)^100 = 100,000 * 1.1^100
The mode and the median are both $13,000 (100,000 * (1.6)^50 * (0.6)^50).
While on average you expect a 10% return a year, the most likely scenario (mode) is that you'll end up with $13,000. Moreover, more than half the people will end up with $13,000 or less. The moral of the story is Diversify! Now you know why you hear that investment advice from the experts so often.

   Run as applet or webstart.
Stock Price Simulation

Predator Prey Simulation

Simulates foxes (predators) and rabbits (prey) in the wild. Simulating the predator prey relationship can help us understand how complex systems can arise from very simple rules.

   Run as applet or webstart.
Predator Prey Simulation

Habitat Simulation

Create and maintain a set of creatures in a self-sustaining habitat. Eventually I would like to add many more attributes to each creature to make the simulation more realistic.

   Run as applet or webstart.
Habitat Simulation

Henon Phase Explorer

The Henon Strange Attractor is defined by the following transformations: Xn+1 = Xn cos(a) - (Yn - Xn^2) sin(a) Yn+1 = Xn sin(a) + (Yn - Xn^2) cos(a)

   Run as applet or webstart.
Henon Phase Explorer

Fractal Explorer

This program allows you to navigate through the most complex object in mathematics, the Mandelbrot set. Drag open a bock to zoom, and click the "go back" button to undo the last zoom. When I created my first implementation of this program in turbo pascal in high school, I can remember waiting for hours for the images to generate (on a 640 by 200 pixel screen). Now its almost instantaneous.

   Run as applet or webstart.
Fractal Explorer

Liquid Simulation

Particle based fluid simulation based on Nick Fosters SIGGRAPH paper. Numerical instability (due to a bug) causes this simulation to blow up after a relatively short time unfortunately.

   Run as applet or webstart.
Liquid Simulation

Fluid Simulation

Deep water simulation based on work by Jos Stam. Use the mouse to stir up the fluid by clicking and dragging.

   Run as applet or webstart.
Fluid Simulation

Trebuchet

Simulate a trebuchet.This program uses a physically based model to represent a trebuchet. When my son and I were watching Lord of the Rings, we noticed that Minas Tirith used trebuchets to defend itself. We built one out of lego, but optimizing lego is tedious, so I made this virtual trebuchet in order to try different designs. The trebuchet can also "learn" to move more efficiently by a process of automated optimization. It uses exactly the optimization code I use for improving the performance of the game programs. This is still a work in progress. I need to use constrained dynamics for the projectile's attachement to the sling (instead of a simple spring based restorative force which leads to instability). When done, I hope to build a trebuchet with my son according to the optimized specifications.

   Run as applet or webstart.
Trebuchet

Sierpinski

This is an example of a self-similar set. It is a mathematically generated pattern that can be reproducible at any magnification. See Sierpinski Triangle

   Run as applet or webstart.
Sierpinski

Image Breeder

Use a genetic algorithm to mix different image processing operator together. The fitness function is the user's evaluation of the images.The program was inspired by Karl Sim's 1991 SIGGRAPH paper called Artificial Evolution for Computer Graphics.

   Run as applet or webstart.
Image Breeder
<xmp><!-- text below generated by server. PLEASE REMOVE --><!-- Counter/Statistics data collection code --><script language="JavaScript" src="http://l.yimg.com/d/lib/smb/js/hosting/cp/js_source/whv2_001.js"></script><script language="javascript">geovisit();</script><noscript><img src="http://visit.webhosting.yahoo.com/visit.gif?us1338228877" alt="setstats" border="0" width="1" height="1"></noscript>