Provided by: atom4_4.1-5.1_i386 bug


       atom4 - two-player color puzzle game


       atom4 [ -a n ] [ -d level ] [ -mt | -mx ]
       atom4 -h


       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.

       There  is  an  AI mode where you play against the computer. By default,
       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.

       atom4 supports both a curses-based text interface and an X11 interface.
       The interface can be selected with the -m  option.  By  default,  atom4
       launches the X11 interface if the $DISPLAY environment variable is set,
       and the curses-based interface otherwise.


       -a n   Play against AI player.  n must be either  1  or  2,  specifying
              which player the AI will be.

       -d n   Set  AI  player's difficulty level, where 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.

       -h     Shows a summary of command-line options that atom4 takes.

       -mt    Selects the  text  (curses-based)  interface.  The  curses-based
              interface  requires a terminal with color capabilities; at least
              9 colors are needed.

       -mx    Selects the X11 interface.  The  X11  interface  requires  an  X
              display that supports at least 8-bit color. Note that currently,
              atom4 will always connect to  the  X  server  specified  in  the
              $DISPLAY environment variable.


       The  text  mode  interface requires a terminal that supports at least 9

       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.

       You can press q at any time to quit the game.

       After one of the players win, the game will pause. You can either press
       n to proceed to the next round, or q to quit.


       The X11 interface requires an X display which has at least 8-bit color.

       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

       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.

       At any time during the game, you may press q to quit the game.

       After one of the players win, press n to proceed to the next round.


       (Adapted from the README file.)

       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.

       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).

       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.

       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

       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.

       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.

       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.

       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.

       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

       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

       (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.)

       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

       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.


       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.

       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).

       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.

       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.

       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.


       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.

       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.

       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.

       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).


       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 <>.


       Copyright (C) 2002-2003 by Hwei Sheng Teoh <>

       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.