Ascii - Pattern - Generator Qudwduuwfwufidii
Ascii - Pattern - Generator Qudwduuwfwufidii
math.randomseed(os.time())
-- Configuration
local width = 60
local height = 20
local patterns = {"wave", "spiral", "mandelbrot", "diamond"}
local cx, cy = w / 2, h / 2
for i = 0, 100 do
local angle = i * 0.3
local radius = i * 0.3
local x = math.floor(cx + radius * math.cos(angle))
local y = math.floor(cy + radius * math.sin(angle))
for y = 1, h do
local line = ""
for x = 1, w do
line = line .. grid[y][x]
end
print(line)
end
print()
end
-- Function to generate a random color code (for terminals that support it)
function get_random_color()
local colors = {31, 32, 33, 34, 35, 36, 37} -- ANSI color codes
return colors[math.random(#colors)]
end
-- Main execution
print("🎨 ASCII Pattern Generator 🎨")
print("Generating " .. #patterns .. " different patterns...\n")