如何在Swift Playground - World Creation中建造金字塔?

How to build a pyramid in Swift Playground - World Creation?

我尝试用游乐场积木搭建金字塔,但我不明白应该如何更改条件以移除多余的积木?

let allCoordinates = world.allPossibleCoordinates
var index = 0

while index != 11 { 
    for coordinate in allCoordinates { 
        if coordinate.row == index || coordinate.column == index || coordinate.row == 11 - index || coordinate.column == 11 - index { 
                for _ in 0...index {
                    world.place(Block(), at: coordinate)
            }
        }
    }
    index += 1
        }
let allCoordinates = world.allPossibleCoordinates
var index = [0, 11]

while index[0] != 11 { 
    for coordinate in allCoordinates { 
        if coordinate.row > index[0] && coordinate.column < index[1] {
            if coordinate.column > index[0] && coordinate.row < index [1] { 
                world.place(Block(), at: coordinate)   
            }
        }
    }
    index[0] += 1
    index[1] -= 1
}