Jump to content




Self-Replicating Turtle - Revisited


104 replies to this topic

#101 dropdead

  • Members
  • 14 posts

Posted 12 January 2019 - 09:07 PM

This time the turtle got very far although it went to excavate a third stage at the deepest point possible because it put every redstone in a chest and had to look for new redstone.

It crafted two pickaxes, chests, crafting tables, computers, one floppy disk, and a disk drive. Then it tried to program the new computers and failed:

"...:2794: Slot number 0 out of range" (function "programTurtles(numTurtles))"


Did not see which crafting ingridient it was missing when the program failed.

Its inventory:

1 - 22 cobblestone
2 - diamond pickaxe
3 - 4 sticks
4 - diamond pickaxe
5 - 14 iron
6 - 19 oak wood
7 - 3 chests
8 - 2 crafting tables
9 - 2 paper
10- floppy disk
11 - 14 glas panes
12 - 2 computers
13 - disk drive

I am not sure I thought of the former problem with the config, where I had to give the floppy disk more space to get the program on it (or something like that) or if I still have to do this since the program got so much leaner (from about 12000 lines to about 4000).

I am wondering if this run doesn't count as success... in my book, it sure should.

However, I guess it can do better.


Today we use computers to solve problems we would not have without them.

Hope the joke did not get lost in translation...


Log
Spoiler

Edited by dropdead, 12 January 2019 - 09:10 PM.


#102 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 13 January 2019 - 12:55 PM

Also using a 1.7.10 pack, CC 1.74, and the script build from 12/12/2018, I tested it out and eventually received the same error on 2794. I was AFK standing near the start point when it died, came back to find a couple of computers and pick axes had been dropped close enough that my character had picked them up. Not sure if the turtle made a disk drive, it might've dropped one and had it despawn. It would've had all the ingredients on hand to make another turtle if it hadn't chucked the computers away.

I'd hoped to speed up the resource harvesting process by specifically "making sure" the turtle would find what I thought it wanted (it'd be nice if the terminal counted down the resources it needs), but it still roamed around a large area on the surface and dug out three large areas underground (despite overloading on redstone / diamonds / iron / whatever on its first trip down). It also seems to ignore its limited inventory space while mining (continuing to dig even after all slots were filled), and seemed quite happy to lug stacks of logs down into the mine with it (instead of leaving them in the surface chests) - it might get away with this in vanilla (maybe), but mod packs tend to add a lot of blocks, so "assuming" it won't be full when it finds its first diamond is very risky!

On my first test, the turtle got overenthusiastic in clearing out a large seam of sandstone (aka the bottom of the beach), eventually making so many recursive function calls that it crashed out. I also found it likes to mine out entire seams of Chisel blocks for no apparent reason - I guess it just gobbles up anything that isn't cobble / stone / dirt.

#103 Lupus590

  • Members
  • 1,965 posts
  • LocationUK

Posted 14 January 2019 - 08:22 PM

View PostBomb Bloke, on 13 January 2019 - 12:55 PM, said:

[the turtle] seemed quite happy to lug stacks of logs down into the mine with it (instead of leaving them in the surface chests) - it might get away with this in vanilla (maybe), but mod packs tend to add a lot of blocks

If I recall correctly, the original challenge was Vanilla, CC, and Railcraft (for its chunk loader); it won't be expecting a lot of different items when it mines.

Edited by Lupus590, 14 January 2019 - 08:22 PM.


#104 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 14 January 2019 - 11:47 PM

Given that it reserves the first half of its inventory for "whatever it happens to carry down from the surface", there are still enough that it can max out the remaining slots before finding diamonds. It's just "less likely" to do so.

#105 Inksaver

  • Members
  • 61 posts

Posted 11 May 2019 - 05:28 PM

If I could get this forum to email me when a post is made, I would respond much faster, but to catch up with the comments from January 2019, here goes:
When debugging the program, the main() function can be progressively commented out so the whole process is done in stages. Follow these steps to get as far as you can, which makes fixing the problem faster.
  • 1. Create your world, place the reeds, and add the code to the turtle, either from pastebin get, or manually downloading the file and putting it in the correct place. Assume the world is called "Self Replicate" for this tutorial purpose.

  • 2. Copy this world and rename it with a suffix , say "Self Replicate00". Do NOT run the program on this world! Even better move it to a different folder on your PC

  • 3. Rename the copy world "Self Replicate01current" - this is the world you will be running the code in

  • 4. Edit the code on the "Self Replicate01current" using Notepad++, Atom or similar to comment out code starting with "if status == 2 then" (currently line 4838) to the end of function main(). This will force the script to stop once all the necessary trees have been harvested, and it is ready to move on to digging the first vertical mineshaft.

  • 5. Copy "Self Replicate01current" and rename the copy to "Self Replicate01". Move this copy elsewhere, (along with "Self Replicate00") to keep them safe.

  • 6. Load and run "Self Replicate01current"

  • 7. If all goes well
{
  • Edit the code in "Self Replicate01current" to un-comment the next process, starting with "if status == 3 then" (currently line 4844)
  • Rename the world to "Self Replicate02"
  • Copy "Self Replicate02".
  • Rename the copy to "Self Replicate02current"
  • Move "Self Replicate02" elsewhere
  • Load and run "Self Replicate02current"
}
else
{
  • Delete "Self Replicate01current".
  • Copy "Self Replicate01" back to the saves folder. It is now ready for debugging.
  • break (Stop here.)
}
You get the idea. You are building a series of worlds where an increasing amount of the script is successful. You can make changes to the script and test it out without going through the whole process again.
main() will determine how far you have got with the line "local status = tonumber(loadStatus("currentStatus.txt"))"

It is now over to you to try and read through the code and alter it where necessary.

If anybody has a world that keep on failing, if you can share it on Dropbox / Google Drive / possibly GitHub. I will see if I can get it working.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users