add an all-in-one script for running tests; format and fix some code; add ci.yml
CI / main-server (RSpec + audits) (push) Failing after 1m12s
CI / game-server (go vet + go test -race) (push) Successful in 1m1s
CI / frontend (build + tests) (push) Successful in 9s

This commit is contained in:
2026-11-29 16:46:27 +03:00
parent a91eccbeaa
commit e52178c929
14 changed files with 474 additions and 139 deletions
+6 -6
View File
@@ -458,12 +458,12 @@ func (m *Manager) PlaceShips(ctx context.Context, match *Match, slotIdx int, shi
// If the player does not have the right of turn, the message is ignored and ErrNotYourTurn is returned.
// If the position is out of bounds or already struck, FireResultInvalidPosition is sent to the shooter.
// Otherwise:
// - Miss: marks cell as struck, sends FireResultMiss to shooter, turn passes to opponent.
// - Hit: marks cell as struck, sends FireResultHit to shooter, turn does not pass.
// - Sunk: marks ship and all surrounding cells (including diagonals) as struck, sends FireResultSunk to shooter.
// If all opponent ships are destroyed, match finishes: END messages (victory/defeat) are sent to both players,
// and connections are closed immediately.
// Otherwise, turn does not pass.
// - Miss: marks cell as struck, sends FireResultMiss to shooter, turn passes to opponent.
// - Hit: marks cell as struck, sends FireResultHit to shooter, turn does not pass.
// - Sunk: marks ship and all surrounding cells (including diagonals) as struck, sends FireResultSunk to shooter.
// If all opponent ships are destroyed, match finishes: END messages (victory/defeat) are sent to both players,
// and connections are closed immediately.
// Otherwise, turn does not pass.
func (m *Manager) Fire(ctx context.Context, match *Match, slotIdx int, x, y int) (int, error) {
res, won, matchID, err := m.fireLocked(ctx, match, slotIdx, x, y)
if won {