Class: RSokoban::MoveResult
- Inherits:
-
Object
- Object
- RSokoban::MoveResult
- Defined in:
- lib/rsokoban/move_result.rb
Overview
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#error? ⇒ Boolean
True if move is an error.
-
#initialize(hash) ⇒ MoveResult
constructor
A new instance of MoveResult.
-
#ok? ⇒ Boolean
True if move is ok.
-
#win? ⇒ Boolean
True if move result to winning the game.
Constructor Details
#initialize(hash) ⇒ MoveResult
Returns a new instance of MoveResult.
12 13 14 |
# File 'lib/rsokoban/move_result.rb', line 12 def initialize hash @hash = hash end |
Instance Method Details
#[](key) ⇒ Object
16 17 18 |
# File 'lib/rsokoban/move_result.rb', line 16 def [](key) @hash[key] end |
#error? ⇒ Boolean
Returns true if move is an error.
31 32 33 |
# File 'lib/rsokoban/move_result.rb', line 31 def error? @hash[:status] == :error end |
#ok? ⇒ Boolean
Returns true if move is ok.
21 22 23 |
# File 'lib/rsokoban/move_result.rb', line 21 def ok? @hash[:status] == :ok end |
#win? ⇒ Boolean
Returns true if move result to winning the game.
26 27 28 |
# File 'lib/rsokoban/move_result.rb', line 26 def win? @hash[:status] == :win end |