Class: Rchess::Paths::Bishop

Inherits:
Base
  • Object
show all
Defined in:
lib/rchess/paths/bishop.rb

Instance Attribute Summary

Attributes inherited from Base

#board, #coord

Instance Method Summary collapse

Methods inherited from Base

#destinations, #srcBox, #srcDirection, threaten_destinations_from_coord

Constructor Details

#initialize(params) ⇒ Bishop

Returns a new instance of Bishop.



4
5
6
7
# File 'lib/rchess/paths/bishop.rb', line 4

def initialize(params)
  @power = params.fetch(:power, 8)
  super(params)
end

Instance Method Details

#pathsObject



9
10
11
12
13
# File 'lib/rchess/paths/bishop.rb', line 9

def paths
  [diag_paths].flatten(1).select do |path|
    path.select
  end
end