I. 161. Your task in this exercise is to simulate lightnings on the screen. The available display size is given as a command line parameter to your program (e.g. i161.exe 30 20 means 30 characters horizontally and 20 vertically). First you should fill the display area by random integers between 1 and 9. Then - by taking into account the three uppermost lines of the display - find the column(s) with the greatest sum of numbers: the lightning(s) will start from here. From the third line on, the lightning can propagate in three directions: horizontally, vertically, or diagonally down, by selecting the largest number from the appropriate neighbouring cell. (If there are more than one adjacent largest numbers, the lightning forks.) If it hits the (bottom or side) edge of the display area, the lighting discharges. Numbers along the path of the lightning should be changed to yellow. The example shows a 10×10 display area, now with letter ``V''s instead of yellow numbers.
The source code of your program (i161.pas, i161.cpp, ...) should be submitted.
Deadline expired on 15 June 2007.