我只是想创建一个用对象填充数组的函数,但是出了点问题:
row1 = []
class Tile
def initialize(type)
@type = type
end
end
def FillRow1
[1..10].each {
random = rand(1..3)
if random == 1 row1.(Tile.new("land") end
else if random == 2 row1.(Tile.new("Water") end
else ifrandom == 3 row1.(Tile.new("empty") end
}
row1
end