This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Student08's profile picture

Need code for a 4x4 or 10x10 pyramid

Started by Student08, 05 December 2016 - 09:53 PM
Student08 #1
Posted 05 December 2016 - 10:53 PM
Title says it. Need help making a pyramid and havent done any lua/java before. If anyone has a code written for it, it would be appreciated!
KingofGamesYami #2
Posted 06 December 2016 - 01:53 AM
As with any problem in programming, you should start by breaking this into smaller steps (pun intended)

What is a pyramid but many layers of squares?

What are squares but multiple lines?

What are lines but multiple points?

How would you make a line?

10blockline

for i = 1, 10 do
  turtle.place()
  turtle.back()
end

Now that you can build a line, you need to figure out how to build a square. I'll let you figure that out yourself.

PS: This appears to be some sort of homework problem, so I'm going a bit light on the code part and focusing more on explanation