Skip to content

Commit 485aee4

Browse files
authored
kill players without area (#31)
1 parent 14c0f0e commit 485aee4

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

game.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ func (g *Game) claimStartingArea(p *Player) {
189189
p.Score++
190190
}
191191
}
192+
g.killPlayersWithZeroScore()
192193
}
193194

194195
func (g *Game) getMinAvailablePlayerId() PlayerID {
@@ -255,6 +256,8 @@ func (g *Game) fillTrace(p *Player) {
255256
}
256257
}
257258
}
259+
g.killPlayersWithZeroScore()
260+
258261
}
259262

260263
func (g *Game) getTakenMask(p *Player) [][]bool {
@@ -314,6 +317,14 @@ func (g *Game) getScoreboard() []*Player {
314317
return scoreboard
315318
}
316319

320+
func (g *Game) killPlayersWithZeroScore() {
321+
for pID, player := range g.Players {
322+
if player.Score == 0 {
323+
g.killPlayer(pID)
324+
}
325+
}
326+
}
327+
317328
func (g *Game) killPlayer(pID PlayerID) {
318329
for uid, playerID := range g.UIDToPID {
319330
if pID == playerID {

0 commit comments

Comments
 (0)