Posted 18 March 2012 - 11:50 PM
Hello,
I'm currently making a Mining Turtle which flattens land out, and the user specifies amount of blocks forward, amount of blocks to the right, and amount of blocks to go up.
I've got it working but I have had to limit the maximum size to the right to 80, as the way I have programmed it I need to whether or not a number is odd.
At the moment I have something similar to this:
I tried using math.mod but it didn't seem to work, and this way is limitted to the size of the array.
So anyone got any suggestions?
Thanks
Evan.
I'm currently making a Mining Turtle which flattens land out, and the user specifies amount of blocks forward, amount of blocks to the right, and amount of blocks to go up.
I've got it working but I have had to limit the maximum size to the right to 80, as the way I have programmed it I need to whether or not a number is odd.
At the moment I have something similar to this:
odd = {1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79}
input = readln()
num = tonumber(input)
found = false
for a=1,40 do
if odd[a] == num then
found = true
break
end
end
if found == true
print("Odd")
else
print("Even")
end
I tried using math.mod but it didn't seem to work, and this way is limitted to the size of the array.
So anyone got any suggestions?
Thanks
Evan.