File tree Expand file tree Collapse file tree 2 files changed +92
-1
lines changed
Expand file tree Collapse file tree 2 files changed +92
-1
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ func (t Team) Known() bool {
4444 return ! t .Unknown ()
4545}
4646
47+ // toProto converts the Team to a protobuf Team
4748func (t Team ) toProto () refproto.Team {
4849 if t == TeamYellow {
4950 return refproto .Team_YELLOW
@@ -53,6 +54,17 @@ func (t Team) toProto() refproto.Team {
5354 return refproto .Team_UNKNOWN
5455}
5556
57+ // Is returns true, if the team is equal to given team, respecting unknown and both accordingly
58+ func (t Team ) Is (team Team ) bool {
59+ if team == TeamUnknown {
60+ return false
61+ }
62+ if t == TeamBoth {
63+ return true
64+ }
65+ return t == team
66+ }
67+
5668// NewTeam creates a team from a protobuf team. Its either a single team or unknown. Not both.
5769func NewTeam (team refproto.Team ) Team {
5870 if team == refproto .Team_YELLOW {
@@ -464,7 +476,10 @@ func (s State) BotSubstitutionIntend() Team {
464476 if event .Type == GameEventTooManyRobots {
465477 blue = blue || event .ByTeam () == TeamBlue
466478 yellow = yellow || event .ByTeam () == TeamYellow
467- break
479+ } else if event .Type == GameEventBotSubstitution {
480+ // reset after a sub substitution event
481+ blue = false
482+ yellow = false
468483 }
469484 }
470485
Original file line number Diff line number Diff line change 1+ initialState :
2+ stage : First Half
3+ command : stop
4+ division : DivA
5+ gameEvents :
6+ - type : ballLeftFieldGoalLine
7+ details :
8+ ballleftfieldgoalline :
9+ byteam : 1 # Yellow
10+ bybot : 0
11+ location :
12+ x : 6.0
13+ y : 4.0
14+ transitions :
15+ - event :
16+ gameEvent :
17+ type : tooManyRobots
18+ details :
19+ toomanyrobots :
20+ byteam : 1 # Yellow
21+ expectedStateDiff :
22+ command : stop
23+ nextCommand : direct
24+ nextCommandFor : Blue
25+ placementPos :
26+ x : 5.8
27+ y : 4.3
28+ gameEvents :
29+ - type : ballLeftFieldGoalLine
30+ details :
31+ ballleftfieldgoalline :
32+ byteam : 1 # Yellow
33+ bybot : 0
34+ location :
35+ x : 6.0
36+ y : 4.0
37+ - type : tooManyRobots
38+ details :
39+ toomanyrobots :
40+ byteam : 1 # Yellow
41+ - event :
42+ trigger :
43+ type : continue
44+ expectedStateDiff :
45+ command : halt
46+ placementPos :
47+ x : 5.8
48+ y : 4.3
49+ gameEvents :
50+ - type : ballLeftFieldGoalLine
51+ details :
52+ ballleftfieldgoalline :
53+ byteam : 1 # Yellow
54+ bybot : 0
55+ location :
56+ x : 6.0
57+ y : 4.0
58+ - type : tooManyRobots
59+ details :
60+ toomanyrobots :
61+ byteam : 1 # Yellow
62+ - type : botSubstitution
63+ details :
64+ botsubstitution :
65+ byteam : 1 # Yellow
66+ - event :
67+ trigger :
68+ type : continue
69+ expectedStateDiff :
70+ command : direct
71+ commandFor : Blue
72+ nextCommand : " "
73+ nextCommandFor : " "
74+ gameEvents : []
75+ currentActionDeadline : " 2010-01-01T00:00:05Z"
76+ currentActionTimeRemaining : 5s
You can’t perform that action at this time.
0 commit comments