Sha256: e38544ebfd168d30fc0df9350d5462408c0a55add4199f43f2291914a951fbb6
Contents?: true
Size: 974 Bytes
Versions: 8
Compression:
Stored size: 974 Bytes
Contents
# frozen-string-literal: true # http://www2.computer-shogi.org/protocol/record_v22.html module Bioshogi module Board # P1-KY-KE-GI-KI-OU-KI-GI-KE-KY # P2 * -HI * * * * * -KA * # P3-FU-FU-FU-FU-FU-FU-FU-FU-FU # P4 * * * * * * * * * # P5 * * * * * * * * * # P6 * * * * * * * * * # P7+FU+FU+FU+FU+FU+FU+FU+FU+FU # P8 * +KA * * * * * +HI * # P9+KY+KE+GI+KI+OU+KI+GI+KE+KY class CsaFormatter def initialize(board) @board = board end def to_s Dimension::PlaceY.dimension.times.collect { |y| "P#{y.next}" + Dimension::PlaceX.dimension.times.collect { |x| place = Place.fetch([x, y]) soldier_to_str(@board.surface[place]) }.join + "\n" }.join end private def soldier_to_str(soldier) if soldier soldier.to_csa_bod else " * " end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems