Class: JustXiangqi::Xiang
- Defined in:
- lib/just_xiangqi/pieces/xiang.rb
Overview
Xiang
The piece that can move 2 spaces diagonally on its side of the river
Instance Method Summary collapse
-
#destinations(square, game_state) ⇒ SquareSet
All the squares that the piece can move to and/or capture.
Methods inherited from Piece
Constructor Details
This class inherits a constructor from JustXiangqi::Piece
Instance Method Details
#destinations(square, game_state) ⇒ SquareSet
All the squares that the piece can move to and/or capture.
18 19 20 |
# File 'lib/just_xiangqi/pieces/xiang.rb', line 18 def destinations(square, game_state) players_side_squares(game_state).diagonal(square).at_range(square, 2).unoccupied_or_occupied_by_opponent(player_number) end |