lib/interpreter/interpreter.rb in nudge-0.1.1 vs lib/interpreter/interpreter.rb in nudge-0.1.2
- old
+ new
@@ -11,22 +11,22 @@
# * ... if it's not bound, push the name itself onto the <b>:name</b> Stack;
# * ... CodeblockPoint, push its #contents (in the same order) back onto the <b>:exec</b> Stack
# * ... NilPoint, do nothing
class Interpreter
- attr_accessor :program, :stepLimit, :steps
+ attr_accessor :program, :step_limit, :steps
attr_accessor :stacks, :instructions_library, :variables, :names, :types
attr_accessor :last_name, :evaluate_references
attr_accessor :sensors
# A program to be interpreted can be passed in as an optional parameter
def initialize(params = {})
initialProgram = params[:program] || nil
@program = initialProgram
@types = params[:types] || NudgeType.all_types
- @stepLimit = params[:step_limit] || 3000
+ @step_limit = params[:step_limit] || 3000
@sensors = Hash.new
instructions = params[:instructions] || Instruction.all_instructions
@instructions_library = Hash.new {|hash, key| raise InstructionPoint::InstructionNotFoundError,
"#{key} is not an active instruction in this context"}
@@ -103,12 +103,12 @@
# Checks to see if either stopping condition applies:
# 1. Is the <b>:exec</b> stack empty?
- # 2. Are the number of steps greater than self.stepLimit?
+ # 2. Are the number of steps greater than self.step_limit?
def notDone?
- @stacks[:exec].depth > 0 && @steps < @stepLimit
+ @stacks[:exec].depth > 0 && @steps < @step_limit
end
# Execute one cycle of the Push3 interpreter rule:
# 1. check termination conditions with self.notDone()?
\ No newline at end of file