mirror of
https://github.com/ArchipelagoMW/Archipelago.git
synced 2026-03-23 02:43:20 -07:00
temporary push: 40% faster generation test
Small changes in logic make the generation 40% faster. I'll have to think about how big the changes are. I suspect they are rather limited. If this is the way to go, I'll remove the temp file and redo the YachtWeights file, I'll remove the functions there and just put the new weights here.
This commit is contained in:
@@ -159,6 +159,7 @@ def dice_simulation_strings(categories, num_dice, num_rolls, fixed_mult, step_mu
|
||||
for val1, prob1 in c.items():
|
||||
for val2, prob2 in dist1.items():
|
||||
new_val = int(max(val1, val2 * mult))
|
||||
new_val = new_val - new_val % 2
|
||||
new_prob = prob1 * prob2
|
||||
|
||||
# Update the probability for the new value
|
||||
|
||||
@@ -7904,3 +7904,28 @@ yacht_weights = {
|
||||
("FourAndFiveFullHouse", 8, 7): {50: 97782, 0: 2218},
|
||||
("FourAndFiveFullHouse", 8, 8): {50: 98916, 0: 1084},
|
||||
}
|
||||
|
||||
def round_down_to_nearest(n, k):
|
||||
return n - (n % k)
|
||||
|
||||
def combine_rounded_keys(yacht_weights, change_category):
|
||||
new_yacht_weights = {}
|
||||
for main_key, sub_dict in yacht_weights.items():
|
||||
if main_key[0] in change_category:
|
||||
new_sub_dict = {}
|
||||
for key, value in sub_dict.items():
|
||||
rounded_key = round_down_to_nearest(key, 2)
|
||||
if rounded_key in new_sub_dict:
|
||||
new_sub_dict[rounded_key] += value
|
||||
else:
|
||||
new_sub_dict[rounded_key] = value
|
||||
new_yacht_weights[main_key] = new_sub_dict
|
||||
else:
|
||||
new_yacht_weights[main_key] = sub_dict
|
||||
return new_yacht_weights
|
||||
|
||||
change_category = ['SumOfEvens', 'DoubleThreesAndFours', 'TinyStraight', 'MicroStraight', 'TwosAndThrees', 'TwoOneTwoConsecutive', 'TwoPair', 'FiveDistinctDice', 'Threes', 'ThreeOdds', 'Ones', 'FourAndFiveFullHouse', 'Pair', 'OneTwoOneConsecutive', 'Distincts', 'SmallStraight', 'Yacht', 'QuadrupleOnesAndTwos', 'Fours', 'LargeStraight', 'Fives', 'FullHouse', 'SumOfOdds', 'Sixes', 'ThreeOfAKind', 'Twos', 'FourOfAKind', 'Choice', 'ThreeDistinctDice']
|
||||
|
||||
|
||||
|
||||
yacht_weights = combine_rounded_keys(yacht_weights, change_category)
|
||||
|
||||
7978
worlds/yachtdice/temp_YachtWeights_make_small.py
Normal file
7978
worlds/yachtdice/temp_YachtWeights_make_small.py
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user