class Rchess::Paths::Knight

Public Instance Methods

paths() click to toggle source
# File lib/rchess/paths/knight.rb, line 4
def paths
  [l_paths].flatten(1)
end

Private Instance Methods

l_paths() click to toggle source
# File lib/rchess/paths/knight.rb, line 10
def l_paths
  [
    [{ x: 1, y: 2 }],
    [{ x: -1, y: 2 }],
    [{ x: 1, y: -2 }],
    [{ x: -1, y: -2 }],
    [{ x: 2, y: 1 }],
    [{ x: -2, y: 1 }],
    [{ x: 2, y: -1 }],
    [{ x: -2, y: -1 }]
  ]
end