Replies: 6 comments
-
|
Well, it is not a "tendency". It is baked in on purpose. The idea being that if I say The intent here was to make it harder to gather food and making it more worth it to invest some time in coding a good defender, because now you have a good chance to kill. I am not sure what would be the intent of implementing your proposal, except for a more visually appealing layout? Regarding "clustering" of food pellets. The algorithm right now is a completely unspectacular uniform random distribution with two forbidden zones: the border of the homezone and the bots initial positions. I am not sure I see a reason to deviate from that, except to have a more visually appealing layout again? |
Beta Was this translation helpful? Give feedback.
-
I guess my problem is with the ‘you get what you asked for’ because in practice no-one asks and the 10:30 setting is basically hard-coded. Maybe we should work on an outline for what our end-goal is with the maze-redesign, because while we did some great and good changes to the algorithm, the original plan was to have a maze database which would have had vastly different mazes that would have been selected with a certain percentage each. What we have now is that all mazes are more uniform in how the food is distributed than they ever were in some sense. If there are further plans to the food distribution, then we might not need to change the actual algorithm. It is just that I lost track of what is the plan here. Just so that it doesn’t get lost, here is a naive version of a weighted algorithm. (It tends to generate rather similar patterns actually.) def distribute_food(all_tiles, chamber_tiles, trapped_food, total_food, rng=None):
rng = default_rng(rng)
if trapped_food > total_food:
raise ValueError(
f"number of trapped food ({trapped_food}) must not exceed total number of food ({total_food})"
)
if total_food > len(all_tiles):
raise ValueError(
f"number of total food ({total_food}) exceeds available tiles in maze ({len(all_tiles)})"
)
free_tiles = all_tiles - chamber_tiles
def weighted_sample_without_replacement(population, weights, k, rng):
v = [rng.random() ** (1 / w) for w in weights]
order = sorted(range(len(population)), key=lambda i: v[i])
return [population[i] for i in order[-k:]]
all_tiles = list(all_tiles)
# statistically, there should be trapped_food pellets in len(chamber_tiles) and
# total - trapped pellets in len(free_tiles)
chamber_weight = trapped_food / len(chamber_tiles)
rest_weight = (total_food - trapped_food) / (len(free_tiles))
weights = [chamber_weight if tile in chamber_tiles else rest_weight for tile in all_tiles]
food_nodes = weighted_sample_without_replacement(all_tiles, weights, k=total_food, rng=rng)
return food_nodes
Less clustering means the bots have to do more work and visit more spots on the maze rather than just having to find the quickest path to the gold chamber and get there before the enemy. But of course I also want it to be visually appealing. |
Beta Was this translation helpful? Give feedback.
-
|
Just for the record, let me write down here the background of #867 and #856 :
After all of the above, we still had some problems:
The first approach we tried (#852) was to write some code to analyze the existing mazes and create a database with their properties: how many dead-ends? How much food in each dead-end? ... and the same questions with chambers. At the same time, @jbdyn spent some time (#856) looking at the maze generating algorithm and improved in such a way that it became feasible to think about generating the maze live and get rid of the pre-computed mazes, which have been a pain since the beginning of history. Also, we could now distribute the food such that it would land in the dead-ends/chambers. This solution addresses the issues above and also makes the idea of the database obsolete. We do not need to know how maze looks like to choose the ones we need, we just generate right away the maze exactly as we want it. Finally, with #867 we integrated #856 into the pelita CLI, so that live maze generation can be used. So to me, except for the experimental test of these two parameters, the work seems to be a great success. @Debilski : is this the outline you wanted to see? Does it answer your concerns? |
Beta Was this translation helpful? Give feedback.
-
|
This is a great resource for the Pelita historians. :) |
Beta Was this translation helpful? Give feedback.
-
|
What I don’t understand is as follows. We have this as the starting point for the TU redesign:
and apparently, this had some implementation/execution problems as stated:
So, our problem was that we did not reach the 25% of dead ends and decided to do something about it. [*] Actually we have less, since the algorithm is still capable of accidentally producing mazes without dead ends (but it has become more unlikely I guess). Of course, if our plan is now to make that |
Beta Was this translation helpful? Give feedback.
-
|
The overall goal is to make attacking a bit more challenging and defending a strategy that is worthwhile to implement. All the historical changes I have explained above (the dead-ends at 25%, the food 10:30, the removing of chambers) are all just moves to reach that balance. So no, our missed goal was not that we didn't reach 25% dead-ends. The problem was that attacking was still too easy and defending still not worth it. In the past it was the opposite. We want to find a good balance. We will experiment now if the chosen parameters for |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When chance generates a maze with not enough chambers, the filling algorithm always fills the chambers first, giving a somewhat uneven experience (sometimes other corners of the maze appear completely empty). I’m not completely against these mazes, I just think that they are generated too often.
We should maybe adapt the algorithm such that we don’t start with the filling of the chambers but assign the chamber nodes a different priority according to chamber nodes/non-chamber nodes ratio. That way we would at least not fill them up all the time. (
rng.samplecan take acounts=argument, so this could be easily tested out.)On top of that, we may want to use an algorithm that leads to less clustering of the food pellets but that’s secondary.
(Maybe we should even have different filling algorithms and every time a different one is selected.)
Beta Was this translation helpful? Give feedback.
All reactions