Fix Issue #2 (stats not working) in New-TicTacToeGame.ps1 #3
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
Added logic following stats empty check when running a new game to pull existing stats (if applicable) and verify both players exist in the state file. If not, missing player(s) is/are added and the changes are then committed to the state file.
Related Issue
#2
Motivation and Context
This change allows stats to be saved and recalled in the state file by verifying player exists in the state file when a new game is created. Without this check, end of game results in "The property <insert Wins/Losses/Ties> cannot be found on this object".
How Has This Been Tested?
Changes tested by running new games using 3 accounts in Slack and verifying stats are saved/reported correctly following each game's end using the "stats" command. Tested and verified stats survive server reboot and still report correctly.
Screenshots (if appropriate):
Types of changes
Checklist: