Class: CwCardUtils::DeckComparator

Inherits:
Object
  • Object
show all
Defined in:
lib/cw_card_utils/deck_comparator.rb

Constant Summary collapse

WEIGHTS =
{
  archetype: 0.30,
  curve:     0.25,
  synergy:   0.25,
  interaction: 0.20,
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(deck_a, deck_b) ⇒ void

Public: Create a comparator for two decks. 日本語: 2つのデッキを対象にコンパレータを作成します。

Parameters:



23
24
25
26
27
# File 'lib/cw_card_utils/deck_comparator.rb', line 23

def initialize(deck_a, deck_b)
  @deck_a = deck_a
  @deck_b = deck_b
  @analysis = {}
end

Instance Attribute Details

#analysisObject (readonly)

Returns the value of attribute analysis.



8
9
10
# File 'lib/cw_card_utils/deck_comparator.rb', line 8

def analysis
  @analysis
end

#deck_aObject (readonly)

Returns the value of attribute deck_a.



8
9
10
# File 'lib/cw_card_utils/deck_comparator.rb', line 8

def deck_a
  @deck_a
end

#deck_bObject (readonly)

Returns the value of attribute deck_b.



8
9
10
# File 'lib/cw_card_utils/deck_comparator.rb', line 8

def deck_b
  @deck_b
end

Instance Method Details

#compareHash

Public: Compare decks for on-play and on-draw scenarios. 日本語: 先手/後手の両シナリオで比較します。

Intent (EN): Produces two analyses (on the play / on the draw) combining archetype, curve segmentation, synergy hit-rate, and interaction density. A weighted heuristic yields Deck A’s win rate and a favored label, plus explanatory notes.

意図 (JA): アーキタイプ、カーブ分割、シナジー成立率、インタラクション密度を統合し、先手/後手の 2 通りの分析を生成します。重み付きヒューリスティックによりデッキAの勝率と有利側のラベルを算出し、説明的なノートを付与します。

Returns:

  • (Hash)

    { on_play: Hash, on_draw: Hash }



43
44
45
46
47
48
49
# File 'lib/cw_card_utils/deck_comparator.rb', line 43

def compare
  results = {
    on_play: matchup_scenario(on_play: true),
    on_draw: matchup_scenario(on_play: false),
  }
  @analysis = results
end