Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI json output isDraw always false #78

Merged
merged 1 commit into from
May 30, 2022
Merged

CLI json output isDraw always false #78

merged 1 commit into from
May 30, 2022

Conversation

MNThomson
Copy link
Contributor

@MNThomson MNThomson commented May 30, 2022

Description

I just started building my first snake (Snattle!), and in trying to link the cli for DQLearning I noticed that isDraw is always false. The output is hard-coded to false in commands/play.go:

rules/cli/commands/play.go

Lines 155 to 160 in 1adbc79

gameExporter := GameExporter{
game: gameState.createClientGame(),
snakeRequests: make([]client.SnakeRequest, 0),
winner: SnakeState{},
isDraw: false,
}

Example

CLI output:

$ battlesnake play --url http://localhost:8080 --url http://localhost:8000 -W 5 -H 5 -o game.json
...
2022/05/29 16:55:37 [DONE]: Game completed after 3 turns. It was a draw.
2022/05/29 16:55:37 Written 5 lines of output to file: game.json

JSON Before

{"winnerId":"","winnerName":"","isDraw":false}

JSON After

{"winnerId":"","winnerName":"","isDraw":true}

Copy link
Contributor

@robbles robbles left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for the fix @MNThomson!

@robbles robbles merged commit fff5515 into BattlesnakeOfficial:main May 30, 2022
@MNThomson MNThomson deleted the max/isdraw-proper-output branch May 30, 2022 23:27
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.

2 participants