@@ -10,14 +10,17 @@ import (
10
10
)
11
11
12
12
func (e * Engine ) nextActions () (actions []* ContinueAction , hints []* ContinueHint ) {
13
+ if * e .currentState .Stage == state .Referee_POST_GAME {
14
+ // match is over
15
+ return
16
+ }
17
+
13
18
if e .currentState .Stage .IsPausedStage () {
14
- if * e .currentState .Stage .Next () != * e .currentState .Stage {
15
- actions = append (actions , createContinueAction (
16
- ContinueAction_NEXT_STAGE ,
17
- state .Team_UNKNOWN ,
18
- ContinueAction_READY_MANUAL ,
19
- ))
20
- }
19
+ actions = append (actions , createContinueAction (
20
+ ContinueAction_NEXT_STAGE ,
21
+ state .Team_UNKNOWN ,
22
+ ContinueAction_READY_MANUAL ,
23
+ ))
21
24
// only possible action is to proceed to non-paused stage
22
25
return
23
26
}
@@ -326,15 +329,23 @@ func (e *Engine) randomTeam() state.Team {
326
329
}
327
330
328
331
func suggestEndOfMatch (currentState * state.State ) bool {
332
+ goalsY := int (* currentState .TeamInfo (state .Team_YELLOW ).Goals )
333
+ goalsB := int (* currentState .TeamInfo (state .Team_BLUE ).Goals )
334
+ if * currentState .Stage != state .Referee_POST_GAME &&
335
+ (goalsY >= 10 || goalsB >= 10 ) && math .Abs (float64 (goalsY - goalsB )) > 1 {
336
+ return true
337
+ }
338
+
329
339
if * currentState .Stage == state .Referee_NORMAL_SECOND_HALF ||
330
340
* currentState .Stage == state .Referee_EXTRA_SECOND_HALF {
331
341
return currentState .StageTimeLeft .AsDuration () < 0
332
- } else if * currentState .Stage == state .Referee_EXTRA_TIME_BREAK ||
342
+ }
343
+
344
+ if * currentState .Stage == state .Referee_EXTRA_TIME_BREAK ||
333
345
* currentState .Stage == state .Referee_PENALTY_SHOOTOUT_BREAK ||
334
346
* currentState .Stage == state .Referee_PENALTY_SHOOTOUT {
335
347
return true
336
348
}
337
- goalsY := int (* currentState .TeamInfo (state .Team_YELLOW ).Goals )
338
- goalsB := int (* currentState .TeamInfo (state .Team_BLUE ).Goals )
339
- return (goalsY >= 10 || goalsB >= 10 ) && math .Abs (float64 (goalsY - goalsB )) > 1
349
+
350
+ return false
340
351
}
0 commit comments