Template:Langton's ant

(Redirected from Formicarium)
Template documentation

Use this template to create an interactive instance of Langton's ant.

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

Usage

edit

Call this template with no parameters to create a small instance with a single ant in the center, like so:

Markup Renders as
{{Langton's ant}}

Use the parameters to change the initial conditions. Click on the canvas to introduce additional ants.

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:Langton&' not found</div>
    
  2. Create MediaWiki:Gadget-Formicarium.js with the following code:
    /**
     * Formicarium.js implements an interactive instance of Langton's ant
     * Documentation: https://www.mediawiki.org/wiki/Template:Langton's_ant
     * Source code: https://www.mediawiki.org/wiki/MediaWiki:Gadget-Global-Formicarium.js
     */
    mw.loader.load( '//www.mediawiki.org/w/load.php?modules=ext.gadget.Global-Formicarium' );
    
  3. Add the following gadget to MediaWiki:Gadgets-definition:
    * Formicarium[ResourceLoader|hidden|default|categories=Gadget:Formicarium]|Formicarium.js
    

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

Template data

edit

Use this template to create an interactive instance of Langton's ant.

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
Antsants

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

Default
0,0
Example
0,0; -1,0
Stringoptional
Cellscells

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

Example
0,1; 0,2; -1,1; -1,2
Stringoptional
Fallbackfallback

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

Default
[[File:LangtonsAntAnimated.gif]]
Unknownoptional

See also

edit