[Python] Elastiman
Roberto is a very famous game designer in the region where he lives for having released
some successful games, but he never really established a company. Two weeks ago,
Roberto came to you with his newest revolutionary game idea, Elastiman! Not knowing
who to call to help him develop, he turned to the nearest programmer, who happened to
be you. Your job in the first version of the game is to develop the part of the engine that
deals with gravity.
Input:
The first line of the entry contains an integer N. The next N lines will contain an N x N
matrix, describing the current scenario:
each '.' corresponds to an empty space;
each 'x' corresponds to a fixed block, which is not subject to gravity;
each 'o' corresponds to a movable block, which is subject to gravity.
Output:
Your program should print the screen after a cycle loop of the game, after the execution
of gravity. To simplify your life, consider gravity a force that only pulls one space down
per loop, not a physical force at all. Note that moving blocks cannot pass through fixed
blocks.
For example:
Input Result
3
?
XXX
XXX
3
0.
.0.
XXX
XXX