Class: Lernen::System::MooreLikeSimulator

Inherits:
MooreLikeSUL show all
Defined in:
lib/lernen/system/moore_like_simulator.rb

Overview

MooreLikeSimulator is a system under learning (SUL) using a Moore-like machine simulation.

Instance Method Summary collapse

Methods inherited from SUL

#query, #query_last, #stats

Constructor Details

#initialize(automaton, cache: true) ⇒ MooreLikeSimulator

: (Automaton::MooreLike[Conf, In, Out] automaton, ?cache: bool) -> void



16
17
18
19
20
21
# File 'lib/lernen/system/moore_like_simulator.rb', line 16

def initialize(automaton, cache: true)
  super(cache:)

  @automaton = automaton
  @current_conf = nil
end

Instance Method Details

#query_emptyObject



40
41
42
# File 'lib/lernen/system/moore_like_simulator.rb', line 40

def query_empty
  @automaton.run_empty
end

#setupObject



24
25
26
# File 'lib/lernen/system/moore_like_simulator.rb', line 24

def setup
  @current_conf = @automaton.initial_conf
end

#shutdownObject



29
30
31
# File 'lib/lernen/system/moore_like_simulator.rb', line 29

def shutdown
  @current_conf = nil
end

#step(input) ⇒ Object



34
35
36
37
# File 'lib/lernen/system/moore_like_simulator.rb', line 34

def step(input)
  output, @current_conf = @automaton.step(@current_conf, input) # steep:ignore
  output
end