Posted 01 September 2012 - 05:36 PM
hi guys,
I am VERY new to programming but am relay enjoying learning,
anyway here is my question
I have managet to get turtles to go out plant trees and evan made programs for a turtle to chop down a tree ( I know! how clever am I)
but what i am trying to do is save a chunk of programing into something short i can re use ie
turtle.forward()
chop down tree
turtle forward 5 spces
chop down another tree
and so on and so on
( i know this is not close to correct prgraming but just to get my idea forward)
so what i want is "chop down tree" to contain all the programing information so that i dont have to write the entire thing for each tree that will be choped down.
chop down tree =
x = 0
while turtle.detectUp do
turtle.digUp()
turtle.Up
x = x+1
end
while not turtle.detectUp() and x > 0 do
turtle.down()
x = x-1
end
if this makes any seance and you can help me, i would be verry happy
I am VERY new to programming but am relay enjoying learning,
anyway here is my question
I have managet to get turtles to go out plant trees and evan made programs for a turtle to chop down a tree ( I know! how clever am I)
but what i am trying to do is save a chunk of programing into something short i can re use ie
turtle.forward()
chop down tree
turtle forward 5 spces
chop down another tree
and so on and so on
( i know this is not close to correct prgraming but just to get my idea forward)
so what i want is "chop down tree" to contain all the programing information so that i dont have to write the entire thing for each tree that will be choped down.
chop down tree =
x = 0
while turtle.detectUp do
turtle.digUp()
turtle.Up
x = x+1
end
while not turtle.detectUp() and x > 0 do
turtle.down()
x = x-1
end
if this makes any seance and you can help me, i would be verry happy