Class: Bchess::Bishop

Inherits:
Piece
  • Object
show all
Defined in:
lib/bchess/bishop.rb

Constant Summary collapse

BISHOP_REACH =
7

Instance Attribute Summary

Attributes inherited from Piece

#color, #column, #row

Instance Method Summary collapse

Methods inherited from Piece

#additional_info?, #at?, #black?, #by_diagonal, #by_line, #can_be_promoted?, #can_en_passant?, #can_make_move?, #can_move?, #can_move_or_take?, #can_take?, #can_take_on_field?, #clear_path?, #initialize, #move, #moved, #to_s, #valid?, #valid_position_after?, #white?

Methods included from FieldBetweenHelpers

#column_fields, #diagonal_fields, #fields_between, #row_fields

Methods included from BoardHelpers

#castle_detected?, #en_passant_detected?, #field, #invalid_data?, #kings_present?, #pawn_long_move_detected?, #promotion_detected?, #to_column, #to_row

Constructor Details

This class inherits a constructor from Bchess::Piece

Instance Method Details

#can_move_to_field?(dcolumn, drow) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/bchess/bishop.rb', line 13

def can_move_to_field?(dcolumn, drow)
  super && by_diagonal(dcolumn, drow, BISHOP_REACH)
end

#initiialize(*args) ⇒ Object



5
6
7
# File 'lib/bchess/bishop.rb', line 5

def initiialize(*args)
  super(args)
end

#nameObject



9
10
11
# File 'lib/bchess/bishop.rb', line 9

def name
  'B'
end