Skip to main content

Mice in a maze ContentsSyntaxExample programsImplementationNavigation menu

Brainfuck derivatives2015LanguagesTwo-dimensional languagesConcurrent programmingImplemented











Mice in a maze



From Esolang



Jump to: navigation, search


Mice in a maze is another brainfuck derivative. It was invented in 2015 by an anonymous user. Mice in a maze was inspired by items called cellular automata, especially Conway's game of life and Langton's ant.



Contents



  • 1 Syntax

    • 1.1 Defining a maze


    • 1.2 Mice


    • 1.3 Instructions


    • 1.4 Example maze



  • 2 Example programs

    • 2.1 Hello World!



  • 3 Implementation



Syntax


In Mice in a maze, there is a data tape and pointer as in brainfuck. The user defines a maze and places commands around the maze. The user then puts a mouse - or mice - in the maze. As a mouse runs over a command, the command is executed.


Defining a maze


There are two types of wall that can be used to define a maze. W defines a solid wall. K defines a conditional wall, where the wall does not exist if the cell under the pointer is zero, and exists otherwise. These two symbols define a maze such as the one below:


WWWWWWWWW
W W W
WWW W WWW
W W W
W WWWWW W
W W
WWWWWWWWW

The empty spaces are the passageways that the mice can run along.


Mice


Mice are defined by placing numbers in the maze. 1 is the first mouse, 2 is the second, etc. Each mouse begins pointing upwards. The program progresses in timesteps called generations. Every generation the mouse can either:


  • Move one space forward, if the space ahead is empty.

  • Rotate 90 degrees clockwise, if the space ahead contains an existing wall.

  • Disappear, if the space that it is on contains the instruction E.

The program ends when all of the mice disappear.


Instructions


Instructions are placed inside the maze. An instruction is executed when a mouse is on top of it. If multiple mice are on top of instructions during a generation, the lowest numbered mouse's instruction is executed first, then the next lowest numbered, etc. Here is a list of the instructions:


  • > move pointer right

  • < move pointer left

  • + increment the value of the current cell

  • - decrement the value of the current cell

  • . output the character in the current cell

  • , input a character into the current cell

  • E destroy mouse

  • C forces mouse to rotate clockwise as next move

  • A forces mouse to rotate anticlockwise as next move

The first six instructions are the same as in brainfuck. Loops can be implemented by creating a circle in the maze and using conditional walls.


Example maze


This maze doesn't do anything, it's just an example.


WWWWWWWWW
W1 CWC EW
WWW W WWW
WA CWC AW
W WWWWW W
WA 2 AW
WWWWWWWWW

Example programs


If anybody comes up with any example programs, feel free to post them here.


Hello World!


This Hello World! program from TomPN.


 WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
W>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.EW
WWWWWWWWWWWWKWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
W1++++++++++ >+++++++>++++ W
WWWWWWWWWWWW WWWWWWWWWWWWW+W
W -<<<+++>+++++ W
WWWWWWWWWWWWWWWWW

Implementation


  • Mice in a maze/mice.py An implementation in python by User:Koen.

Retrieved from "https://esolangs.org/w/index.php?title=Mice_in_a_maze&oldid=58069"





Navigation menu






















(window.RLQ=window.RLQ||[]).push(function()mw.config.set("wgPageParseReport":"limitreport":"cputime":"0.004","walltime":"0.003","ppvisitednodes":"value":31,"limit":1000000,"ppgeneratednodes":"value":36,"limit":1000000,"postexpandincludesize":"value":0,"limit":2097152,"templateargumentsize":"value":0,"limit":2097152,"expansiondepth":"value":2,"limit":40,"expensivefunctioncount":"value":0,"limit":100,"timingprofile":["100.00% 0.000 1 -total"],"cachereport":"timestamp":"20181024174422","ttl":86400,"transientcontent":false););(window.RLQ=window.RLQ||[]).push(function()mw.config.set("wgBackendResponseTime":25););

Popular posts from this blog

ParseJSON using SSJSUsing AMPscript with SSJS ActivitiesHow to resubscribe a user in Marketing cloud using SSJS?Pulling Subscriber Status from Lists using SSJSRetrieving Emails using SSJSProblem in updating DE using SSJSUsing SSJS to send single email in Marketing CloudError adding EmailSendDefinition using SSJS

Кампала Садржај Географија Географија Историја Становништво Привреда Партнерски градови Референце Спољашње везе Мени за навигацију0°11′ СГШ; 32°20′ ИГД / 0.18° СГШ; 32.34° ИГД / 0.18; 32.340°11′ СГШ; 32°20′ ИГД / 0.18° СГШ; 32.34° ИГД / 0.18; 32.34МедијиПодациЗванични веб-сајту

19. јануар Садржај Догађаји Рођења Смрти Празници и дани сећања Види још Референце Мени за навигацијуу