Skip to content

Commit

Permalink
Updated handling of undefined marker IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
OldUser101 committed Oct 13, 2024
1 parent 5dd5796 commit 5ed7147
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
16 changes: 12 additions & 4 deletions robot/game_config/markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import typing

from .teams import TEAM
#from teams import TEAM

"""
Hiiii!
Expand All @@ -17,6 +16,7 @@
Don't know what to say. - Nathan Gill (2024 - 2025)
No semi-colons please - Scott Wilson (2024 - 2025)
[Put your future messages here]
"""

Expand All @@ -25,7 +25,7 @@ class MARKER_TYPE(enum.Enum): # Keep something like this to determine if a marke
ARENA = enum.auto()


class BASE_MARKER: # Base marker class that POTATO_MARKER and ARENA_MARKER derive from.
class BASE_MARKER: # Base marker class that TARGET_MARKER and ARENA_MARKER derive from.
team_marker_colors: dict = { # Colour definitions for each team defined in TEAMS
TEAM.RUBY: (0, 0, 255), # RED
TEAM.JADE: (0, 255, 0), # GREEN
Expand Down Expand Up @@ -106,6 +106,10 @@ def by_id(id: int, team: typing.Union[TEAM, None] = None) -> BASE_MARKER: # team
spaced as in 2021-2022's competition (6 markers on each side of the Arena,
the first 50cm away from the wall and each subsequent marker 1m away from
there). In practice these markers start at 100.
As of 2025: Sheep have IDs 0-23 inclusive; Jewels have IDs 24-31 inclusive; Lair IDs are 50-53 inclusive
"""

if id > 99:
Expand All @@ -122,6 +126,10 @@ def by_id(id: int, team: typing.Union[TEAM, None] = None) -> BASE_MARKER: # team
elif id == 24 or id == 25 or id == 50:
owning_team = TEAM["T0"]
else:
raise Exception("AHHHHHH!")
owning_team = TEAM["NONE"]

return TARGET_MARKER(id, owning_team)
return TARGET_MARKER(id, owning_team)

## TESTING ##
for i in range(0, 200):
print(f"ID: {i}, {MARKER.by_id(i)}")
2 changes: 2 additions & 0 deletions robot/game_config/teams.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class TEAM(enum.Enum):
ARENA = "Nothing!"
# There is no T value for ARENA, so there is no way that the assignment of team to a marker can accidentally assign ARENA if the logic goes wrong.

NONE = "NONE" ## This is only used when no other owning team is available for undefined IDs, this should never actually happen in-game.

T0 = "Mogok Valley, Myanmar (Burma)"
T1 = "Hetian (Hotan), Xinjiang, China"
T2 = "St. John's Island (Zabargad Island), Egypt"
Expand Down

0 comments on commit 5ed7147

Please sign in to comment.