Skip to content

Commit dbf9e70

Browse files
committed
Halt the game after second 'Too close to defense area' foul
Rule change: https://github.com/RoboCup-SSL/ssl-rules/pull/91/files
1 parent fb847e5 commit dbf9e70

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

internal/app/statemachine/change_gameevent.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ func (s *StateMachine) processChangeAddGameEvent(newState *state.State, change *
4646
}
4747
}
4848

49+
// Halt the game after the second attacker too close to defense area foul by the same team
50+
if *gameEvent.Type == state.GameEvent_ATTACKER_TOO_CLOSE_TO_DEFENSE_AREA {
51+
numFouls := len(newState.FindGameEventsByTeam(state.GameEvent_ATTACKER_TOO_CLOSE_TO_DEFENSE_AREA, byTeam))
52+
if numFouls >= 2 {
53+
changes = append(changes, createCommandChange(state.NewCommandNeutral(state.Command_HALT)))
54+
}
55+
}
56+
4957
// Add yellow card
5058
if addsYellowCard(*gameEvent.Type) && byTeam.Known() {
5159
log.Printf("Team %v got a yellow card", byTeam)

0 commit comments

Comments
 (0)