Class: Rook
- 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
Instance Method Summary collapse
-
#initialize(board, location, color) ⇒ Rook
constructor
A new instance of Rook.
Methods included from CastlingPieceControl
Methods included from SlidePattern
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 |