Class: ConsoleShogi::PromotedPiece::Uma

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

Constant Summary collapse

NUMBER =
10

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



306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
# File 'lib/console_shogi/piece.rb', line 306

def base_moves
  (1..8).flat_map {|n|
    [
      {x: -1 * n, y: -1 * n},
      {x: 1 * n, y: -1 * n},
      {x: -1 * n, y: 1 * n},
      {x: 1 * n, y: 1 * n}
    ]
  } + [
    {x: 0, y: -1},
    {x: 1, y: 0},
    {x: -1, y: 0},
    {x: 0, y: 1}
  ]
end