Jump to content




L System Algorithm Visualizer



  • You cannot reply to this topic
No replies to this topic

#1 eniallator

  • Members
  • 56 posts

Posted 07 January 2017 - 09:58 AM

@Incinirate and I have been making a visualizer of the L System Algorithm. If you don't know what the algorithm is, then Here's the wikipedia link. To fully understand what happens, i would highly recommend going to the wikipedia page and possibly looking at the examples on there or better yet reading it.

It has been challenging to make, as i have had to make the turtle make a straight line using an angle and a magnitude for just one part of it.

If you are interested in the source code, then you can take a look here.

Screenshot of the journey map of my current testing world:
Spoiler

Install:

pastebin run UrtQZgMW

How To Use:

This will only work in a turtle and the turtle will place the blocks upwards. To supply the turtle with blocks, fill up the turtle's inventory with them. If you are scared it may run out of fuel, then you can put fuel in it as well. Make sure the fuel is in a slot after the blocks to place, just because of the way i have set it up in my code.

To make your own inputs for the axiom, rule set and the functions then here's an example template and here's some explanation on how to use the different sections.

To use one of your inputs for the turtle to visualize, use the following command:
lSystem <Path to your input> <iterations to do>

To list the already installed example inputs (all examples of the wikipedia page), use the following command:
lSystem --example list <page number>

To use an example input, use the following command:
lSystem --example <input index (get this from using list)> <iterations to do>

Precautions:

I highly recommend not doing a lot of iterations unless you are willing to wait for the turtle to finish placing each block. I usually stuck to 4 iterations or less, this might seem small, but if you take a look at the wikipedia page's examples, then you will see why.

I also recommend running this program on a superflat world or with no terrain at the turtle's current level. The reason why is it will try to move and it may get stuck at a block (i have implemented code to make sure that it will try moving before it will move on it's next block however).

Edited by eniallator, 07 January 2017 - 10:02 AM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users