Skip to content

Conversation

@rjstebe
Copy link

@rjstebe rjstebe commented Mar 13, 2021

When a monster kills a character, the character is removed only after update_characters(), so the characters dictionary can end up having indexes that have empty character lists, like this: {40: []}.

This can cause the condition not self.world.characters in game.done() and a similar condition in our group's terminal state checks to return False when there are no characters instead of True.

I added a couple lines to world.remove_character() to check if the removed character leaves its list empty, and if so deletes the index. Tested by printing the result of not wrld.characters in a sensed world where the monster kills the player in Variant 2 of Scenario 2, and it seems to work now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant