Class: Rook

Inherits:
Piece show all
Includes:
CastlingPieceControl, SlidePattern
Defined in:
lib/sapphire-chess/pieces/rook.rb

Constant Summary collapse

MOVE_DIRECTIONS =
[
  [0, 1], [0, -1], [1, 0], [-1, 0]
].freeze
BLACK =
''
WHITE =
''
VALUE =
500
WHITE_LOCATION_VALUE =
[
  [0, 0, 0, 0, 0, 0, 0, 0],
  [5, 10, 10, 10, 10, 10, 10, 5],
  [-5, 0, 0, 0, 0, 0, 0, -5],
  [-5, 0, 0, 0, 0, 0, 0, -5],
  [-5, 0, 0, 0, 0, 0, 0, -5],
  [-5, 0, 0, 0, 0, 0, 0, -5],
  [-5, 0, 0, 0, 0, 0, 0, -5],
  [0, 0, 0, 5, 5, 0, 0, 0]
].freeze
BLACK_LOCATION_VALUE =
[
  [0, 0, 0, 5, 5, 0, 0, 0],
  [-5, 0, 0, 0, 0, 0, 0, -5],
  [-5, 0, 0, 0, 0, 0, 0, -5],
  [-5, 0, 0, 0, 0, 0, 0, -5],
  [-5, 0, 0, 0, 0, 0, 0, -5],
  [-5, 0, 0, 0, 0, 0, 0, -5],
  [5, 10, 10, 10, 10, 10, 10, 5],
  [0, 0, 0, 0, 0, 0, 0, 0]
].freeze
WHITE_LOCATION_VALUE_EASY =
[
  [0, 0, 0, 0, 0, 0, 0, 0],
  [5, 10, 10, 10, 10, 10, 10, 5],
  [-5, 5, 10, 10, 10, 5, 0, -5],
  [-5, 5, 10, 10, 10, 5, 0, -5],
  [-5, 5, 10, 10, 10, 5, 0, -5],
  [-5, 5, 10, 10, 10, 5, 0, -5],
  [-5, 0, 0, 0, 0, 0, 0, -5],
  [0, 0, 0, 5, 5, 0, 0, 0]
].freeze
BLACK_LOCATION_VALUE_EASY =
[
  [0, 0, 0, 5, 5, 0, 0, 0],
  [-5, 0, 0, 0, 0, 0, 0, -5],
  [-5, 0, 5, 10, 10, 5, 0, -5],
  [-5, 0, 5, 10, 10, 5, 0, -5],
  [-5, 0, 5, 10, 10, 5, 0, -5],
  [-5, 0, 5, 10, 10, 5, 0, -5],
  [5, 10, 10, 10, 10, 10, 10, 5],
  [0, 0, 0, 0, 0, 0, 0, 0]
].freeze

Instance Attribute Summary

Attributes inherited from Piece

#board, #color, #location

Instance Method Summary collapse

Methods included from CastlingPieceControl

#mark!, #moved?

Methods included from SlidePattern

#available_moves

Methods inherited from Piece

#location_value, #safe_moves, #to_s, #value

Constructor Details

#initialize(board, location, color) ⇒ Rook

Returns a new instance of Rook.



58
59
60
61
# File 'lib/sapphire-chess/pieces/rook.rb', line 58

def initialize(board, location, color)
  super
  @moved = false
end