Combinatorial Game Suite includes substantial support for loopy games with finite game graph. A loopy game is one that allows repeated positions. This section assumes familiarity with the theory of loopy games. The material on stoppers and sidling can be found in Winning Ways (Chapter 11 in Volume 2); a good reference for generalized thermography is "An Economist's View of Combinatorial Games" by E. Berlekamp (Games of No Chance).
You can enter loopy games directly into the worksheet, using colons to "name"
nodes on the graph. For example, a:{a|*}
specifies the game G
which is equal to {G|*}
. Readers familiar with loopy games
might recognize this as the game upon
. Other examples: a:{a|}
is the game on
, a:{a|a}
is dud
and
a:{1||a|0}
is a nanoko. Note that such expressions do not
assign a value to the variable a
. The name a
is
simply used as a temporary placeholder to refer back to a node in the game
graph. To assign the value upon
to the variable g
,
for example, you'd need to enter:
g := a:{a|*}
As a more complicated example, consider the following game, taken from Winning Ways:
A = {0|D}, B = {A|}, C = {A|B}, D = {C|}
The game C
could be entered as c:{a:{0||c|}||a|}
.
Recall that G
is a stopper if there is no infinite
alternating sequence of play proceeding from any subposition of G
.
Stoppers have canonical forms just like ordinary games (see Winning Ways), and
if you enter one into CGSuite, it will automatically put it in simplest form.
For example, try entering:
a:{0,a|*}
and note that Left's dominated option 0 is automatically eliminated.
Stopper simplification will automatically take effect after any calculations; for example:
on - 100
Note that the stoppers on
, off
, over
and under
are recognized as constants.
Loopy games will not be simplified automatically unless they are stoppers.
This is true even for games that are equivalent to stoppers. For
example, on + over
is equivalent to on
, but in the
form on + over
it is not a stopper. So if you type on + over
,
CGSuite will leave it in the form
a:{a,on|a}
(Note: Before version 0.6, all games were simplified automatically; this behavior changed in 0.6 to account for situations when it is desirable not to simplify loopy games.)
You can force CGSuite to simplify loopy games by sidling. Recall that the onside of G
is G
with all infinite plays redefined as wins for Left, and the offside of G
is G
with all infinite plays redefined as wins for Right.
Often the onside and offside of a game are equivalent to stoppers (and when they
are equal, the game itself is equivalent to a stopper). You can simplify
such games with the Sidle
command. If the onside and offside
of a game are stoppers, Sidle
will find and simplify them.
For example, Sidle(on+over)
will return simply on
.
Try sidling the example from above:
Sidle(c:{a:{0||c|}||a|})
and note that its onside is 3/2
and its offside is v
.
You can use the commands Onside
and Offside
to
calculate just one side of a game G
. Commands Upsum
, Downsum
and Degree
are also available with their usual meanings.
Finally: There are certain unusual games whose sides are not equivalent to stoppers. An example is Bach's Carousel (presented in Winning Ways, Chapter 11):
a:{0,{1|1,{*,{1*|1*,a}|*}}|0}
Such games will raise an error if you try to sidle them.
As of version 0.6, CGSuite supports extended thermography. For example, try the following:
g := a:{1||a|0};
Plot(Thermograph(g))
This gives the thermograph of the nanoko g
in the default environment: Left
is (Chinese) komaster. You can plot the same game in the Right komaster
environment as follows:
Plot(Thermograph(g : Environment := "RightKomaster"))
You can see them both on the same plot using the shorthand command:
KoPlot(g)
A more interesting example is the "thousand-year ko":
KoPlot(a:{0,c:{23||c|-10}|0,b:{24|b||-9}})
You can find a large number of example kos in the ko.cgs
script
located in the misc/examples
directory.
1. Write a script that creates functions club(n)
, diamond(n)
, heart(n)
,
and spade(n)
that generate the house of cards discussed in Winning
Ways, Chapter 11. Verify some of the identities given in that chapter.
(You can find a solution in the houseofcards.cgs
example script in
the misc/examples
directory.)