Class: KnightsTour::StringResult
- Inherits:
-
Object
- Object
- KnightsTour::StringResult
- Defined in:
- lib/knights_tour.rb
Instance Method Summary collapse
-
#initialize(result) ⇒ StringResult
constructor
A new instance of StringResult.
- #to_s ⇒ Object
Constructor Details
#initialize(result) ⇒ StringResult
Returns a new instance of StringResult.
139 140 141 142 143 144 145 |
# File 'lib/knights_tour.rb', line 139 def initialize(result) if result.is_a?(Knight) @result = board_to_s(result.board, result.steps_taken) else @result = "No solution found." end end |
Instance Method Details
#to_s ⇒ Object
147 148 149 |
# File 'lib/knights_tour.rb', line 147 def to_s @result end |