
monitor = peripheral.wrap("left")
door = false
function rndl()
  return string.char(math.random(97,122));
end
function doorctrl(d)
  redstone.setOutput("right",door)
  return not d
end

function screenprinter()
  while true do
    for i = 1, 29, 1 do
      for t = 1, 19,1 do
        print(i.." "..t)
        monitor.setCursorPos(i,t)
        monitor.write(rndl())
        sleep(0.1)
      end
    end
  end
end

function doorloop()
  d = false
  while true do
    local event, param = os.pullEvent("key")
    if event == "key" then
      redstone.setOutput("top", d)
      door = not door
    end
  end
end
local sprinter = coroutine.create(screenprinter)
local dloop = coroutine.create(doorloop)
coroutine.resume(sprinter)
coroutine.resume(dloop)
while true do
end
 
