The Game of Greed.


Greed is an exceedingly boring game, yet it is well suited as a programming exercise. Tom Love gave it as a programming exercise for an OOPSLA-89 workshop. There were many submissions of working programs. (I had one of them based on role modeling. Tom has later reported that my program didn't work. That's wrong. It did work, but the user interface was too ugly for demonstration.) My current version is given here. It is based on DCI and written in Squeak/BabyIDE.

My program documentation is here: .PDF.

The rules are:

Greed is a dice game played by two or more players. The object of the game is to tally points
from the rolls of the die, and to be the first player to score 5000 points. There are five die
in the game, which are rolled from a cup.


To enter the game, a player must score at least 300 points on the first role of his turn,
otherwise the player is considered “bust.” If he goes “bust,” he must wait until his turn to
role again. If his first roll does produce 300 or more points, the player then has the option
of stopping, thus keeping the initial score, or continuing. To continue, the player rolls only
the die that have not yet scored in his turn. A player may continue rolling until all the dice
have scored, or until he is “bust.” With the exception of the entry roll, a “bust” is when an
individual roll produces no points. The player may stop and keep his score after any roll,
as long as he is not “bust.”


Each roll of the dice is tallied as follows:
Three of a kind score 100 x face value of one of the three die. If the three of a kind is 1s,
then it is scored as 1000. 22234 = 200 points; 43414 = 400 + 100 = 500 points.
Single 1s and 5s score 100 and 50 points, respectively.

The code can be read and run in BabyIDE. Informally, the code can be read at

reader-friendly version
printer-friendly version

There is a toggle for choosing between the versions at the top of the documents.