Class: Chess::Board

Inherits:
Object
  • Object
show all
Includes:
Boards::Grid, Boards::MovablePiece
Defined in:
lib/boardgame_engine/chess.rb

Overview

Class for a chessboard

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Boards::MovablePiece

#move_piece

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

#boardObject (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

#displayObject



58
59
60
# File 'lib/boardgame_engine/chess.rb', line 58

def display
  super(show_row: true, show_col: true)
end