Several fixes and changes

-change apworld version
-Removed the extra roll (this was not intended)
-change extra_points_added to a mutable list to that it actually does something
-removed variables multipliers_added and items_added
-Rules, don't order by quantity, just by mean_score
-Changed the weights in general to make it faster
This commit is contained in:
spinerak
2024-09-04 21:46:11 +02:00
parent ee2f6c81f0
commit 43b081f63b
4 changed files with 14 additions and 3579 deletions

View File

@@ -29,7 +29,7 @@ class Category:
mean_score = 0
for key, value in yacht_weights[self.name, min(8, num_dice), min(8, num_rolls)].items():
mean_score += key * value / 100000
return mean_score * self.quantity
return mean_score
class ListState:

File diff suppressed because one or more lines are too long

View File

@@ -56,7 +56,7 @@ class YachtDiceWorld(World):
item_name_groups = item_groups
ap_world_version = "2.1.1"
ap_world_version = "2.1.2"
def _get_yachtdice_data(self):
return {
@@ -190,7 +190,6 @@ class YachtDiceWorld(World):
if self.frags_per_roll == 1:
self.itempool += ["Roll"] * num_of_rolls_to_add # minus one because one is in start inventory
else:
self.itempool.append("Roll") # always add a full roll to make generation easier (will be early)
self.itempool += ["Roll Fragment"] * (self.frags_per_roll * num_of_rolls_to_add)
already_items = len(self.itempool)
@@ -231,13 +230,9 @@ class YachtDiceWorld(World):
weights["Dice"] = weights["Dice"] / 5 * self.frags_per_dice
weights["Roll"] = weights["Roll"] / 5 * self.frags_per_roll
extra_points_added = 0
multipliers_added = 0
items_added = 0
def get_item_to_add(weights, extra_points_added, multipliers_added, items_added):
items_added += 1
extra_points_added = [0] # make it a mutible type so we can change the value in the function
def get_item_to_add(weights, extra_points_added):
all_items = self.itempool + self.precollected
dice_fragments_in_pool = all_items.count("Dice") * self.frags_per_dice + all_items.count("Dice Fragment")
if dice_fragments_in_pool + 1 >= 9 * self.frags_per_dice:
@@ -246,21 +241,15 @@ class YachtDiceWorld(World):
if roll_fragments_in_pool + 1 >= 6 * self.frags_per_roll:
weights["Roll"] = 0 # don't allow >= 6 rolls
# Don't allow too many multipliers
if multipliers_added > 50:
weights["Fixed Score Multiplier"] = 0
weights["Step Score Multiplier"] = 0
# Don't allow too many extra points
if extra_points_added > 300:
if extra_points_added[0] > 400:
weights["Points"] = 0
# if all weights are zero, allow to add fixed score multiplier, double category, points.
if sum(weights.values()) == 0:
if multipliers_added <= 50:
weights["Fixed Score Multiplier"] = 1
weights["Fixed Score Multiplier"] = 1
weights["Double category"] = 1
if extra_points_added <= 300:
if extra_points_added[0] <= 400:
weights["Points"] = 1
# Next, add the appropriate item. We'll slightly alter weights to avoid too many of the same item
@@ -274,11 +263,9 @@ class YachtDiceWorld(World):
return "Roll" if self.frags_per_roll == 1 else "Roll Fragment"
elif which_item_to_add == "Fixed Score Multiplier":
weights["Fixed Score Multiplier"] /= 1.05
multipliers_added += 1
return "Fixed Score Multiplier"
elif which_item_to_add == "Step Score Multiplier":
weights["Step Score Multiplier"] /= 1.1
multipliers_added += 1
return "Step Score Multiplier"
elif which_item_to_add == "Double category":
# Below entries are the weights to add each category.
@@ -303,15 +290,15 @@ class YachtDiceWorld(World):
choice = self.random.choices(list(probs.keys()), weights=list(probs.values()))[0]
if choice == "1 Point":
weights["Points"] /= 1.01
extra_points_added += 1
extra_points_added[0] += 1
return "1 Point"
elif choice == "10 Points":
weights["Points"] /= 1.1
extra_points_added += 10
extra_points_added[0] += 10
return "10 Points"
elif choice == "100 Points":
weights["Points"] /= 2
extra_points_added += 100
extra_points_added[0] += 100
return "100 Points"
else:
raise Exception("Unknown point value (Yacht Dice)")
@@ -320,7 +307,7 @@ class YachtDiceWorld(World):
# adding 17 items as a start seems like the smartest way to get close to 1000 points
for _ in range(17):
self.itempool.append(get_item_to_add(weights, extra_points_added, multipliers_added, items_added))
self.itempool.append(get_item_to_add(weights, extra_points_added))
score_in_logic = dice_simulation_fill_pool(
self.itempool + self.precollected,
@@ -348,7 +335,7 @@ class YachtDiceWorld(World):
else:
# Keep adding items until a score of 1000 is in logic
while score_in_logic < 1000:
item_to_add = get_item_to_add(weights, extra_points_added, multipliers_added, items_added)
item_to_add = get_item_to_add(weights, extra_points_added)
self.itempool.append(item_to_add)
if item_to_add == "1 Point":
score_in_logic += 1

File diff suppressed because one or more lines are too long