Tacky Turtle 3D- randomly generated turing drawing machine

All off topic discussions go here. Everything from the funny thing your cat did to your favorite tv shows. Non-programming computer questions are ok too.
User avatar
AndrewAPrice
Member
Member
Posts: 2299
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Tacky Turtle 3D- randomly generated turing drawing machine

Post by AndrewAPrice »

I've made a simple toy called Tacky Turtle. Basically, it's a virtual machine that runs randomly generated programs (any combination of symbols is a valid program), and the program controls a turtle which leaves a trail behind it.

The program's memory is a 'tape' which you can see on the right of the screen.

Getting started is easy, click 'Play' and then 'Randomize'.

Here is video of it in action:


Download links:
* Linux (x86, x86_64): http://www.andrewalexanderprice.com/sof ... _linux.zip
* Windows: http://www.andrewalexanderprice.com/sof ... le_win.zip
* Mac (x86, x86_64): http://www.andrewalexanderprice.com/sof ... le_mac.zip

* Unity web-player: http://www.andrewalexanderprice.com/sof ... ckyturtle/

UPDATE: Here's a newer 3d version: http://www.andrewalexanderprice.com/sof ... yturtle3d/

You can share any interesting programs by clicking 'Share' and copying the link. Clicking that link will load the web player with that program pre-loaded. On desktop versions, you can load links by pasting it into the 'Share' dialog and clicking 'Load'.
Last edited by AndrewAPrice on Sat Sep 06, 2014 10:53 am, edited 3 times in total.
My OS is Perception.
User avatar
AndrewAPrice
Member
Member
Posts: 2299
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Re: Tacky Turtle - randomly generated turing drawing machine

Post by AndrewAPrice »

I've been thinking about making a 3D version of this. That would look cool :)
My OS is Perception.
User avatar
max
Member
Member
Posts: 616
Joined: Mon Mar 05, 2012 11:23 am
Libera.chat IRC: maxdev
Location: Germany
Contact:

Re: Tacky Turtle - randomly generated turing drawing machine

Post by max »

hehe just tried it out, generates some really cool figures
i like these circles that come up:
ImageImage
also its fun to see what happens when you just randomly change parts of the program :P
Image
could you somehow explain what each command means? yeah 3d mode would be awesome, too :D
nice job! :)
User avatar
AndrewAPrice
Member
Member
Posts: 2299
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Re: Tacky Turtle - randomly generated turing drawing machine

Post by AndrewAPrice »

Thanks Max.

There is a command list if you click "help" but if I recall correctly the commands are:

( rotate 5 degrees left
) rotate 5 degrees right
^ walk forward
r toggle red
g toggle green
b toggle blue

< previous tape position
> next tape position
- decrease tape value
+ increase tape value
= skip n instructions (n = tape value)
* repeat next instruction n times (n = tape value)
? skip next instruction if n is 0 (n = tape value)

Every other symbol is ignored (but still takes a cycle!)
My OS is Perception.
User avatar
max
Member
Member
Posts: 616
Joined: Mon Mar 05, 2012 11:23 am
Libera.chat IRC: maxdev
Location: Germany
Contact:

Re: Tacky Turtle - randomly generated turing drawing machine

Post by max »

That "help" button was too small for my tired eyes. :D Thanks though, I'll play around a bit :P
embryo

Re: Tacky Turtle - randomly generated turing drawing machine

Post by embryo »

MessiahAndrw wrote:Basically, it's a virtual machine that runs randomly generated programs
But why there is some regularity in every picture? It seems generated programs are not random. Or there is small random part which is repeated many times after some translation/rotation.
User avatar
max
Member
Member
Posts: 616
Joined: Mon Mar 05, 2012 11:23 am
Libera.chat IRC: maxdev
Location: Germany
Contact:

Re: Tacky Turtle - randomly generated turing drawing machine

Post by max »

embryo wrote:But why there is some regularity in every picture? It seems generated programs are not random. Or there is small random part which is repeated many times after some translation/rotation.
If a program is randomly generated, that doesn't mean it can't create a regular output. It is able to repeat, as some commands trigger the tape position, and once the last tape was reached it jumps back to the first.
embryo

Re: Tacky Turtle - randomly generated turing drawing machine

Post by embryo »

max wrote:It is able to repeat, as some commands trigger the tape position, and once the last tape was reached it jumps back to the first.
After random program ends the VM starts it again? Then why there are rotations and shifts every cycle? And all translations follow a circle pattern.

Randomness and regularity together are interesting area to explore, but understanding it is not a straight-forward process.
User avatar
max
Member
Member
Posts: 616
Joined: Mon Mar 05, 2012 11:23 am
Libera.chat IRC: maxdev
Location: Germany
Contact:

Re: Tacky Turtle - randomly generated turing drawing machine

Post by max »

embryo wrote:And all translations follow a circle pattern.
No, the ones I took a screenshot of did, there are also some that don't. But that has a simple explanation: if the turtle moves always forward after each turn, and turns for example 10 times to the left, but 12 times to the right, it runs in a circle..
User avatar
AndrewAPrice
Member
Member
Posts: 2299
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Re: Tacky Turtle - randomly generated turing drawing machine

Post by AndrewAPrice »

embryo wrote:
max wrote:It is able to repeat, as some commands trigger the tape position, and once the last tape was reached it jumps back to the first.
After random program ends the VM starts it again? Then why there are rotations and shifts every cycle? And all translations follow a circle pattern.

Randomness and regularity together are interesting area to explore, but understanding it is not a straight-forward process.
Yes it runs again. Just what Max said, if it runs the same thing over and over again (move forward, rotate right) there's a high chance it'll produce a circular pattern. Not all do and if you play with the tool you will get programs that generate straight patterns, things that look like scan lines, junk, etc.

Also, there is a tape device (I am simulating a turing machine) that acts as memory, and that can influence the looping and pattern behaviour of programs.
My OS is Perception.
embryo

Re: Tacky Turtle - randomly generated turing drawing machine

Post by embryo »

max wrote:if the turtle moves always forward after each turn, and turns for example 10 times to the left, but 12 times to the right, it runs in a circle..
Yes, it's really simple. Thanks for explanation :)
embryo

Re: Tacky Turtle - randomly generated turing drawing machine

Post by embryo »

MessiahAndrw wrote:Not all do and if you play with the tool you will get programs that generate straight patterns, things that look like scan lines, junk, etc.

Also, there is a tape device (I am simulating a turing machine) that acts as memory, and that can influence the looping and pattern behaviour of programs.
Nice toy to discover random regularities or regular randomness :)
User avatar
max
Member
Member
Posts: 616
Joined: Mon Mar 05, 2012 11:23 am
Libera.chat IRC: maxdev
Location: Germany
Contact:

Re: Tacky Turtle - randomly generated turing drawing machine

Post by max »

User avatar
AndrewAPrice
Member
Member
Posts: 2299
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Re: Tacky Turtle - randomly generated turing drawing machine

Post by AndrewAPrice »

I've been thinking about how a 3D version would work, and if the camera angle was static (you can't rotate the image) it would be simple because I merely have to draw the lines when the turtle moves. However if I implement the ability to rotate the display (which you'd want to), I'd have to redraw it from the new angle. I don't want to store a list of drawn lines, because this could be drawing hundreds of thousands of lines a second, and we'd quickly run out of memory.

So I'm thinking I could either do a voxel approach, where the turtle draws into a 512x512x512 voxel grid. This would look pixelated when zoomed up close though. An alternative approach would simply be to clear the display when you rotate, requiring the turtle to redraw.

Or, I could do a hybrid approach. Voxelize it into a low res (maybe 8x8x8) cloud that is only visible as a preview when you rotate, then you stop it fades out after a second (giving time for the turtle to start redrawing from the new angle).

What do you think?
My OS is Perception.
onlyonemac
Member
Member
Posts: 1146
Joined: Sat Mar 01, 2014 2:59 pm

Re: Tacky Turtle - randomly generated turing drawing machine

Post by onlyonemac »

That would work until you decide to add the "random number generator" function, although in that case you could store the seed so as to generate the same sequence of random numbers when redrawing and only change the seed when asked to re-generate the random numbers. Storing a seed wouldn't use much memory and there would be no increase in memory usage as more random numbers are generated as would have been the case with what was origianlly going to be my suggestion to store a list of the random numbers generated so that they can be repeated (I really should have known better than to even think of suggesting that LOL).

EDIT: I was actually meaning to post here anyway: this does look quite cool although I haven't tried it though... One more question/suggestion: does it generate random text or does it only use valid symbols which actually do something? If the former then it could get frustrating when a child decides to try changing something and can't understand why the pattern doesn't change!
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
Post Reply