25 Years of Programming
An open source source for C, C++, OWL, BASIC, MDB, XLS, DOT, and more...
Home   Projects   Up   Sitemap   Search   Blog   Forum+Chat   About Us   Privacy   Terms of Use   Feedback   FAQ   Images   Services   Ads   Donate   Humor

WLife2d.RTF WinHelp for
Game of Life Cellular Automaton

This source file is compiled by the Windows Help Compiler to produce the WLife2d.hlp Windows 3.1 WinHelp file for the WLIFE2D project. This RTF file describes features specific to WLife2d's calculations and commands. A second RTF file (sdibwin.rtf) is compiled along with this one. It describes the graphics features that are common to several of my programs.

If you use Microsoft Word, these WinHelp source files are based on the helpfile.dot template, which you might find useful.

WLife2d.RTF

# $ K + WLife2D (Game of Life) Help Contents

Note that this help file was copied from another program, and has not yet been fully customized for this one.

OverviewHID_OVERVIEW
File FormatsHID_FILEFORMATS
More File FormatsHID_MOREFILEFORMATS
File Menu CommandsHID_FILEMENUCOMMANDS
Colors Menu CommandsHID_COLORSMENU
More Colors Menu CommandsHID_MORECOLORSMENUCOMMANDS
View Menu CommandsHID_VIEWMENUCOMMANDS
References and Further ReadingHID_FURTHERREADING

# $ K + Overview

The Game of Life is an example of a cellular automaton. The field consists of numerous cells, which can be on (alive) or off (dead). Whether a currently live cell survives to the next generation is determined by the number of neighbors it has. Also, a currently dead cell can become alive if it has the right number of neighbors.

# $ K + More File Formats

These file formats are specific to the Game of Life.

Survive/Born rules are stored in ASCII text files with the extension .RUL, and containing at least 2 lines. You can use additional lines for comments. Maximum total file size is 2000 bytes.

File Format:

  • 2 3 <- A cell survives if its number of neighbors is any of these (digits 0 through 8 legal)

  • 3 <- A new cell is born if its number of neighbors is any of these (digits 0 through 8 legal)

  • Standard game <- Comment line for any desired descriptive or other text

Game boards are saved and loaded as .BMP files. Due to possible version differences in .BMP files used by various applications, if you want to create a game board, it is safest to first create a board with the dimensions you want, Save it as .BMP, and then edit it with a bitmap editor. Creating the file initially with the bitmap editor can cause load errors.

# $ K + File Menu Commands

Next or New Random

Abandons the current design.

If there are one or more designs waiting in the display queue to be displayed, it moves on to the next one in the queue.

If the queue is empty,

The display queue may contain filenames to display if you have:

  1. Invoked the program with filenames on the command line.
  2. Selected multiple files in the File|Load dialog box. In both cases, the files are added to the queue for display in sequence.

Open

Displays a dialog box in which you can select one or more files to load and display in sequence, the same as if you specified them on the command line when you started the program. The files selected are added to the queue. Note that if you do this when files are still in the queue, the next file displayed will be the next in the queue, not the one you just selected.

Edit File

Displays a dialog box in which you can select one file to edit as text.

Edit Again

Immediately (no dialog box) opens the file corresponding to the design currently displayed, for text editing.

Save

SaveAs .BMP

Saves the currently-displayed design (in the size it occupies in the currently displayed window) and its color palette to disk as a .BMP file. You can then import the file into a bitmap editor. To create a design with a specific size or proportions, size the display window as needed, wait for the design to be sufficiently filled in, and then SaveAs .BMP.

# $ K + More Colors Menu Commands

(Commands specific only to this program.)

Set Monochrome Color

Displays a dialog box in which you can specify the color to use when drawing in monochrome mode. It also automatically switches to monochrome mode and turns AutoRandomizeColorsHID_VIEWMENUCOMMANDS OFF, so that the color you selected remains the drawing color until you change the color or change the point coloring mode or turn AutoRandomizeColors on again.

# $ K + View Menu Commands and View Options Dialog Settings

Auto-Cycle Generations

If on, new generations are automatically calculated and displayed. When off, the application does nothing.

Auto-Randomize Colors

When ON, the palette is automatically filled with random colors before every new game. When OFF, the palette stays the same.

AutoAbort Tests

If on, the application continually tries to determine whether anything interesting is happening on the screen. If it detects no activity, it automatically starts a new game.

Random Rules for each new rule set

When the file list (if any) is exhausted, new boards (created with File|New or due to AutoAbort) normally continue to use the last rule set that was in effect. When this option is on, each new board also gets a new randomly generated rule set.

Color by Neighborcount

Pixels (dots) are normally colored by whether they are "live" or "dead". This option colors each pixel according to how many live neighbors it has, which will determine whether or not it survives into the next generation, and makes for a colorful display.

Use Sound

Toggles the use of sound in the application.

Fit to Window

If on, the game board is stretched to fill the current display window, which makes the activity easier to see. If off, the game board is displayed in its true size in the window's upper left corner, which is harder to see, but the generations cycle much faster.

Board Size (width height) or (0 0)

The dimensions of the game board you want to use, which does not have to be the same size as the window. The board is then stretched to fit the window for display. Larger values for width and height increase calculation times, and the tiny dots can be difficult to see. Use 0 0 to match the board size to the current window size. It is not advisable to use a board size that is larger than the window.

Percent Fill (1 to 99)

When a new randomly generated board is created, a percentage of it is filled with random dots. Enter the percentage of it that you want filled with dots.

Time Limit (minutes, fractional ok)

If AutoAbort is on while random rule sets are being generated, the program will move on to a new rule set after this amount of time, even if it detects continuing activity on the screen. Many rule sets never do settle down, but nonetheless become boring. This allows you to set a time limit for each set, in addition to the Population Lookback test.

Population Lookback

If AutoAbort is on, the program keeps track of the total population of "live" cells. If this population does not change for multiple generations, it decides that the game board is dead or uninteresting, and moves on to a new rule set. If you enter a low number such as 1, it may decide that a board is dead before it really is. (This explains the AutoAbort test, but the lookback may be fixed at 10, not changeable by user.)

# $ K + For Further Reading

Books:

  • Choas Under Control, David Peak and Michael Frame

  • Complexity, M. Mitchell Waldrop

Magazine Articles:

Computer Programs:

Authors:

Chris Langton

WLIFE2D.RC

These are the resource definitions for WLife2d.

/****************************************************************************

WLIFE2D.RC
This file is part of the WLIFE2D project.
Copyright (C)1996, 1997, 2001 Steven Whitney.
Published under GNU GPL (General Public License) Version 2, with ABSOLUTELY NO WARRANTY.
Initially published by http://25yearsofprogramming.com.

produced by Borland Resource Workshop

*****************************************************************************/

#include "wlife2d.rh"

RULEFILEEDITOR DIALOG 124, 78, 170, 98
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_THICKFRAME
CAPTION "Rules File Editor"
FONT 8, "MS Sans Serif"
{
 EDITTEXT IDC_RULESEDIT, 12, 3, 147, 78, ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN | WS_BORDER | WS_TABSTOP
 DEFPUSHBUTTON "OK", IDOK, 6, 84, 50, 14
 PUSHBUTTON "Cancel", IDCANCEL, 60, 84, 50, 14
 PUSHBUTTON "Help", IDHELP, 114, 84, 50, 14
}

VIEWOPTIONS DIALOG 37, 26, 280, 176
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "View Options"
FONT 8, "MS Sans Serif"
{
 AUTOCHECKBOX "&0  Auto-Cycle Generations", IDC_AUTOCYCLE, 10, 4, 190, 18, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
 AUTOCHECKBOX "&1  Auto-Randomize Colors with each new rule set", IDC_RANDCOLORS, 10, 18, 190, 18, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
 AUTOCHECKBOX "&2  AutoAbort Tests", IDC_ABORTTESTS, 10, 32, 190, 18, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
 AUTOCHECKBOX "&3  Random Rules for each new rule set", IDC_RANDRULES, 10, 46, 190, 18, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
 AUTOCHECKBOX "&4  Color by Neighborcount", IDC_BYNEIGHBORCOUNT, 10, 60, 190, 18, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
 AUTOCHECKBOX "&5  Use Sound", IDC_SOUND, 10, 74, 190, 18, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
 AUTOCHECKBOX "&6  Fit to Window", IDC_FITTOWINDOW, 10, 88, 190, 18, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
 LTEXT "Board &Size (width height) or (0 0):", -1, 10, 112, 120, 12
 EDITTEXT IDC_BOARDSIZE, 135, 111, 45, 12, WS_BORDER | WS_GROUP | WS_TABSTOP
 LTEXT "Percent &Fill (>0 to <100):", -1, 10, 131, 93, 12
 EDITTEXT IDC_PCTFILL, 135, 130, 45, 12, WS_BORDER | WS_GROUP | WS_TABSTOP
 LTEXT "&Time Limit (minutes, fractional ok):", -1, 10, 151, 120, 12
 EDITTEXT IDC_TIMELIMIT, 135, 149, 45, 12, WS_BORDER | WS_GROUP | WS_TABSTOP
 DEFPUSHBUTTON "OK", IDOK, 218, 10, 50, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
 PUSHBUTTON "Cancel", IDCANCEL, 218, 28, 50, 14, WS_GROUP | WS_TABSTOP
 PUSHBUTTON "Help", IDHELP, 218, 46, 50, 14, WS_GROUP | WS_TABSTOP
 LTEXT "Normal = 160 120", -1, 186, 112, 81, 13
 LTEXT "Normal = 30", -1, 186, 131, 81, 13
 LTEXT "Normal = 1", -1, 186, 150, 81, 13
}


MENU_1 MENU 
{
 POPUP "&File"
 {
  MENUITEM "&Next or New\tN", CM_FILENEW
  MENUITEM "&Open...\tO", CM_FILEOPEN
  MENUITEM "&Edit File...\tF", CM_EDITTRANSFORMS
  MENUITEM "Edit A&gain\tE", CM_FILEEDITAGAIN
  MENUITEM "&Save Ruleset (.RUL)...\tS", CM_FILESAVE
  MENUITEM SEPARATOR
  MENUITEM "Save&As Graphic (.BMP)...\tB", CM_FILESAVEAS
  MENUITEM "Load &BMP...", CM_FILELOADBMP
  MENUITEM SEPARATOR
  MENUITEM "Edit Lis&t...", CM_FILEEDITLIST
  MENUITEM SEPARATOR
  MENUITEM "E&xit", CM_FILEEXIT
 }

POPUP "&Colors"
 {
  MENUITEM "&Next .MAP File\t]", CM_COLORSNEXTMAP
  MENUITEM "&Previous .MAP File\t[", CM_COLORSPREVIOUSMAP
  MENUITEM "&Edit .MAP File List...", CM_COLORSEDITLIST
  MENUITEM SEPARATOR
  MENUITEM "Load .&MAP File...\tM", CM_COLORSLOAD
  MENUITEM "Save&As .MAP File...", CM_COLORSSAVEAS
  MENUITEM SEPARATOR
  MENUITEM "&Randomize\tR", CM_COLORSRANDOMIZE
  MENUITEM "Re&verse\tV", CM_COLORSREVERSE
  MENUITEM "&Complement\tC", CM_COLORSCOMPLEMENT
  MENUITEM "&Lighten\tL", CM_COLORSLIGHTEN
  MENUITEM "&Darken\tD", CM_COLORSDARKEN
  MENUITEM "Rotate&Forward\t>", CM_COLORSROTATEFORWARD
  MENUITEM "Rotate&Backward\t<", CM_COLORSROTATEBACKWARD
  MENUITEM SEPARATOR
  MENUITEM "Se&t Monochrome Color...", CM_EDITMONOCOLOR
 }

POPUP "&View"
 {
  MENUITEM "&Options (all)...\tCtrl+O", CM_VIEWOPTIONS
  MENUITEM "&Fit to Window\tW", CM_VIEWFITTOWINDOW, CHECKED
  MENUITEM "Auto&CycleGenerations\tG", CM_VIEWAUTOCYCLE, CHECKED
  MENUITEM SEPARATOR
  MENUITEM "&Population report", CM_VIEWPOPULATION
 }

POPUP "&Help"
 {
  MENUITEM "&Index\tF1", CM_HELPINDEX
  MENUITEM SEPARATOR
  MENUITEM "&About...", CM_HELPABOUT
 }

}


STRINGTABLE 
{
 CM_EDITTRANSFORMS, "Edit transform set in a file"
 CM_EDITMONOCOLOR, "Specify color to use in monochrome mode"
 CM_FILENEW, "Displays next in queue, if any"
 CM_FILEOPEN, "Load a rule set"
 CM_FILESAVE, "Save current rule set to a file"
 CM_FILEEDITAGAIN, "Reopen last file edited"
 CM_FILELOADBMP, "Load starting screen setup from .BMP file"
 CM_VIEWPOPULATION, "See statistics about this run"
 CM_VIEWAUTOCYCLE, "Starts/Stops automatic next generation "
 CM_VIEWOPTIONS, "Set all View options in a dialog box"
}

MENU_1 ACCELERATORS 
{
 "n", CM_FILENEW
 "N", CM_FILENEW
 "o", CM_FILEOPEN
 "O", CM_FILEOPEN
 "e", CM_FILEEDITAGAIN
 "E", CM_FILEEDITAGAIN
 "s", CM_FILESAVE
 "S", CM_FILESAVE
 "b", CM_FILESAVEAS
 "B", CM_FILESAVEAS
 "f", CM_EDITTRANSFORMS
 "F", CM_EDITTRANSFORMS
 "]", CM_COLORSNEXTMAP
 "}", CM_COLORSNEXTMAP
 "[", CM_COLORSPREVIOUSMAP
 "{", CM_COLORSPREVIOUSMAP
 "m", CM_COLORSLOAD
 "M", CM_COLORSLOAD
 "r", CM_COLORSRANDOMIZE
 "R", CM_COLORSRANDOMIZE
 "v", CM_COLORSREVERSE
 "V", CM_COLORSREVERSE
 "c", CM_COLORSCOMPLEMENT
 "C", CM_COLORSCOMPLEMENT
 "l", CM_COLORSLIGHTEN
 "L", CM_COLORSLIGHTEN
 "d", CM_COLORSDARKEN, ASCII
 "D", CM_COLORSDARKEN
 ".", CM_COLORSROTATEFORWARD
 ">", CM_COLORSROTATEFORWARD
 ",", CM_COLORSROTATEBACKWARD
 "<", CM_COLORSROTATEBACKWARD
 "g", CM_VIEWAUTOCYCLE
 "G", CM_VIEWAUTOCYCLE
 "w", CM_VIEWFITTOWINDOW
 "W", CM_VIEWFITTOWINDOW
 VK_F1, CM_HELPINDEX, VIRTKEY
 "^O", CM_VIEWOPTIONS, ASCII
}

Screenshots

This is the VIEWOPTIONS DIALOG:

Screenshot of the Options dialog box for the Game of Life program.

This is the RULEFILEEDITOR DIALOG:

Screenshot of the Rule Set Editor dialog box for the Game of Life program.

 

 

 

Valid HTML 4.01 Transitional Valid CSS
View content labeling at ICRA.
Copyright ©2007 Steven Whitney. Last modified 09/25/2007.