Seat Shuffle problem
There was an article in Makezine nr. 10 about a nutcase entering the plane first, regarding the subsequent odds that the last person gets the right seat.
I wrote a description of the problem in java. It allows you to observe how passengers board the plane in various random sequences. The answer provided by the Make magazine author seems to be correct. I was left to ponder the exact process of calculating the odds, though, so I wrote the program to help me visualize the problem.
To test, compile and run with different verbosility levels.
Default verbosity only lists the results. How many times the last passenger got the right seat.
-v1 lists only the last passenger's status.
-v2 lists passengers who got the wrong seat.
-v3 lists all passengers.
Here's the java code.