C Conway's Game of Life Read File Online

Conway'southward Game of Life

Pan      

  

Click to create, Shift-Click to erase, Ctrl-Mouse to select

This implementation uses JavaScript and SVG, both of which are supported by all major modern browsers. If this page does non work with your browser, consider upgrading.


The Nature of Life

Conway'due south Game of Life simulates the birth and death of cells on a rectangular grid. The state of a given cell in whatever generation depends on the state of the cell and its 8 firsthand neighbors in the preceding generation, according to some simple rules:

  • If a living cell has two or three neighbors, it remains living; otherwise it dies of loneliness or overcrowding.
  • If an empty cell has exactly three neighbors, it becomes living; otherwise, it remains dead.

Equally simple as these rules may be, they tin can result in surprising complexity from relatively simple initial configurations.

The Shape of the World

In principle, the Life universe is an infinite grid. In practice, implementations more often than not impose some constraints. This implementation allows you lot to configure those constraints at any fourth dimension, even every bit the universe is evolving.

Topology

You can choose among iii topologies:

  • Closed -- the universe has edges beyond which no cells can be born. Cells along the edges have fewer than eight neighbors.
  • Wrap -- the edges of the universe wrap around, and then that the top is continued to the lesser, and the right is continued to the left.
  • Open up -- the universe has no edges and tin can grow without bound.

Width and Acme

You lot can ready the width and height to any reasonable integer values. If yous specify a non-numeric value, or a value which is as well big or too small, the default value will be used instead.

Colour

You can choose amid four color schemes:

  • Blackness -- all new cells are blackness.
  • Rainbow -- the colour used for new cells changes from generation to generation, following a rainbow sequence. Old cells retain whatever color they were created with.
  • RGB -- all new cells are created with the color whose RGB (red/green/bluish) values you specify, ranging from 0 to 255. For example, RGB values of 255,0,0 would denote red, while 0,255,255 would exist cyan.
  • Hybrid RGB -- newly-inserted cells are created as with the RGB colour scheme. Cells born every bit the world evolves acquire their colour equally an average of the colors of their three parent cells.

Creating and Deleting

To create alive cells, click on the grid with the left mouse button. You can also click and drag, which produces a line of live cells along the path of the mouse cursor.

To delete cells, do the aforementioned as for creating cells, but hold the Shift key downward while doing so.

You can press and release the Shift key without having to release the mouse button. Whenever the Shift key is downwardly, you are deleting cells. Whenever information technology is up, you are creating cells.

Starting and Stopping

In one case you have an initial configuration of cells, click on the Evolve push. The universe will so evolve for the number of generations specified in the input field to the left of the Evolve push. You tin stop evolving by clicking on the Finish button.

The number of milliseconds between generations is determined by the Delay value, which you can set between 0 and 60000 (ane minute).

Panning and Zooming

Apply the various pointer buttons (above the filigree) to pan:

The Zoom In push button zooms in by a factor of 2, while the Zoom Out button zooms out by a gene of 2. At that place are limits on how far you lot tin zoom.

Cut, Copying and Pasting

If y'all discover an interesting pattern which you'd similar to move or replicate, yous can do and so by cutting or copying it and pasting it.

To select a region of cells (or a location for pasting), hold the Ctrl fundamental while clicking and dragging with the left mouse button. The selected region will exist shown as a light red color.

Once you have selected a region, yous can utilize the Cut, Copy and Paste buttons. A cutting or copied pattern is shown in the foursquare at the top right of the grid. This is what will be pasted when yous press the Paste button.

To rotate the pattern clockwise 90 degrees, click the Rotate button.

To flip the blueprint vertically, click the Flip button.

Loading Patterns

There are a number of well-known jail cell patterns in Life, such as the glider and the block. Many of these are available for loading into the pattern buffer, from which you can then paste them into the world.

To load a pre-defined Life pattern, click on the index selector, to the right of the Save push button. The alphabetize selector presents a combination of life patterns and other indexes.

To load a Life pattern from a local file, click on the file selector, to the right of the index selector.

Pattern Files

Life pattern files suit to a elementary format. Each line of the file represents a row, with each character on the line representing a cavalcade in that row. Blank cells are represented by space or dot characters, while other characters represent living cells.

Comments are an exception to the above. Any line whose starting time column is the comment graphic symbol ("#") is ignored, and does not count as a row. Also, inside a line, everything at and subsequently the comment graphic symbol is ignored. Thus, the following defines a iii-past-iii pattern (abaft blanks are ignored) for a glider:

# description: Glider .O.    # This particular glider ..O    # is headed toward the OOO    # lower correct. # Finish of glider

If a Life blueprint file contains a "clarification:" comment (on a pure annotate line, not as a trailing annotate), that comment volition appear to the right of the index selector and the scan fields when the file is loaded.

Note that the format of a Life pattern file actually allows you to load an arbitrary file and treat it as a Life blueprint. While this is usually a featherbrained thing to do, it is legal.

Alphabetize Files

A Life file tin act equally an alphabetize to Life pattern files and other Life index files. A Life alphabetize file consists solely of comments. Each comment of the form

# file: file_name
or
# file: Brief description = file_name
specifies a Life pattern file or index file which tin be loaded. The description is the text which appears in the pick field when the index is loaded.

If a Life alphabetize file contains an "index:" comment, that annotate will be used as the label for the alphabetize selector.

By convention, the brief description for an index file has a trailing "...", to differentiate information technology from a pattern file.

Saving Patterns

To relieve a Life blueprint for future loading, re-create it to the design buffer and printing the Salvage button. The blueprint volition exist saved with a name and optional description which y'all specify. You can later load the pattern via the Saved Patterns alphabetize, which is accessible from the Main Index.

Patterns are saved to local storage in your browser. You may want to remove old Life storage from time to time, using the appropriate interface within your browser.

Clipboard

Life patterns cannot be saved directly to a local file. However, you can copy the electric current blueprint to the clipboard and so paste from the clipboard into an awarding of your choice.

To copy the current blueprint to the clipboard, click on it in the foursquare at the top correct of the grid.


To contact me, send mail to dewara@cuug.ab.ca.

Alan Dewar's abode page            CUUG habitation page

elmorewortur.blogspot.com

Source: https://cuug.ab.ca/dewara/life/life.html

0 Response to "C Conway's Game of Life Read File Online"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel