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



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

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

#fields_between(_column, _row) ⇒ Object



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

def fields_between(_column, _row)
  []
end

#initiialize(*args) ⇒ Object



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

def initiialize(*args)
  super(args)
end

#nameObject



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

def name
  'N'
end