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

code cleanup #31

Merged
merged 5 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,4 @@ Server for SpaceCheckers game. Written entirely using only Go's standard library
```
- Set ENV variable for `PORT` which the server will listen to.
- If port not set, it will be default listen at 9876
- How to determine a point (x,y) is inside circle with radius r and center (a,b) see [link](https://study.com/skill/learn/determining-if-a-point-lies-inside-outside-or-on-a-circle-given-the-center-point-a-radius-explanation.html)


6 changes: 3 additions & 3 deletions game/pieces.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,23 +86,23 @@ func IsAwayFromEdge(pos *Vec2) bool {
return pos.X > 0 && pos.X < 7*SIZE_CELL && pos.Y > 0 && pos.Y < 7*SIZE_CELL
}

// HasWinner determines if `p` has won the match, and notifies both players if TRUE.
// HasWinner determines if `p` has won the match against `opponent`, then notifies both players if TRUE.
func HasWinner(p *player.Player, opponent *player.Player) bool {
if len(opponent.Pieces) == 0 {
//`opponent` has lost, `p` has won! game over
p.SendMessage(&BasePayload{
Notice: "Congrats! You won! GAME OVER",
Inner: &BasePayload_WinlosePayload{
WinlosePayload: &WinLosePayload{
Winner: TeamColor_TEAM_UNSPECIFIED, //TODO fix me
Winner: TeamColor_TEAM_UNSPECIFIED,
},
},
})
opponent.SendMessage(&BasePayload{
Notice: "Sorry! You lost! GAME OVER",
Inner: &BasePayload_WinlosePayload{
WinlosePayload: &WinLosePayload{
Winner: TeamColor_TEAM_UNSPECIFIED, //TODO fix me
Winner: TeamColor_TEAM_UNSPECIFIED,
},
},
})
Expand Down
2 changes: 1 addition & 1 deletion room/room.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func RunMatch(p1 *player.Player, p2 *player.Player, gameOver chan<- bool) {
}
isPlayerRedTurn = true
}
// .. return to top
// ... return to top
}
}
}
Expand Down
Loading