## Introduction

Skyscrapers is another logic game which, like Sudoku, is based around Latin squares.

A Latin square is an n × n grid filled with n different symbols, each occurring exactly once in each row and exactly once in each column. For this game the symbols are the numbers 1 to n and the name derives from imagining that the grid is an n x n block of skyscrapers and that the numbers represent their heights. The lowest is of height 1 and the highest is of height n. The final idea is that the numbers (clues) shown at the ends of some of the strips (rows and columns) define the number of skyscrapers which can be seen from their vantage points. These clues can help the player to work out the arrangements of the numbers in each row and column. For example a clue of 1 in a 5 x 5 grid means that the corresponding row or column must have a 5 in the first position because only a five story skyscraper can block all the others from view. Also, as the puzzles are Latin Squares, the list of applicable solving methods includes, perhaps more familiar algorithms, such as Hidden Single and Naked Pairs. In summary, Skyscrapers has a nice combination of algorithms with the added interest of trying to visualise the grid in 3D.

## Skyscrapers Example

A screenshot from skyscrapers. It shows a 5 x 5 grid near the beginning of a game with only one answer filled in. Most of the cells in the grid still contain the full complement of tiny digits 1 to 5 which are buttons the player can use to delete or set possible answers. One of these, a 5, has a red background indicating that the player has requested a hint and the program has worked out that the 5 can be deleted. The "2R" at the top of the window means that Algorithm 2, operating rightwards has provided this hint. The large digits around the periphery of the grid are the clues showing how many skyscrapers can be seen along their row or column.

## Playing

The object of the games is to work out how the numbers can be arranged so that each occurs exactly once in every row and column and that they are in agreement with the clues. The possible answers (candidates) are written in the cells. These numbers are buttons: left-clicking will delete a candidate, middle-clicking on its position will rewrite it, right-clicking will set it as the answer and delete any other candidates present.

The program starts with a randomly selected puzzle displayed. In the toolbar the jigsaw symbol contains a menu, the next symbol starts a new game; the wand requests a hint, a second click on the wand will perform the hint operation; the thumb checks if the puzzle contains any errors and a second click will clear the errors; the sad smiley shows the solution; the entrybox shows the current puzzle number and can be used to select a new puzzle number; the number next to the puzzle number is the puzzle difficulty score. The clock ticks every 5 seconds but will be replaced by the algorithm code if a hint is requested. A left click on the hint button will request a hint. While the hint is active (shown by the wand icon leaning leftwards) clicking on the wand with the middle mouse button will cause a pop-up to appear containing a short explanation of the hint. Hints are shown by highlighting the candidates that can be deleted in red. A further left click will delete the red candidates. The program contains 1500 puzzles: 500 each of sizes 4, 5 and 6, sorted in order of difficulty.

## Skyscrapers Worked Example

A video from skyscrapers showing a slow solution to a 4 x 4 puzzle, with a bit of finger trouble towards the end: it's important to use the correct mouse button! The puzzle is selected by entering its number into the box and typing "Enter". The player immediately sees that the strip with clue 1 must have a 4 in the first position to block the rest of the strip. She then deletes the other 4s in the two strips. The strips with clue 3 cannot have the two highest values in the first position, so they get deleted next. The player clicks on the thumb icon to check that no errors have been made so far, and then has a long think. At last there is some action when it becomes obvious that the third position in a strip must contain a 4. Then the finger trouble starts. I'm sure the player meant to set the solution as 3, but by clicking the wrong mouse button she deletes the 3 and is so shocked when her error check brings up a red, that she forgets what she was thinking. To recover her wits she uses the hint button and eventually gets a 3 in the first position. A bit later we see a hidden single used to set a 4 in a clueless strip. Later still there's a long pointless pause followed by more finger trouble. Where do we find these people! At least she demonstrates how deleted candidates can be resurrected; and we should be grateful it was only 4 x 4.

## Algorithms

The algorithms used by Skyscrapers are explained using examples. Candidates highlighted in red can be removed. In the descriptions the term **size** is the size of the Latin Square, equivalent to the **n** used in the Introduction.

The algorithms are named Alg_0 to Alg_14. They are applied to rows or columns (strips) in given directions. When hints are requested the program displays the algorithm name and the direction in which it has been applied (Down (D), Up (U), Right (R) and (Left (L). So for example 7R means that algorithm Alg_7 has been applied rightwards along the row containing the candiates marked for deletion; 11U means algorithm 11 has been applied upwards.

## Alg_0

Alg_0, Exclusion rule: only one of each digit can occur in any strip, so once an answer is set all other occurrences of that digit in the same strip can be deleted.

## Alg_3

Alg_3: For clue 2 with the lowest value at position 1, the highest value must be at position 2.

## Alg_6

Alg_6 Hidden single: all strips must contain exactly one of each of the digits; if a cell contains the only remaining copy of a digit in a strip, that digit must be the answer for that cell, and any other digits in that cell can be deleted.

## Alg_9

Alg_9: For clue 2 with the highest value on the opposite edge, the next highest must be in position 1.

## Alg_11

Alg_11: For clue size - 1 and size > 4, the highest and next highest cannot be in positions 1 and 2, and 3 cannot be in position 1. If size is 4, only the first position is affected.

## Alg_12

Alg_12 Hidden pairs: all strips must contain exactly one of each of the digits; if a pair of cells contain the only copies of two digits in a strip, those digits must be the answers for the two cells, and any other digits in those cells can be deleted. Here 4 and 5, or 5 and 4 must be the solutions for the 3rd and 4th rows of this strip, so no other values can occupy those cells.

## Alg_13

Alg_13 Naked pairs: all strips must contain exactly one of each of the digits; if a pair of cells each contain only the same two digits those digits must be the answers for the two cells, and any other occurrences of those digits in the corresponding strip can be deleted. Here 1 and 2, or 2 and 1 must be the solutions for the top two rows of this column, so cannot occupy any other cells.