Class: Noofakku::VM

Inherits:
Object
  • Object
show all
Defined in:
lib/noofakku.rb

Class Method Summary collapse

Class Method Details

.start(program, input, output) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/noofakku.rb', line 14

def self.start(program, input, output)
	processor = Processor.new(Hash.new(Noop.new).merge!({
  	'>' => Next.new,
  	'<' => Prev.new,
  	'+' => Inc.new,
  	'-' => Dec.new,
  	'.' => Output.new,
  	',' => Input.new,
  	'[' => OpenBracket.new('[', ']'),
  	']' => ClosedBracket.new('[', ']')
  }))
  processor.run(program.clone.freeze, Array.new(30_000, 0), input, output)
end