Last active
November 10, 2017 15:53
-
-
Save Hiromi-Kai/5170ac856213b0b2e1bc5fdc5e3edaf7 to your computer and use it in GitHub Desktop.
ドミニオンのプロモカードのサウナ/アヴァントにおいてサウナ銀が2周目に揃う確率
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"3ターン目の手札にサウナ銀が揃う確率" | |
0.152 | |
"3ターン目のサウナで銀が引ける確率" | |
0.038 | |
"3ターン目にサウナ銀ができる確率" | |
0.19 | |
"3ターン目にサウナ銀が来なかった時に4ターン目の手札にサウナ銀が揃う確率" | |
0.476 | |
"3ターン目にサウナ銀が来なかった時に4ターン目のサウナで銀が引ける確率" | |
0.119 | |
"3ターン目にサウナ銀が来なかった時に4ターン目にサウナ銀ができる確率" | |
0.595 | |
"デッキの2周目にサウナ銀ができる確率" | |
0.672 | |
"デッキの2周目にサウナ銀が出た上で屋敷を圧縮できる確率" | |
0.475 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
copper = 0 | |
estate = 2 | |
silver = 3 | |
sauna = 4 | |
initial_deck = Array.new(7, copper) + Array.new(3, estate) | |
first_deck = initial_deck + [silver, sauna] | |
first_turn = first_deck.repeated_combination(5).to_a | |
first_turn_count = first_turn.count | |
sauna_silver_count = first_turn.select{|f| f.include?(sauna) && f.include?(silver) }.count | |
p "3ターン目の手札にサウナ銀が揃う確率" | |
p sauna_silver_ratio = (sauna_silver_count.to_f / first_turn_count).round(3) | |
p "3ターン目のサウナで銀が引ける確率" | |
p draw_silver_ratio = (first_turn.select{|f| f.include?(sauna) && !f.include?(silver) }.count.to_f / | |
first_turn_count * Rational('1/7')).round(3) | |
p "3ターン目にサウナ銀ができる確率" | |
p first_all_sauna_silver_ratio = (sauna_silver_ratio + draw_silver_ratio).round(3) | |
#以下3ターン目にサウナと銀どっちも出なかった場合 | |
second_deck = initial_deck.shuffle.shift(5) + [silver, sauna] | |
second_turn = second_deck.combination(5).to_a | |
second_turn_count = second_turn.count | |
second_sauna_silver_count = second_turn.select{|f| f.include?(sauna) && f.include?(silver) }.count.round(3) | |
p "4ターン目の手札にサウナ銀が揃う確率" | |
p second_sauna_silver_ratio = (second_sauna_silver_count.to_f / second_turn_count).round(3) | |
p "4ターン目のサウナで銀が引ける確率" | |
p second_draw_silver_ratio = (second_turn.select{|f| f.include?(sauna) && !f.include?(silver) }.count.to_f / | |
second_turn_count * Rational('1/2')).round(3) | |
p "4ターン目にサウナ銀ができる確率" | |
p second_all_sauna_silver_ratio = (second_sauna_silver_ratio + second_draw_silver_ratio).round(3) | |
p "デッキの2周目にサウナ銀ができる確率" | |
p all_sauna_silver_ratio = (first_all_sauna_silver_ratio + | |
(1 - first_all_sauna_silver_ratio) * second_all_sauna_silver_ratio).round(3) | |
other_cards = initial_deck.combination(4).to_a | |
include_estate_ratio = other_cards.select{|f| f.include?(estate)}.count / other_cards.count.to_f | |
p "デッキの2周目にサウナ銀が出た上で屋敷を圧縮できる確率" | |
p (all_sauna_silver_ratio * include_estate_ratio).round(3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment