Conversation
|
The smart gatherer has been added to CI so that we can see if it out performs the original one. :) |
This is to make the gatherer a bit better in the hope that when they run background games between hunter and gatherer they get more balanced statistics and do not assume that hunting is the "best" strategy, right? Just writing this down explicitly because we will forget what is the point of changing the demos.
It was extremely surprising to me to discover that addressing the graph with a position returns a list of neighbors. That would freak out the students, I am very sure. If we keep this, we should use or re-use the |
I was checking https://networkx.org/documentation/stable/reference/classes/generated/networkx.Graph.neighbors.html and of course I went for the alternative suggestion. :) |
|
I do agree that it makes sense to re-use the danger zone implementation. OTOH, why do we support networkx if we don’t make use of it. (I could live with a comment to the function suggesting that it might make sense to rewrite it using nx.) |
of course ;) I agree, writing: if pos in bot.graph.neighbors(bot.enemy[0].position):instead of: if pos in list(bot.graph[bot.enemy[0].position]):
continuewould make the code 4 characters longer and it would be definitely too readable and too easy to understand intuitively. Let them do some thinking and put some prints here and there to understand what is going on :) |
Adapted basic gatherer: Will not go to a field when there is an enemy on a neighbouring field. Not sure if I
if pos in list(bot.graph[bot.enemy[0].position])is actually the nicest way of doing this, though.