From 08b83bdb5fadab00a723ff57b92459847d9b32ee Mon Sep 17 00:00:00 2001 From: Joshua Moerman Date: Tue, 1 May 2012 16:50:50 +0200 Subject: [PATCH] bugfix --- py_tree | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/py_tree b/py_tree index 18b5b0c..6b0df53 100644 --- a/py_tree +++ b/py_tree @@ -1,6 +1,5 @@ --- will make a pythagorian tree-like thing with a given depth (depth 0 are leaves) +-- will make a pythagoras tree-like thing with a given depth (depth 0 are leaves) -- this is a costy operation and takes lots of blocks (you can refill during the build) --- depth 1 => 8 blocks, depth 2 => 64 blocks, depth 3 => ~384 blocks, depth n => 2^(2n + 1)*n (some blocks may overlap) -- we will always face to the tree and not move forward -- orientation will define left/right/up/down @@ -30,13 +29,16 @@ local function bright() end local function select_non_empty( ) - local i = 1 - while turtle.getItemCount(i) == 0 do i = i+1 end - if not turtle.select(i) then - print("ERROR: I'm empty, press any key to continue, waiting for filling plz") - while turtle.getItemCount(9) == 0 do end - select_non_empty() + for i = 1, 9 do + if turtle.getItemCount(i) > 0 then + turtle.select(i) + return + end end + + turtle.select(1) + print("ERROR: I'm empty, plz refill me!") + while turtle.getItemCount(1) == 0 do sleep(2) end end local function place()