Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Clears screen, sets cursor position
- term.clear()
- term.setCursorPos(1,1)
- -- Sets maxx and maxy for screen resolution
- maxx, maxy = term.getSize()
- -- Sets maxr as the maximum of randomization
- maxr = 4
- -- Creates an empty table
- all = {}
- -- Sets for every pixel 1 or 0
- -- i are the lines, j are the pixels in a line
- for i = 1, maxx do
- all[i] = {}
- for j = 1, maxy do
- r = math.random(0, maxr)
- if r > 1 then
- r = 0
- end
- all[i][j] = r
- end
- end
- -- Fills the entire screen with the pixels
- -- from the table
- for i = 1, #all do
- for j = 1, #all[i] do
- if all[i][j] == 1 then
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.black)
- else
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.white)
- end
- --
- -- this works well as long as it's all[i][j]
- write(all[i][j])
- -- now try to change it to " "
- --
- sleep(0.01)
- end
- end
- -- just to let you see the outcome
- sleep(5)
Advertisement
Add Comment
Please, Sign In to add comment