2020-09-21 12:01:54 +02:00
|
|
|
#!/usr/bin/env luajit
|
|
|
|
|
2020-09-28 12:53:04 +02:00
|
|
|
math.randomseed(os.time()) --set randomseed
|
2020-09-21 12:01:54 +02:00
|
|
|
local function create_random_level(width, height, layers)
|
|
|
|
io.write(width, "\n")
|
|
|
|
io.write(height, "\n")
|
|
|
|
for i = 1, layers, 1 do
|
|
|
|
for r = 1, width * height, 1 do
|
2020-12-22 16:46:00 +01:00
|
|
|
io.write(math.floor(math.random() * 1.5)) --random 0 (2/3) or 1 (1/3)
|
2020-09-21 12:01:54 +02:00
|
|
|
io.write("\n")
|
|
|
|
end
|
|
|
|
if i ~= layers then
|
|
|
|
io.write("n\n")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-12-30 16:08:43 +01:00
|
|
|
create_random_level(64, 64, 1)
|