Sha256: c3b111e63ce83f94ce93d2abeed3b476cd0eea1ebd1b8e9689d4c3ff722848c3
Contents?: true
Size: 1.59 KB
Versions: 2
Compression:
Stored size: 1.59 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, }, ] class << self # このスコア以上であれば必勝(姿焼き判定)とする def sure_victory_score @sure_victory_score ||= [ self[:king].basic_weight, # 玉 self[:rook].promoted_weight, # 龍 self[:bishop].promoted_weight, # 馬 self[:rook].hold_weight, # 飛 (持駒) self[:bishop].hold_weight, # 角 (持駒) self[:gold].basic_weight * 4, # 金相当 * 4 (と金などを含む) ].sum end end 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bioshogi-0.0.15 | lib/bioshogi/piece/piece_score.rb |
bioshogi-0.0.14 | lib/bioshogi/piece/piece_score.rb |