Skip to content

Instantly share code, notes, and snippets.

@Eiyeron
Created April 9, 2021 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Eiyeron/8bbe7aba1bb319af286711fe01413df8 to your computer and use it in GitHub Desktop.
Save Eiyeron/8bbe7aba1bb319af286711fe01413df8 to your computer and use it in GitHub Desktop.
Bubble Fortune
- Bubble Fortune -
-------------------
O o . . . .
O o O O . O
. . O . O o O .
O . O . . .
o o o O o . . o o
O . o .
O o O . O O . O
o . O O o O .
o o o o o . o o O
o O . O O O o O
-------------------
#!/usr/bin/lua
local width = 19
local height = 10
local set = " .oO"
local str = ""
local hypens = string.rep("-", width)
print "- Bubble Fortune -"
print(hypens)
math.randomseed(os.time())
for y = 1,height do
while #str < width do
local i = math.random(#set)
str = str .. set:sub(i,i) .. " "
end
local line = str:sub(1, width)
print(line)
str = str:sub(width+1)
end
print(hypens)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment