## Introduction

Many people will be familiar with the game Tetris and the 7 types of tetrominoes which must be hurriedly slotted together as they drop down the screen at increasing speed. Our game, tetrofit, also involves fitting these shapes; but calmly.

## Tetrofit Example

A screenshot from tetrofit showing the start of a game which uses all 7 tetromino types, plus 3 additional T types. The player must move and rotate the tetrominoes so that they exactly cover the upper grid.

Each puzzle presents the player with a set of tetromino shapes and a fixed rectangular grid. The given tetrominoes, if correctly positioned, will exacly cover the grid and the object of the game is to find such an arrangement. During play the tetrominoes are selected, moved and rotated using the mouse. Please refer to the first figure which shows the start of a game: the grid at the top and the tetrominoes below. This puzzle uses one of each type of tetromino (names I, J, L, O, S, T and Z) and three additional T tetrominoes.

As usual, the best way to learn about the game is by watching the worked example which shows two puzzles being solved.

## Playing

At the top of the display is a Toolbar. The jigsaw icon at the left is a menu which has options for calculating the number of solutions, for setting the grid width for external puzzles of 9 tetrominoes, setting the tetromino size, changing the colours and for saving the current settings. To the right of the jigsaw icon is a diamond shaped icon. A left click on this will randomly select a built-in puzzle for a new game, and a right click will choose the next puzzle. If you give up on solving the puzzle, a click on the sad smiley icon will show a solution. Puzzles of 9 tetrominoes can have two shapes: 6x6 and 9x4, hence the grid width option for external puzzles in the menu.

To the right of the sad smiley is an entry box. This can be used to select the number of a built-in puzzle or for entering a new puzzle by typing a list of the tetrominoes it contains using the symbols IJLOTSZ. In the latter case the program will choose the appropriate grid size. The allowed numbers of symbols are: 4, 6, 7, 8, 9 and 10. Finish puzzle numbers and sets of new puzzle symbols using the Enter key. Once a puzzle is selected or entered the program will try to find a solution. On a slow machine some puzzles can take a few seconds to solve, but for most puzzles it is instantaneous. (See the Worked Example in which a series of puzzles is clicked through by the player. The program is solving each of these before displaying its tetrominoes on the screen and the only delay is the player deciding whether or not to work on the puzzle.) If no solution exists a message box will pop up to report the fact. Note that at any time a puzzle can be restarted by hitting the Enter key.

Below the Toolbar are two rectangular grids. The top, called the target, is used to build the solution, and the lower is the source and contains the moveable tetrominoes. During the game the tetrominoes are moved using the mouse.
Grab a tetromino with the left mouse button. Drop it by releasing the button. Right clicking on one will rotate it 90 degrees.
Tetrominoes dropped in the source grid will immediately return to their starting slot. Those dropped **completely inside** the target grid will be snapped into alignment with the the nearest intersection of the grid.

There are 50 built-in puzzles for each of the grid sizes 5x4, 6x4, 7x4, 8x4, 6x6, 9x4 and 8x5. Within each 50 the puzzles are sorted in order of difficulty, hardest last.

## Tetrofit Worked Example

The worked example shows a player solving two puzzles. Notice how the tetrominoes snap into position in the target grid. First the player clicks through several of the built-in puzzles by right-clicking on the diamond shaped icon in the Toolbar, and then she settles on puzzle number 22. She could have selected it directly by entering its number into the Entry Box. The player picks up the Z tetromino (being the most awkward to fit). She holds it in several positions and orientations (right click for each 90 degree rotation) while trying to imagine the possible outcomes from each choice. By the time three tetrominoes are tentatively positioned it looks like she might have painted herself into a corner, but then she sees how to continue. And it is done, and the clock flashes its applause. Next she enters an external puzzle by typing the symbols for the tetrominoes into the Entry Box. This puzzle is finished quite quickly.

## Solution Counts

These puzzles do not have unique solutions; symmetry alone will provide alternatives. This may seem like a shortcoming, but we believe that players will still find the built-in puzzles sufficiently challenging.

Among other, less quantifiable factors, the difficulty of solving a puzzle of any given size depends on the number of solutions. The fewer the solutions the harder it is to find one. For those who are interested we have included an option in the menu for calculating the total number of solutions for each puzzle. We have already mentioned the impact of symmetry on the number of solutions, but those using this option should also be aware that the solving algorithm treats each tetromino as unique and this too increases the number of solutions.

Consider a puzzle which includes two tetrominoes of the same type. In any solution each of these tetrominoes will occupy one of two positions. To the player it does not matter which tetromino occupies which of the two positions: they both look the same, but to the solver the tetrominoes are distinguishable and it will produce a separate solution for each arrangement. Obviously the number of identical tetrominoes in a puzzle multiplies the number of ways they can be chosen.

To illustrate this we have found all solutions for the puzzle using symbols ZTTSL and they are shown below. Obviously there two pairs of symmetry-related solutions, but in the final figure we see though that the program reports 8 solutions, and this is because for each of the 4 solutions shown, each of the two T tetrominoes can be exchanged to create an alternative solution, making a total of 8.