Class: Chess::Board
- Inherits:
-
Object
- Object
- Chess::Board
- Includes:
- Boards::Grid, Boards::MovablePiece
- Defined in:
- lib/boardgame_engine/chess.rb
Overview
Class for a chessboard
Instance Attribute Summary collapse
-
#board ⇒ Object
readonly
Returns the value of attribute board.
Instance Method Summary collapse
- #display ⇒ Object
-
#initialize(player1, player2) ⇒ Board
constructor
A new instance of Board.
Methods included from Boards::MovablePiece
Methods included from Boards::Grid
#clear_diag_path?, #clear_horz_path?, #clear_vert_path?, #consecutive?, #generate_board, #get_piece_at, #parse_input, #set_piece_at, #valid_board_input?
Constructor Details
#initialize(player1, player2) ⇒ Board
Returns a new instance of Board.
53 54 55 56 |
# File 'lib/boardgame_engine/chess.rb', line 53 def initialize(player1, player2) @board = generate_board(8, 8) setup(player1, player2) end |
Instance Attribute Details
#board ⇒ Object (readonly)
Returns the value of attribute board.
51 52 53 |
# File 'lib/boardgame_engine/chess.rb', line 51 def board @board end |
Instance Method Details
#display ⇒ Object
58 59 60 |
# File 'lib/boardgame_engine/chess.rb', line 58 def display super(show_row: true, show_col: true) end |