Skip to content

Conversation

@nicopop
Copy link
Contributor

@nicopop nicopop commented Sep 29, 2024

I got inspired by the problem someone had on discord because of the fact we only ran functions once and at the time said it would be complicated to fix it...
So here's a PR adding recursion to the requires's function finding and executing.
I included a maximum recursion depth param that can be changed (currently set to 5)

@nicopop nicopop self-assigned this Sep 29, 2024
@nicopop
Copy link
Contributor Author

nicopop commented Sep 29, 2024

was tested using these:

# You can also return a string from your function, and it will be evaluated as a requires string.
def recursionTest(world: World, multiworld: MultiWorld, state: CollectionState, player: int):
    """Returns a requires string that checks if the player has unlocked the tank."""
    return "{hello()}"
def recursionFail(world: World, multiworld: MultiWorld, state: CollectionState, player: int):
    """Returns a requires string that checks if the player has unlocked the tank."""
    return "{recursionFail()}"
def hello(world: World, multiworld: MultiWorld, state: CollectionState, player: int):
    return True

Copy link
Collaborator

@FuzzyGamesOn FuzzyGamesOn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor change

@nicopop nicopop requested a review from FuzzyGamesOn October 3, 2024 16:52
@silasary silasary merged commit 7802bc7 into main Oct 16, 2024
@silasary silasary deleted the Rule-functions-Recursion branch October 16, 2024 05:14
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.

4 participants