Class: Bchess::Knight

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

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, #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)


12
13
14
# File 'lib/bchess/knight.rb', line 12

def can_move_to_field?(dcolumn, drow)
  super && by_jump(dcolumn, drow)
end

#fields_between(column, row) ⇒ Object



16
17
18
# File 'lib/bchess/knight.rb', line 16

def fields_between(column, row)
  []
end

#initiialize(*args) ⇒ Object



4
5
6
# File 'lib/bchess/knight.rb', line 4

def initiialize(*args)
  super(args)
end

#nameObject



8
9
10
# File 'lib/bchess/knight.rb', line 8

def name
  'N'
end