class JustShogi::Keima
Keima
¶ ↑
The piece that jumps over pieces 2v1h forwards.
Public Instance Methods
destinations(square, game_state)
click to toggle source
All the suares that the piece can move to and/or capture.
@param [Square] square
the origin square.
@param [GameState] game_state
the current game state.
@return [SquareSet]
# File lib/just_shogi/pieces/keima.rb, line 19 def destinations(square, game_state) game_state.squares.in_direction(square, forwards_direction).ranks_away(square, 2).files_away(square, 1).unoccupied_or_occupied_by_opponent(player_number) end
has_legal_moves_from_y(y)
click to toggle source
# File lib/just_shogi/pieces/keima.rb, line 23 def has_legal_moves_from_y(y) if player_number == 1 y > 1 else y < 7 end end