This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
gadget142's profile picture

Self-Replicating Turtles

Started by gadget142, 03 February 2013 - 01:01 PM
gadget142 #1
Posted 03 February 2013 - 02:01 PM
Hi guys;
I'm sorry if this is already a topic, but I looked for it and I can't find it.
The ad on the front page of computercraft.info is a warning about self-replicating turtles. My simple question is whether this is possible. It seems to me that the most major roadblock would be how to 1. load a basic operation and existence program onto a freshly built turtle and 2. have it execute that program, all without human interference. The danger of this is that if you can load programs onto a computer and have them activate, you can certainly distribute viruses.
Again, is it possible to have a turtle- armed with the materials, resources and code to build another one- breathe life into its creation?
soccerboy5411 #2
Posted 03 February 2013 - 02:13 PM
Simply, yes.

A couple of months ago a competition was started to see who could create a program that would enable a turtle to self replicate on its own. I don't believe anyone completed the competition due to time restraints, but the idea is still there that it is possible.
tesla1889 #3
Posted 03 February 2013 - 02:19 PM
it is possible, especially considering that you could program the turtle to place a disk with a program called /startup in a disk drive next to the turtle it just created and call the turtle's turnOn method
Shnupbups #4
Posted 03 February 2013 - 02:31 PM
Or just break a labeled turtle in creative and place it again, then put itself in its inventory. Then duplicate that labeled turtle in its inventory with the pick block button to give it lots. Make a startup program on that turtle that makes it place a turtle, turn it on and put one other of themselves in ITS inventory.
Complicated (o_O)
gadget142 #5
Posted 03 February 2013 - 02:43 PM
How do I use the first turtle to call the second turtle's turnOn() method?
And yeah (CodeKiddie) that sounds effective but, to me it's sort of cheating :)/> I want something theoretically possible in Survival or SMP

EDIT: Oh, the peripheral function, I see. Thank you!
PhilHibbs #6
Posted 05 February 2013 - 04:49 AM
Hm. A single turtle? I assume you can pre-load it with some materials. Tricky.

I guess a starting point would be to pre-load it with saplings, then it can produce wood on demand which will be needed for tools and fuel.

Then it would create a line of chests, one for each material needed in the construction process, so it can just go to a chest and guarantee that it's getting what it wants. One for Cobblestone, one for Stone, one for Glass Panes, one for Redstone, etc. In order to do this, it needs to be pre-loaded with one of each material so that it can put a sample into each chest. So what are the raw materials that are needed… (crafted materials don't need to be pre-loaded as it knows what it has when it crafts one)
1. Coblestone
2. Planks (logs not neded, as it can get one by planting a sapling and waiting untli the block above the sapling is occupied, then chop it)
3. Sticks
4. Redstone
5. Sand
6. Diamond (or Sapphire, if you have that modpack, as these are the most common gem in my experience)
7. Sugar Cane (need paper for a floppy disk)
8. 2 buckets of water (to plant sugar cane next to and for water source)

Next it goes quarrying to find items 1, 4, 5, and 6 and stuffs what it finds that match those in the appropriate chest. Anything else gets dumped down a mineshaft.

Build furnace to make glass, fuel it with wood or saplings.
Build furnace to make stone, fuel it with wood or saplings.
Build furnace to make iron, fuel it with wood or saplings.
Optional: build a furnace to make charcoal to speed things up.

Any time it needs more wood, it takes a sapling from the sapling chest and goes to the tree and cuts it down and plants the sapling.

Make a disk drive from Stone and redstone, place it. Mkae paper, make a floppy disk from paper and redstone, place it. I've not used these yet myself so I don't know if there is any finesse involved here. I guess it needs to load a startup program onto the disk so that a new turtle can bootstrap itself.

Make a computer. Make a turtle, stick it in a chest. Make a pickaxe, get turtle, make mining turtle, place it and it boots. Off it goes to pick up the basic resouces from the respective chests, disappears off in a random direction and distance, and starts all over again. I wonder if a turtle could create a Mystcraft age and spread itself across the cosmos…
PixelToast #7
Posted 05 February 2013 - 08:49 AM
yep!
see here
its possible, you will have to have the resources to make the turtles though
FuuuAInfiniteLoop(F.A.I.L) #8
Posted 05 February 2013 - 09:48 AM
it can be a mining turtle dropping items ina a chest, then a sorting turtle sorting them and burning the ones that have to be burned and a crafty to produce the turtles and make them go mining, sorting or crafting more
zacky911 #9
Posted 09 February 2013 - 08:11 AM
Theoretically yes, however how effective would this be? If they replicated and were devoted to replicating there would be hundreds of things that could be a danger to it (i.e. players, programming errors or bugs ,turtles becoming stranded, etc.) what about a kind of turtle swarm? as in one turtle would not only replcate but also alter its program to have turtles devoted to certain tasks, such as mining, or, defending the main body of turtles.
Celt #10
Posted 09 February 2013 - 08:54 AM
I have created a program that achieves this. It does not quite conform to the rules of the competition though as it uses the new version of cc which includes the extremely useful transferTo() function. Also my turtle does not do the "move to torch each night" thing, though that would not be too hard to implement.

@PhilHibbs, the turtle starts with no materials and no fuel. But, it is placed in front of a tree, with water and at least one sugar cane within 20 blocks. The sugar cane requirement is to ensure it will be possible to create a floppy.

The code is rather long (>1000 lines) and really needs refactoring. Also it is quite robust, but very slow. I intend to address these issues when I have time, then I'll make the code available if anyone is interested.
I just wanted to see whether it was possible to achieve replication, but it has ended up taking a lot more of my time than I anticipated.
FuuuAInfiniteLoop(F.A.I.L) #11
Posted 11 February 2013 - 03:04 AM
I have created a program that achieves this. It does not quite conform to the rules of the competition though as it uses the new version of cc which includes the extremely useful transferTo() function. Also my turtle does not do the "move to torch each night" thing, though that would not be too hard to implement.

@PhilHibbs, the turtle starts with no materials and no fuel. But, it is placed in front of a tree, with water and at least one sugar cane within 20 blocks. The sugar cane requirement is to ensure it will be possible to create a floppy.

The code is rather long (>1000 lines) and really needs refactoring. Also it is quite robust, but very slow. I intend to address these issues when I have time, then I'll make the code available if anyone is interested.
I just wanted to see whether it was possible to achieve replication, but it has ended up taking a lot more of my time than I anticipated.
send me the code by PM!
zacky911 #12
Posted 12 February 2013 - 07:48 AM
@CELT Post the code on this topic plz!!!
nutcase84 #13
Posted 12 February 2013 - 11:08 AM
@Celt Post your code please, that looks awesome.