Template:Conway's Game of Life

(Redirected from Vivarium)
Template documentation

Use this template to create an interactive instance of Conway's Game of Life.

See the installation instructions to get it working in your wiki.

Usage

edit

Call this template with no parameters to create a small game with the the well-known R-pentomino, like so:

Markup Renders as
{{Conway's Game of Life}}

See the examples for other configurations.

Installation

edit

To install this template in your wiki:

  1. Create a template with the following markup. You can choose the template name, parameter names and defaults to suit your wiki.
    <div class="error">Page 'Template:Conway&' not found</div>
    
  2. Create MediaWiki:Gadget-Vivarium.js with the following code:
    /**
     * Vivarium produces an interactive instance of Conway's Game of Life
     * Documentation: https://www.mediawiki.org/wiki/Template:Vivarium
     * Source code: https://www.mediawiki.org/wiki/MediaWiki:Gadget-Global-Vivarium.js
     */
    mw.loader.load( '//www.mediawiki.org/w/load.php?modules=ext.gadget.Global-Vivarium' );
    
  3. Add the following gadget to MediaWiki:Gadgets-definition:
    * Vivarium[ResourceLoader|hidden|default|categories=Gadget:Vivarium]|Vivarium.js
    

Done! Add your template to any page to verify that the installation was successful.

Examples

edit

R-pentomino

edit
Markup Renders as
{{Conway's Game of Life
| width = 400
| height = 200
| zoom = 3
| cells = 0,0; 0,1; 0,-1; -1,0; 1,1
}}

Spaceships

edit
Markup Renders as
{{Conway's Game of Life
| width = 400
| height = 200
| cells = -39,-12; -39,1; -40,1; -41,1; -42,1; -43,1; -44,0; -39,0; -39,-1; -40,-2; -44,-2; -42,-3; -39,12; -40,12; -41,12; -42,12; -43,12; -44,12; -45,11; -45,9; -39,11; -39,10; -40,9; -42,8; -43,8; -39,-21; -39,-22; -40,-21; -40,-23; -41,-21; -39,-10; -40,-13; -39,-11; -40,-10; -41,-10; -42,-10; -43,-11; -43,-13
}}

Blinkers

edit
Markup Renders as
{{Conway's Game of Life
| width = 400
| height = 200
| zoom = 3
| cells = 0,0; 10,-1; 11,2; -14,-1; -13,-1; -13,0; -15,2; -16,2; -16,1; -4,21; -4,20; -5,22; -6,22; -9,20; -6,17; -2,20; -2,21; -1,22; 0,22; 0,17; 3,20; 0,24; -1,24; -2,25; -2,26; -4,25; -4,26; -5,24; -6,24; -9,26; -6,29; 0,29; 3,26; 15,15; 15,16; 15,17; 15,14; 16,13; 17,13; 18,13; 19,13; 20,14; 20,15; 20,16; 20,17; 19,18; 18,18; 17,18; 16,18; 18,11; 19,11; 19,10; 18,10; 13,14; 13,15; 12,14; 12,15; 16,20; 17,20; 16,21; 17,21; 22,16; 22,17; 23,17; 23,16; -17,13; -16,14; 20,4; 20,3; 21,3; 23,7; 24,7; 24,6; 30,6; 31,6; 31,5; 27,1; 26,1; 26,2; 38,5; 37,5; 38,4; 33,-1; 32,-1; 32,0; 44,4; 45,4; 45,3; 39,-3; 38,-3; 38,-2; 19,16; 0,1; 0,-1; 10,0; 11,0; 10,1; 11,1; -14,0; -15,1; -4,19; -7,22; -9,19; -7,17; -2,19; 1,22; 1,17; 3,19; 1,24; -2,27; -4,27; -7,24; -9,27; -7,29; 1,29; 3,27; 17,17; -18,14; -17,12; -16,15; -15,13; 22,4; 22,6; 30,4; 28,2; 36,4; 34,0; 44,2; 40,-2; 18,15; -6,9; 3,9; 28,4; 36,2; 34,2; 42,2; 40,0; 42,0; 16,-5; 16,-6; 17,-6; 18,-6; 19,-7; 19,-8; 18,-9; 17,-8; 16,-8; 15,-9; 15,-10; 16,-11; 15,-12; 14,-12; 13,-11; 13,-10; 13,-9; 12,-9; -5,-8; -4,-8; -4,-9; -5,-9; -7,-9; -8,-10; -5,-11; -6,-12; -8,-12; -8,-13; -9,-13; -9,-12; -25,6; -26,6; -26,5; -26,4; -25,4; -27,7; -28,6; -30,6; -30,7; -31,6; -32,6; -32,7; -33,5; -32,4; -32,2; -32,1; -32,0; -33,2; -33,0; -31,-1; -30,0; -28,0; -27,0; -26,0; -28,-1; -26,-1; -25,1; -26,2; -22,-6; -21,-6; -23,-7; -24,-8; -25,-9; -25,-10; -24,-11; -23,-12; -22,-13; -21,-13; -20,-12; -19,-11; -18,-10; -18,-9; -19,-8; -20,-7; -5,9; -4,8; -4,10; -3,9; -2,9; -1,9; 0,9; 1,8; 1,10; 2,9; -9,25; -5,29; -1,29; 3,25; -1,17; 3,21; -5,17; -9,21; 1,-29; 1,-28; 0,-29; 0,-28; 3,-29; 3,-28; 3,-27; 3,-26; 4,-30; 5,-29; 7,-29; 6,-29; 8,-29; 9,-28; 10,-27; 11,-27; 11,-28; 8,-27; 7,-27; 6,-27; 8,-26; 8,-25; 7,-24; 6,-23; 6,-22; 7,-22; 4,-25; 5,-25; 6,-25; 6,-31; 6,-32; 5,-32; 27,-21; 27,-20; 27,-19; 28,-18; 29,-18; 30,-18; 31,-18; 27,-22; 25,-20; 25,-19; 24,-19; 24,-20; 28,-16; 29,-16; 29,-15; 28,-15; 32,-19; 31,-20; 33,-20; 32,-21; 31,-22; 29,-22; 30,-22; 29,-21; 28,-23; 29,-24; 29,-25; 28,-25; -42,23; -40,23; -41,23; -39,23; -38,23; -37,23; -35,25; -34,25; -35,26; -35,21; -34,21; -35,20; -44,21; -44,20; -45,21; -44,25; -44,26; -45,25; -33,26; -33,27; -33,28; -32,28; -33,20; -33,19; -33,18; -32,18; -46,20; -46,19; -46,18; -47,18; -46,26; -46,27; -46,28; -47,28; 31,25; 31,24; 32,23; 33,24; 34,25; 33,26; 33,27; 34,27; 36,25; 37,26; 37,27; 36,27; 37,24; 38,23; 39,24; 39,25; -23,-24; -23,-25; -22,-25; -21,-24; -21,-23; -21,-22; -20,-21; -19,-21; -18,-22; -18,-23; -18,-24; -17,-25; -16,-25; -16,-24
}}

Template data

edit

Use this template to create an interactive instance of Conway's Game of Life

Template parameters[Edit template data]

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
Autoplayautoplay

Start the game automatically

Example
yes
Booleanoptional
Widthwidth

Width of the instance, in pixels

Default
300
Example
600
Numberoptional
Heightheight

Height of the instance, in pixels

Default
150
Example
400
Numberoptional
Zoomzoom

Initial zoom of the instance

Example
3
Numberoptional
Gridgrid

Initial state of the grid

Example
on
Booleanoptional
Cellscells

Initial cells of the instance, specified by a semicolon-separated list of coordinates

Default
0,0; 0,1; 0,-1; -1,0; 1,1
Stringoptional
Fallbackfallback

Fallback file or text, for users with JavaScript disabled or when printing

Default
[[File:Gospers glider gun.gif]]
Unknownoptional

See also

edit