Class: Longjing::Problem
- Inherits:
-
Object
- Object
- Longjing::Problem
- Defined in:
- lib/longjing/problem.rb
Instance Attribute Summary collapse
-
#all_actions ⇒ Object
readonly
Returns the value of attribute all_actions.
-
#goal ⇒ Object
readonly
Returns the value of attribute goal.
-
#initial ⇒ Object
readonly
Returns the value of attribute initial.
Instance Method Summary collapse
- #actions(state) ⇒ Object
- #goal?(state) ⇒ Boolean
-
#initialize(actions, init, goal) ⇒ Problem
constructor
A new instance of Problem.
- #result(action, state) ⇒ Object
Constructor Details
Instance Attribute Details
#all_actions ⇒ Object (readonly)
Returns the value of attribute all_actions.
6 7 8 |
# File 'lib/longjing/problem.rb', line 6 def all_actions @all_actions end |
#goal ⇒ Object (readonly)
Returns the value of attribute goal.
6 7 8 |
# File 'lib/longjing/problem.rb', line 6 def goal @goal end |
#initial ⇒ Object (readonly)
Returns the value of attribute initial.
6 7 8 |
# File 'lib/longjing/problem.rb', line 6 def initial @initial end |
Instance Method Details
#actions(state) ⇒ Object
18 19 20 21 22 |
# File 'lib/longjing/problem.rb', line 18 def actions(state) @all_actions.select do |action| action.precond.applicable?(state.raw) end end |
#goal?(state) ⇒ Boolean
14 15 16 |
# File 'lib/longjing/problem.rb', line 14 def goal?(state) @goal.applicable?(state.raw) end |