Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local cmp = require("component")
- local gpu = cmp.gpu
- local event = require("event")
- local serialization = require("serialization")
- local unicode=require("unicode")
- local filesystem = require("filesystem")
- local shell = require("shell")
- local term = require("term")
- local uc=require('unicode')
- local computer = require("computer")
- local keyboard = require("keyboard")
- a,b=gpu.getResolution()
- local oldB=gpu.getBackground()
- local oldF=gpu.getForeground()
- local args={...}
- local len = uc.len
- local sub = uc.sub
- function drawMem()
- gpu.fill(1,1,10,1,' ')
- gpu.set(1,1,tostring(computer.freeMemory()))
- end
- log = {}
- function old()
- gpu.setBackground(oldB)
- gpu.setForeground(oldF)
- end
- function sq(x,y,w,h,col)
- gpu.setBackground(col)
- gpu.fill(x,y,w,h," ")
- end
- function req(x,y,back)
- find = false
- p = {gpu.get(x,y)}
- if p[3] == back then
- gpu.set(x,y,' ')
- find = true
- end
- drawMem()
- return find
- end
- function addLog(l)
- log[#log+1]=l
- end
- function check(back)
- ret = true
- if loc.x ~= a and req(loc.x+1,loc.y,back) == true then
- addLog('x+1')
- loc.x=loc.x+1
- elseif loc.x ~= 1 and req(loc.x-1,loc.y,back) == true then
- addLog('x-1')
- loc.x=loc.x-1
- elseif loc.y ~= b and req(loc.x,loc.y+1,back) == true then
- addLog('y+1')
- loc.y=loc.y+1
- elseif loc.y ~= 1 and req(loc.x,loc.y-1,back) == true then
- addLog('y-1')
- loc.y=loc.y-1
- else
- h = log[#log]
- if #log < 1 then
- ret = false
- elseif h == 'x-1' then
- loc.x=loc.x+1
- table.remove(log)
- elseif h == 'x+1' then
- loc.x=loc.x-1
- table.remove(log)
- elseif h == 'y-1' then
- loc.y=loc.y+1
- table.remove(log)
- elseif h == 'y+1' then
- loc.y=loc.y-1
- table.remove(log)
- end
- end
- return ret
- end
- function kost()
- u = gpu.getBackground()
- u1 = gpu.getForeground()
- o ={ gpu.get(1,1)}
- gpu.set(1,1,' ')
- k = {gpu.get(1,1)}
- true_color = k[3]
- gpu.setBackground(o[3])
- gpu.setForeground(o[2])
- gpu.set(1,1,o[1])
- gpu.setBackground(u)
- gpu.setForeground(u1)
- end
- shell.execute('draw pic.pic')
- gpu.setBackground(0x00FF00)
- kost()
- while true do
- -- gpu.setBackground(math.random(0x222222,0xFFFFFF))
- --e = {event.pull("touch")}
- e= {0,0,math.random(1,a),math.random(1,b)}
- t = {gpu.get(e[3],e[4])}
- loc={x=e[3],y=e[4]}
- log = {}
- g = gpu.getBackground()
- if t[3] ~= true_color then
- while true do
- if check(t[3]) and g ~= t[3] then
- else
- break
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement