On an nXm board there is a lemming on each square. Every second, the lemmings try to move either north, south, east or west, according to rules which are explained below. To determine which direction to move in, each lemming has an agenda, which is an ordering of the four possible directions (for example, one possible agenda might be NWES). The rules for lemming movement are the following:
Two lemmings which want to exchange squares can do so, unless of course some other lemming is trying to move into one of their two squares (in which case all three of the lemmings would stay in their current squares). Lemmings being lemmings, they continue to move until all of them have moved off the board. Determine how long that takes.
Enter board size in the applet: rows and columns, then hit "Play". A board appears. At every time step a square that has a lemming is colored red and the identity of the lemming and its agenda is shown in the square. To change agenda, edit the textfield and then click on any lemming's square whose agenda should be changed. Click on "Next" to move to the next time step. The "Count" field shows the current time step.