class Bchess::Knight

Public Instance Methods

can_move_to_field?(dcolumn, drow) click to toggle source
Calls superclass method
# File lib/bchess/knight.rb, line 11
def can_move_to_field?(dcolumn, drow)
  super && by_jump(dcolumn, drow)
end
fields_between(_column, _row) click to toggle source
# File lib/bchess/knight.rb, line 15
def fields_between(_column, _row)
  []
end
initiialize(*args) click to toggle source
Calls superclass method
# File lib/bchess/knight.rb, line 3
def initiialize(*args)
  super(args)
end
name() click to toggle source
# File lib/bchess/knight.rb, line 7
def name
  'N'
end

Private Instance Methods

by_jump(dcolumn, drow) click to toggle source
# File lib/bchess/knight.rb, line 21
def by_jump(dcolumn, drow)
  (row - drow).abs + (column - dcolumn).abs == 3 &&
    (row - drow).abs != 3 && (column - dcolumn).abs != 3
end