Class: Bchess::Game
- Inherits:
-
Object
- Object
- Bchess::Game
- Defined in:
- lib/bchess/game.rb
Instance Attribute Summary collapse
-
#board ⇒ Object
readonly
Returns the value of attribute board.
-
#fen ⇒ Object
readonly
Returns the value of attribute fen.
-
#moves ⇒ Object
readonly
Returns the value of attribute moves.
Instance Method Summary collapse
- #add_move(move) ⇒ Object
-
#initialize(fen = '') ⇒ Game
constructor
A new instance of Game.
- #validate_game ⇒ Object
Constructor Details
Instance Attribute Details
#board ⇒ Object (readonly)
Returns the value of attribute board.
3 4 5 |
# File 'lib/bchess/game.rb', line 3 def board @board end |
#fen ⇒ Object (readonly)
Returns the value of attribute fen.
3 4 5 |
# File 'lib/bchess/game.rb', line 3 def fen @fen end |
#moves ⇒ Object (readonly)
Returns the value of attribute moves.
3 4 5 |
# File 'lib/bchess/game.rb', line 3 def moves @moves end |
Instance Method Details
#add_move(move) ⇒ Object
11 12 13 |
# File 'lib/bchess/game.rb', line 11 def add_move(move) moves << move end |
#validate_game ⇒ Object
15 16 17 18 19 |
# File 'lib/bchess/game.rb', line 15 def validate_game moves.all? do |move| board.execute(move) end end |