Class: ConsoleShogi::PromotedPiece::Ryu

Inherits:
ConsoleShogi::PromotedPiece show all
Defined in:
lib/console_shogi/piece.rb

Constant Summary collapse

NUMBER =
11

Instance Attribute Summary

Attributes inherited from ConsoleShogi::PromotedPiece

#original

Attributes inherited from ConsoleShogi::Piece

#teban

Instance Method Summary collapse

Methods inherited from ConsoleShogi::PromotedPiece

#can_promote?, #initialize, #promoted?, #teban, #teban=

Methods inherited from ConsoleShogi::Piece

#active_image, #can_move_long_distance?, #change_player!, #focused_image, #fu?, #image, #initialize, #move, #moves, #none?, #number, #promote, #promoted?, #same?

Constructor Details

This class inherits a constructor from ConsoleShogi::PromotedPiece

Instance Method Details

#base_movesObject



326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
# File 'lib/console_shogi/piece.rb', line 326

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}
    ]
  } + [
    {x: -1, y: -1},
    {x: 1, y: -1},
    {x: -1, y: 1},
    {x: 1, y: 1}
  ]
end