# Computing: Free Pascal Programming

 Programming Home Home Contact

## Logic number puzzle - Skyscrapers (Skyscrapers).

Description: Classic puzzle game with numbers to be placed onto a grid. The rules of the game (as used in the actual version of the application, as there are several variations of the puzzle with rule extensions or even different rules) are as follows:
1. The grid fields contain skygrapers, represented by a number, that indicates there relative height.
2. In each grid row and each grid column, a given height must occure exactly once.
3. The numbers at the borders indicate, how many skygrapers you can see, if you look from this point into a row or column.
4. A skygraper is only then visible, if all buildings in front of it are less in height.
The game is a typical logic game: In order to find the correct solution of the puzzle, you have to explore the clues given at the border of the grid and by logical thinking (concluding from what you know, that a given field must be a given number, or on the contrary, can't be a given number), determine, which number has to be written into which field. Examples: In a 5x5 grid, a "1" clue in a row column indicates, that the first field (seen from that point of view) necessarily is a "5"; in 4x4 grid, a "4" clue indicates, that this row/column must have fields in sequence 1,2,3,4.
Build from an old application, that I started in 2018, the GUI of "Skyscrapers" is completely different from the one of my other logic puzzle applications. The numbers have to be entered from the keyboard, non unique row/column values are rejected, there is the option to get hints and (for real beginners) to highlight fields, where the number entered equals the height of the building in the application's solution (which may not be the only one, thus, non-highlighted field not necessarily contain wrong numbers).

Possible extension: Variable number of clues displayed; 2 or more difficulty levels; choice between different sets of rules.

Free Pascal features: Changing the color of edit fields during execution. Enabling/disabling controls as needed. Two-dimensional arrays (classic Pascal).

Screenshot: