Contest Rules:
2-3 people form a team, there should be at least 3 teams to participate.
Phase 1: each team writes a program to print out the drunkard's location after he passes 100 intersections. Teams will submit code to the judge for verifying and testing after they finish. If a program does not pick directions randomly, the team will be disqualified.
Phase 2: once each team's program is verified, the contest begins. The regular season will consist of 10 rounds. Each team runs their program once in a round. Teams that have the drunkard go the farthest in odd rounds will gain 10 points, but teams that have the drunkard go the farthest in even rounds will lose 5 points. Each team starts from 100 points. The team who ends up with the most points wins the regular season!
Phase 3: Modify each regular season players to implement the bonus question if time allows. These new programs will run in the final. The final has 5 rounds, in which the regular season winning team is the drunkard. If a team other than the regular season winners sends the drunkard into the ocean, this team win the final! If the regular season winning team falls into the ocean, they die and there is no winner. If no team sends the drunkard into the ocean within 5 rounds, the regular season winning team is the final winner!
Program:
A drunkard walks out of a bar in San Francisco as shown below. He randomly picks one of four directions and stumbles to the next intersection, then again randomly picks one of four directions, and so on. You might think that on average the drunkard doesn’t move very far because the choices cancel each other out, but that is not the case. Represent locations as integer pairs (x, y). Implement the drunkard’s walk over 100 intersections, starting at (0, 0), and print his ending location.
Bonus: if the drunkard is 20 blocks from the north coast and 30 blocks from the east coast, decide if he will fall into the ocean after passing 100 intersections and print his fate.