function love.load() sequence = {} function addToSequence() table.insert(sequence, love.math.random(4)) end addToSequence() current = 1 love.graphics.setNewFont(20) end function love.keypressed(key) if tonumber(key) == sequence[current] then current = current + 1 if current > #sequence then current = 1 addToSequence() end else love.load() end end function love.draw() local squareSize = 50 love.graphics.setColor(.2, 0, 0) love.graphics.rectangle('fill', 0, 0, squareSize, squareSize) love.graphics.setColor(1, 1, 1) love.graphics.print(1, 19, 14) love.graphics.setColor(0, .2, 0) love.graphics.rectangle('fill', squareSize, 0, squareSize, squareSize) love.graphics.setColor(1, 1, 1) love.graphics.print(2, squareSize + 19, 14) love.graphics.setColor(0, 0, .2) love.graphics.rectangle('fill', squareSize * 2, 0, squareSize, squareSize) love.graphics.setColor(1, 1, 1) love.graphics.print(3, squareSize * 2 + 19, 14) love.graphics.setColor(.2, .2, 0) love.graphics.rectangle('fill', squareSize * 3, 0, squareSize, squareSize) love.graphics.setColor(1, 1, 1) love.graphics.print(4, squareSize * 3 + 19, 14) love.graphics.print(current..'/'..#sequence, 20, 60) love.graphics.print('sequence[current]: '..sequence[current], 20, 100) love.graphics.print(table.concat(sequence, ', '), 20, 140) end