Sha256: 485d4a407cebab7bed89f1658acb28b96d8e0fd60980b25c1bc215cd16692a0d

Contents?: true

Size: 635 Bytes

Versions: 9

Compression:

Stored size: 635 Bytes

Contents

# frozen-string-literal: true

module Bioshogi
  class Player
    module PieceBoxMethods
      attr_writer :piece_box

      def piece_box
        @piece_box ||= PieceBox.new
      end

      def pieces_add(str = "歩9角飛香2桂2銀2金2玉")
        piece_box.add(Piece.s_to_h(str))
      end

      def pieces_set(str)
        piece_box.set(Piece.s_to_h(str))
      end

      def piece_box_as_header
        "#{call_name}の持駒:#{piece_box.to_s.presence || "なし"}"
      end

      def to_sfen
        piece_box.to_sfen(location)
      end

      def to_csa
        piece_box.to_csa(location)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
bioshogi-0.0.15 lib/bioshogi/player/piece_box_methods.rb
bioshogi-0.0.14 lib/bioshogi/player/piece_box_methods.rb
bioshogi-0.0.10 lib/bioshogi/player/piece_box_methods.rb
bioshogi-0.0.9 lib/bioshogi/player/piece_box_methods.rb
bioshogi-0.0.8 lib/bioshogi/player/piece_box_methods.rb
bioshogi-0.0.7 lib/bioshogi/player/piece_box_methods.rb
bioshogi-0.0.5 lib/bioshogi/player/piece_box_methods.rb
bioshogi-0.0.4 lib/bioshogi/player/piece_box_methods.rb
bioshogi-0.0.3 lib/bioshogi/player/piece_box_methods.rb