File: atom4.6

package info (click to toggle)
atom4 4.1-9
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 836 kB
  • ctags: 1,222
  • sloc: cpp: 4,451; makefile: 46; perl: 6
file content (271 lines) | stat: -rw-r--r-- 12,732 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
.TH ATOM4 6
.\" Atom-4 manual page.
.\" Just because Debian requires one. :-)
.SH NAME
atom4 \- two-player color puzzle game
.SH SYNOPSIS
.B atom4
[ \fB-a \fR\fIn\fR ]
[ \fB-d \fR\fIlevel\fR ]
[ \fB-mt\fR | \fB-mx\fR ]
.br
.B atom4 -h
.SH DESCRIPTION
Atom-4 is a two-player color manipulation game played with colored spherical
pieces on a board divided into equilateral triangles. The player who first
makes a row of 4 pieces of the right color wins.
.PP
There is an AI mode where you play against the computer. By default,
.B atom4
runs in 2-player mode. Since 2-player mode is controlled from the same
terminal, it can be used as a "practice" mode to acquiant oneself with
the color change rules or to explore strategic possibilities in a controlled
way.
.PP
.B atom4
supports both a curses-based text interface and an X11 interface. The
interface can be selected with the
.B -m
option. By default,
.B atom4
launches the X11 interface if the
.B $DISPLAY
environment variable is set, and the curses-based interface otherwise.
.SH OPTIONS
.TP
.B -a \fIn\fR
Play against AI player.  \fIn\fR must be either 1 or 2, specifying which
player the AI will be.
.TP
.B -d \fIn\fR
Set AI player's difficulty level, where
.I n
is an integer from 0 or larger. The default difficulty setting is 2. This
version of Atom-4 uses a real min-max algorithm; higher difficulty settings
are actually much harder unlike in the previous version. However, be warned
that very high difficulty settings will likely be very slow, as the game
tree grows very quickly.
.TP
.B -h
Shows a summary of command-line options that
.B atom4
takes.
.TP
.B -mt
Selects the text (curses-based) interface. The curses-based interface requires
a terminal with color capabilities; at least 9 colors are needed.
.TP
.B -mx
Selects the X11 interface. The X11 interface requires an X display that
supports at least 8-bit color. Note that currently,
.B atom4
will always connect to the X server specified in the
.B $DISPLAY
environment variable.
.SH TEXT MODE INTERFACE
The text mode interface requires a terminal that supports at least 9 colors.
.PP
The game controls are straightforward: the keypad arrow keys move the cursor
around the board, and the Enter key or the Space key will place the piece
being played on the board. The panel on the right shows you which piece is
currently being played. Gameplay proceeds until one of the players win.
.PP
You can press
.B q
at any time to quit the game.
.PP
After one of the players win, the game will pause. You can either press
.B n
to proceed to the next round, or
.B q
to quit.
.SH X11 INTERFACE
The X11 interface requires an X display which has at least 8-bit color.
.PP
Gameplay on the X11 interface is simple: the color wheel in the right panel
shows the order in which pieces are played, as well as the current player
(number in the center). The current piece being played is highlighted in the
color wheel. To play the piece, simply locate your mouse over the desired spot
on the board and click the mouse button.
.PP
When it is your turn to play, and your mouse hovers over a legal position
where you can place a piece, the piece you are currently playing will appear
under the mouse cursor. It is not actually placed on the board until you click
the mouse button.
.PP
At any time during the game, you may press
.B q
to quit the game.
.PP
After one of the players win, press
.B n
to proceed to the next round.
.SH GAME RULES
(Adapted from the README file.)
.PP
Pieces may be placed only on the vertices of the triangular game board
divisions, and only if touching two other pieces which themselves are adjacent
to each other (i.e., it must form an equilateral triangle with two adjacent
pieces already on the board). Theoretically, the board is unlimited in size;
practically, we limit it to 16 vertices across and 16 rows down.
.PP
Pieces have 8 different colors in total, grouped into 4 groups:

 - black
 - red, green, and blue (the primary, or "additive", colors)
 - yellow, cyan, and purple (the secondary, or "subtractive", colors)
 - white

Black and white are also called "propagators" (explained below).
.PP
The first player plays additive colors, and must make a row of 4 whites. White
is the "goal piece" of the first player.  Similarly, the second player plays
subtractive colors, and must make a row of 4 blacks. Black is the "goal piece"
of the second player. 
.PP
Since neither player can play their goal pieces directly, they need to combine
the colors they play in order to form their goal pieces on the game board,
indirectly. Whenever an additive or subtractive piece is put on the board, it
changes the color of pieces surrounding it. The color changes are illustrated
by the following color wheel:

                      red   yellow
                         \\ /
                 purple --*-- green
                         / \\
                     blue   cyan

.HP
1) If the neighbouring piece has an adjacent color on the wheel, it does not
change. For example, if red is placed next to yellow or purple, the yellow
or purple remains the same.
.HP
2) If the neighbouring piece has a color 60 degrees away on the wheel, then
it changes to the color in between. For example, if red is placed next to
green, the green turns into a yellow. If a red is placed next to a blue,
the blue turns purple.
.HP
3) If the neighbouring piece has the opposite color on the wheel, then it
changes to either white or black, depending on what type of color the new
piece is. If the new piece is an additive piece, the neighbour becomes
white; if it is a subtractive piece, the neighbour becomes black. For
example, if a red is placed next to a cyan, the cyan turns white; but if
a cyan is placed next to the red, the red turns black.
.HP
4) If the new piece is additive and the neighbouring piece is black, then the
black changes to the same color as the new piece. Similarly, if the new
piece is subtractive and the neighbouring piece is white, then the white
changes to the same color as the new piece.
.HP
5) If the new piece is additive and the neighbouring piece is white, then the
white does not change, but the color change effect "propagates" through the
white to the piece behind the white. That piece then changes as though the
new piece had been placed next to it. If it is also white, then the effect
continues propagating in the same direction, in a straight line, until it
reaches a non-white piece, and then changes that non-white piece as though
the new piece was placed next to it. If an empty spot is reached before a
non-white piece, then nothing happens. Because of this effect, white pieces
are also called "additive propagators".
.HP
6) Similarly, if the new piece is subtractive and the neighbouring piece is
black, the color change effect propagates in the direction of the black
until it reaches a non-black piece, which then changes as though the new
piece had been placed next to it. Nothing happens if an empty spot is
reached before a non-black piece. Hence, black pieces are also called
"subtractive propagators".
.PP
(Another way to understand the color changes is treat colors as red, green,
and blue combinations. Additive colors always try to "add" themselves to their
neighbours: red + green = yellow (red & green together); red + cyan (green &
blue) = white. Subtractive colors try to remove their complement color from
their neighbours. For example, the complement of yellow (red & green) is blue;
so yellow tries to remove blue from its neighbours. Hence, when yellow (red &
green) is placed next to cyan (green & blue), the cyan turns green (loses the
blue component). Similarly, when cyan (green & blue) is placed next to white
(red & green & blue), it removes its complement, red, from the white; so the
white becomes cyan as well. In other words, additive colors behave like
colored light, whilst subtractive colors behave like colored paint.)
.PP
The initial state of the board consists of two pieces, green and purple, in
the middle of the board, touching each other. The first player then plays a
red, the second player plays a yellow, and then the first player plays a
green, and so on, taking turns, going clockwise around the color wheel. The
first person to make a row of 4 propagators wins.
.PP
If the game is played in multiple rounds, the second player may start first on
the second round, using a subtractive piece, and then the first player with
the next color clockwise on the color wheel, and so on. The starting
configuration always consists of two pieces, one 30 degrees counterclockwise
from the starting color on the color wheel, and the other 60 degrees
clockwise; each touching the other in the center of the board.
.SH GAME STRATEGY CONSIDERATIONS
Notice that in order to get from additive colors to white, the first player
must form secondary colors and then add their complements; but the second
player already plays secondary colors. So the first player can make use of
the pieces played by the second player to make whites, which is faster than
building whites from scratch. Similarly, the second player plays subtractive
pieces and must first form primary colors and then add the complements to
make black; but the first player already plays primary colors, which can be
exploited to make blacks.
.PP
This also means that when playing a piece, one should be careful not to
give too much advantage to the other player by providing material to make
propagators (black or white).
.PP
Propagators (blacks or whites) are useful for changing colors of pieces
already blocked from direct access because they are surrounded by other
pieces. Using propagators, you can create more propagators from such
"buried" pieces. Strategic positioning of propagators that allow you to
reach these "internal" pieces is key to winning the game.
.PP
Since it is relatively easy for one's opponent to prevent one from winning
by changing the color of a piece intended to be the 4th propagator in the
row of 4, a good strategy is to devise a way to have at least two different
pieces that can serve as a 4th piece in the row. Another good strategy is to
bury the prospective 4th piece with other non-essential pieces so that the
opponent cannot easily reach it, and have multiple propagator paths to it.
Then if the opponent blocks one propagator path, another one is available to
reach it.
.PP
It is very useful to anticipate the color of one's subsequent piece, and
plan accordingly. For example, if the first player is playing a red, and
there are no cyans around, it is useful to place the red next to blue
pieces, because they form purple which can be complemented by the green on
the next turn. If they are placed next to green pieces, the result is
yellow, which cannot be used until 2 turns later.
.SH HISTORY
The original 2-color version of the game was developed in December 2002. It
was based on much simpler rules (basically, each player directly plays his
goal piece), but because of the very small initial state space and the
proximity of winning states, one player always had the advantage. Several
different starting configurations, including randomized starting states, were
tried in an attempt to balance the game, but with limited results.
.PP
Because of these limitations, more elaborate versions of the game were sought.
The current 8-color version was first introduced in February 2003. Its main
motivation was to postpone winning states until the state space has grown
significantly.
.PP
A min-max algorithm with alpha/beta pruning was introduced to the AI player
in April 2003. This replaced the previous, more limited algorithm which only
performed well at certain search depths.
.PP
The "4" in the name "Atom-4" refers obviously to the goal of making the
4-in-a-row. The "atom" part refers to the similarity to atoms forming into a
crystal lattice: you can't just stick an atom anywhere in a crystal lattice;
it must fit into a "stable" position (in this case, touching two other
adjacent "atoms" already on the board). Also, atoms don't just stick together;
chemical reactions (color changes) happen when they come together, and some
chemical changes have far-reaching effects (color change propagating over
whites and blacks).
.SH AUTHOR
The game concept of Atom-4, the design and implementation of the software
version of the game, and the graphics used by the game, were all done by Hwei
Sheng Teoh <hsteoh@debian.org>.
.SH COPYRIGHT
Copyright (C) 2002-2003 by Hwei Sheng Teoh <hsteoh@debian.org>
.PP
This is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version without ANY WARRANTIES.