local accumulatorSlot = 1
local fireboxSlot = 2
local boilerSlot = 3
local liquidductSlot = 4
local steamconsumerSlot = 5
local energybridgeSlot = 6
local producerSlot = 7
 
function select(nr)
    turtle.select(nr)
end
 
function a()
    turtle.turnLeft()
    i = turtle.forward()
    if i then
        turtle.turnRight()
    else
        sleep(1)
        turtle.turnRight()
        print("GTFO xD")
        a()
    end
end
 
function d()
    turtle.turnRight()
    i = turtle.forward()
    if i then
        turtle.turnLeft()
    else
        sleep(1)
        turtle.turnLeft()
        print("GTFO xD")
        d()
    end
end
 
function w()
    i = turtle.forward()
    if i then
        sleep(0)
    else
        sleep(1)
        print("GTFO xD")
        w()
    end
end
 
function s()
    i = turtle.back()
    if i then
        sleep(0)
    else
        sleep(1)
        print("GTFO xD")
        s()
    end
end
 
function up()
    i = turtle.up()
    if i then
        sleep(0)
    else
        sleep(1)
        print("GTFO xD")
        up()
    end
end
 
function down()
    i = turtle.down()
    if i then
        sleep(0)
    else
        sleep(1)
        print("GTFO xD")
        down()
    end
end
 
function place()
    i = turtle.placeDown()
    if i then
        sleep(0)
    else
        turtle.digDown()
        sleep(0.2)
        print("Can't place? do I have enoughmaterials?")
        place()
    end
end
 
function fill()
    place()
    w()
    place()
    d()
    place()
    s()
    place()
    s()
    place()
    a()
    place()
    a()
    place()
    w()
    place()
    w()
    place()
    d()
    s()
end
 
print("is the turtle positioned like this?")
print("xxxxx")
print("xooox")
print("xooox")
print("xooox")
print("xx*xx")
print("It doesn't matter what x is")
print("o is water")
print("* is the turtle")
print("if not make it like shown above, then type yes")
write (">") input = io.read()
if input == "yes" then
    term.clear()
else
    end
 
print("Do you have a space of 3*3*8 free above the water?")
print("if not make it free, then type yes")
if input == "yes" then
    term.clear()
else
    end
 
print("Put atleast one aqueous accumulator in slot 1")
print("Put atleast nine fireboxes (liquid or solid fueled) in slot 2")
print("Put atleast 36 high pressure boilers in slot 3")
print("slots are counted from top left to bottom right")
print("once you've put the items in type yes")
write (">") input = io.read()
if input == "yes" then
    term.clear()
else
    end
 
print("Put atleast four liquidducts in slot 4")
print("Put atleast four steam consumers in slot 5")
print("Put atleast one energy bridge in slot 6")
print("Put atleast one producer (bc, LV, MV, HV, EV) in slot 7")
print("once you've put the items in type yes")
write (">") input = io.read()
if input == "yes" then
    term.clear()
else
    end
 
if turtle.getItemCount(1) >= 1 then
    sleep(0)
else
    print("Put atleast one aqueous accumulator in slot 1")
    print("once you've put it in type yes")
    write (">") input = io.read()
end
if input == "yes" then
    term.clear()
else
    end
 
 
if turtle.getItemCount(2) >= 9 then
    sleep(0)
else
    print("Put atleast nine fireboxes (liquid or solid fueled) in slot 2")
    print("once you've put it in type yes")
    write (">") input = io.read()
end
if input == "yes" then
    term.clear()
else
    end
 
 
if turtle.getItemCount(3) >= 36 then
    sleep(0)
else
    print("Put atleast 36 high pressure boilers in slot 3")
    print("once you've put it in type yes")
    write (">") input = io.read()
end
if input == "yes" then
    term.clear()
else
    end
 
 
if turtle.getItemCount(4) >= 4 then
    sleep(0)
else
    print("Put atleast four liquidducts in slot 4")
    print("once you've put it in type yes")
    write (">") input = io.read()
end
if input == "yes" then
    term.clear()
else
    end
 
 
if turtle.getItemCount(5) >= 4 then
    sleep(0)
else
    print("Put atleast four steam consumers in slot 5")
    print("once you've put it in type yes")
    write (">") input = io.read()
end
if input == "yes" then
    term.clear()
else
    end
 
 
if turtle.getItemCount(6) >= 1 then
    sleep(0)
else
    print("Put atleast one energy bridge in slot 6")
    print("once you've put it in type yes")
    write (">") input = io.read()
end
if input == "yes" then
    term.clear()
else
    end
 
 
if turtle.getItemCount(7) >= 1 then
    sleep(0)
else
    print("Put atleast one producer (bc, LV, MV, HV, EV) in slot 7")
    print("once you've put it in type yes")
    write (">") input = io.read()
end
if input == "yes" then
    term.clear()
else
    end
 
 
term.clear()
 
print("thats all I need, type go to turn me on")
write (">") input = io.read()
if input == "go" then
    term.clear()
    print("Starting!")
else
    end
 
 
select(accumulatorSlot)
w()
w()
place()
turtle.up()
select(fireboxSlot)
fill()
turtle.up()
select(boilerSlot)
fill()
turtle.up()
select(boilerSlot)
fill()
turtle.up()
select(boilerSlot)
fill()
turtle.up()
select(boilerSlot)
fill()
turtle.up()
select(energybridgeSlot)
place()
select(steamconsumerSlot)
w()
place()
s()
a()
place()
d()
d()
place()
a()
s()
place()
select(liquidductSlot)
a()
place()
w()
w()
place()
d()
d()
place()
s()
s()
place()
a()
w()
turtle.up()
select(producerSlot)
place()
print("Done")