UVa 114

From Algorithmist
Jump to navigation Jump to search

114 - Simulation Wizardry[edit]

Summary[edit]

Simulate a pinball game according to a set of rules.

Explanation[edit]

Simulate a pinball game according to a set of rules:

  1. If a ball hits a bumper or a wall, turn right 90 degrees.
    1. When a ball hits a bumper, add that the point value of the bumper, and subtract the life value.

Input[edit]

4 4
0
2
2 2 1 0
3 3 1 0
2 3 1 1
2 3 1 2
2 3 1 3
2 3 1 4
2 3 1 5

Output[edit]

0
0
1
2
2
5