Sha256: dabb1e4c1f35a03bcad27930b207dba551a2584717120a792bba908a3c998bce

Contents?: true

Size: 1.06 KB

Versions: 7

Compression:

Stored size: 1.06 KB

Contents

# frozen-string-literal: true

module Bioshogi
  class Piece
    class PieceScore
      include ApplicationMemoryRecord
      memory_record [
        { key: :king,   basic_weight: 40000, promoted_weight: 0,    hold_weight: 40000, },
        { key: :rook,   basic_weight:  2000, promoted_weight: 2200, hold_weight:  2100, },
        { key: :bishop, basic_weight:  1800, promoted_weight: 2000, hold_weight:  1890, },
        { key: :gold,   basic_weight:  1200, promoted_weight: 0,    hold_weight:  1260, },
        { key: :silver, basic_weight:  1000, promoted_weight: 1200, hold_weight:  1050, },
        { key: :knight, basic_weight:   700, promoted_weight: 1200, hold_weight:   735, },
        { key: :lance,  basic_weight:   600, promoted_weight: 1200, hold_weight:   630, },
        { key: :pawn,   basic_weight:   100, promoted_weight: 1200, hold_weight:   105, },
      ]

      def piece
        Piece.fetch(key)
      end

      def any_weight(promoted)
        if promoted
          promoted_weight
        else
          basic_weight
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bioshogi-0.0.10 lib/bioshogi/piece/piece_score.rb
bioshogi-0.0.9 lib/bioshogi/piece/piece_score.rb
bioshogi-0.0.8 lib/bioshogi/piece/piece_score.rb
bioshogi-0.0.7 lib/bioshogi/piece/piece_score.rb
bioshogi-0.0.5 lib/bioshogi/piece/piece_score.rb
bioshogi-0.0.4 lib/bioshogi/piece/piece_score.rb
bioshogi-0.0.3 lib/bioshogi/piece/piece_score.rb