DWITE Online Computer Programming Contest
January 2010
Problem 3
Moving at the same time

Silly title, but this is exactly what this question addresses. There are too many questions on the CompSci.ca forums asking just that -- "I have 2 (or more) characters in my game, how do I move them both at the same time?" This should be obvious to some, and might sound more complicated than it is to others. Maybe the constrains of this question will provide a clue?

The input file DATA3.txt will contain 5 lines, each line will describe a game field and characters on it. The size of the field is the size of the line, 1 < = N < 20. Periods are empty spaces, while integers 0 < C <= 3 are Characters. The value of the integer represents that character's speed, in the direction to the right of where they are. Ones the character leaves the field, we are no longer concerned with that character. If two characters end up on the same spot, represent them as a sum of their velocities. In the initial input, all of the characters are distinct, and it is guaranteed that the overlapping sum is never greater than 9.

The judge is the observer of the game. Each output line is judge's perception of the game (that is, each output line is a frame of this game's FPS (frames per second)). If a character's velocity is 2, then in time from one frame to the next, that character moves 2 spots to the right.

The output file OUT3.txt will contain 5 sets of output, 5 lines each, the snapshots of the gamefield for each game as it progresses, starting with the input, and following with 4 frames.

Sample Input (first 2 shown):
Sample Output (first 2 shown):