Class: ConsoleShogi::Hisha
- Inherits:
-
Piece
- Object
- Piece
- ConsoleShogi::Hisha
show all
- Defined in:
- lib/console_shogi/piece.rb
Constant Summary
collapse
- NUMBER =
7
Instance Attribute Summary
Attributes inherited from Piece
#teban
Instance Method Summary
collapse
Methods inherited from Piece
#active_image, #can_move_long_distance?, #change_player!, #focused_image, #fu?, #image, #initialize, #move, #moves, #none?, #number, #promote, #promoted?, #same?
Instance Method Details
#base_moves ⇒ Object
219
220
221
222
223
224
225
226
227
228
|
# File 'lib/console_shogi/piece.rb', line 219
def base_moves
(1..8).flat_map {|n|
[
{x: 0, y: -1 * n},
{x: 0, y: 1 * n},
{x: -1 * n, y: 0},
{x: 1 * n, y: 0}
]
}
end
|
230
231
232
|
# File 'lib/console_shogi/piece.rb', line 230
def can_promote?
true
end
|
234
235
236
|
# File 'lib/console_shogi/piece.rb', line 234
def promoted
PromotedPiece::Ryu.new(original: self)
end
|