fix the comments for check_for_winner #1148
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
To determine the winner, tic tac toe uses
check_for_winner()
, defined intictactoe/board.py
. That function describes its returns as -1, 0, 1 in the comments as follows. However, thecheck_for_winner()
function returns -1, 1, 2.PettingZoo/pettingzoo/classic/tictactoe/board.py
Lines 51 to 65 in f7a9ef1
Other functions that use the
check_for_winner()
function also run the function thinking that the integers it returns are -1, 1, and 2. This leads us to believe that we should change the function's comment.PettingZoo/pettingzoo/classic/tictactoe/board.py
Lines 67 to 76 in f7a9ef1
PettingZoo/pettingzoo/classic/tictactoe/tictactoe.py
Lines 212 to 225 in f7a9ef1
The
observe
function also shows a correspondence of 1 -> agent0, 2 -> agent1.PettingZoo/pettingzoo/classic/tictactoe/board.py
Lines 10 to 12 in f7a9ef1
Type of change
Screenshots
before
after
Checklist:
pre-commit
checks withpre-commit run --all-files
(seeCONTRIBUTING.md
instructions to set it up)pytest -v
and no errors are present.pytest -v
has generated that are related to my code to the best of my knowledge.