Changes

Jump to navigation Jump to search
8 bytes added ,  15:59, 15 May 2015
Line 155: Line 155:  
.</pre>
 
.</pre>
 
This would create a generator that can generate the strings:
 
This would create a generator that can generate the strings:
Hello
+
#Hello
Hi
+
#Hi
Hello.
+
#Hello.
Hi.
+
#Hi.
Hello, you
+
#Hello, you
Hi, you
+
#Hi, you
Hello, you.
+
#Hello, you.
Hi, you.
+
#Hi, you.
 
It works by starting from the first node "start" (nodes are the ones with a hyphen in front of the name), it appends a random string from the list of strings below it (in this case there’s nothing to pick), it then picks a random node from the parenthesis of the current node (which can only be "base" in this case), and then it continues until it reaches the node stop. There is a limit to how far it will go, depending on how many nodes there are, to avoid an infinite loop.
 
It works by starting from the first node "start" (nodes are the ones with a hyphen in front of the name), it appends a random string from the list of strings below it (in this case there’s nothing to pick), it then picks a random node from the parenthesis of the current node (which can only be "base" in this case), and then it continues until it reaches the node stop. There is a limit to how far it will go, depending on how many nodes there are, to avoid an infinite loop.

Navigation menu