Tetris: Win or lose

In a very recent section the topic of providing a demo mode for the computer game of tetris is treated, assuming the falling shapes are random. This page shows how to select the falling shapes so as to help or hinder the (computer) player.

The new shape generator routine simply chooses some of the shapes so that their penalty scores are maximised; inevitably the games become slower. If a high level of difficulty is set, all games will be lost of course, as the selector and placement routines assess positioning of shapes in the same manner. Here is the required program patch- the modified newShape procedure.

A minor modification will cause the program to win more games, but this is not interesting, unless some shapes are allowed to land randomly at the beginning, since most games are won as it is, anyway.

The exercise would have been made far more interesting if the distribution of falling shapes had to be more or less uniform. The present version does not bother about that. 1