Template:Langton's ant
This template is a template gadget. It requires the Formicarium gadget to work, which is loaded automatically when this template is used. |
Use this template to create an interactive instance of Langton's ant.
See the installation instructions to get it working in your wiki.
Usage
editCall 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
editTo install this template in your wiki:
- 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>
- 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' );
- 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
editUse this template to create an interactive instance of Langton's ant.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Autoplay | autoplay | Start the game automatically
| Boolean | optional |
Width | width | Width of the instance, in pixels
| Number | optional |
Height | height | Height of the instance, in pixels
| Number | optional |
Zoom | zoom | Initial zoom of the instance
| Number | optional |
Grid | grid | Initial state of the grid
| Boolean | optional |
Ants | ants | Initial ants of the instance, specified by a semicolon-separated list of coordinates
| String | optional |
Cells | cells | Initial cells of the instance, specified by a semicolon-separated list of coordinates
| String | optional |
Fallback | fallback | Fallback file or text, for users with JavaScript disabled or when printing
| Unknown | optional |
See also
edit- es:Plantilla:Hormiga de Langton - Spanish localization of this template
- Template:Conway's Game of Life - Related template
- User:Sophivorus - Main author of this template