Class: ConsoleShogi::Gin

Inherits:
Piece
  • Object
show all
Defined in:
lib/console_shogi/piece.rb

Constant Summary collapse

NUMBER =
4

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?

Constructor Details

This class inherits a constructor from ConsoleShogi::Piece

Instance Method Details

#base_movesObject



155
156
157
158
159
160
161
162
163
# File 'lib/console_shogi/piece.rb', line 155

def base_moves
  [
    {x: -1, y: -1},
    {x: 0, y: -1},
    {x: 1, y: -1},
    {x: 1, y: 1},
    {x: -1, y: 1}
  ]
end

#can_promote?Boolean

Returns:

  • (Boolean)


165
166
167
# File 'lib/console_shogi/piece.rb', line 165

def can_promote?
  true
end


169
170
171
# File 'lib/console_shogi/piece.rb', line 169

def promoted
  PromotedPiece::Narigin.new(original: self)
end