Module: Shogi::Format::USI::Cell

Defined in:
lib/shogi/format/usi/cell.rb

Constant Summary collapse

USI_VERTICAL_LABELS =
{
  "1" => "a",
  "2" => "b",
  "3" => "c",
  "4" => "d",
  "5" => "e",
  "6" => "f",
  "7" => "g",
  "8" => "h",
  "9" => "i",
}

Instance Method Summary collapse

Instance Method Details

#piece_usiObject



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/shogi/format/usi/cell.rb', line 21

def piece_usi
  if @piece
    if @turn
      @piece.usi
    else
      @piece.usi.downcase
    end
  else
    1
  end
end

#place_usiObject



17
18
19
# File 'lib/shogi/format/usi/cell.rb', line 17

def place_usi
  "#{x}#{USI_VERTICAL_LABELS[y]}"
end