2015-07-30 18:18:12 +02:00
|
|
|
require_relative "../helper"
|
|
|
|
require "interpreter/interpreter"
|
2015-09-27 21:39:10 +02:00
|
|
|
|
|
|
|
module Ticker
|
|
|
|
def ticks num
|
|
|
|
last = nil
|
|
|
|
num.times do
|
|
|
|
last = @interpreter.instruction
|
|
|
|
@interpreter.tick
|
|
|
|
end
|
|
|
|
return last
|
|
|
|
end
|
2015-10-16 18:04:17 +02:00
|
|
|
|
|
|
|
def show_ticks
|
|
|
|
classes = []
|
|
|
|
error = nil
|
|
|
|
tick = 1
|
|
|
|
begin
|
2015-10-19 13:46:12 +02:00
|
|
|
while true and (classes.length < 200)
|
2015-10-16 18:04:17 +02:00
|
|
|
cl = ticks(1).class
|
|
|
|
tick += 1
|
|
|
|
classes << cl
|
|
|
|
break if cl == NilClass
|
|
|
|
end
|
|
|
|
rescue => e
|
|
|
|
puts "Error at tick #{tick}"
|
|
|
|
puts e
|
|
|
|
end
|
|
|
|
classes = classes.collect {|c| '"' + c.name.sub("Register::","") + '",' }
|
2015-10-18 16:20:19 +02:00
|
|
|
classes << "length = #{classes.length}"
|
2015-10-16 18:04:17 +02:00
|
|
|
classes.each_slice(5).each do |line|
|
|
|
|
puts " " + line.join
|
|
|
|
end
|
|
|
|
exit(1)
|
|
|
|
end
|
2015-09-27 21:39:10 +02:00
|
|
|
end
|