Skip to content

Commit

Permalink
Add ShotAttempt class in state
Browse files Browse the repository at this point in the history
- ShotAttempt tracks start/end frame, player_id, and ShotType
- did not change any functional code
  • Loading branch information
Mikonooooo committed Oct 20, 2023
1 parent 80eb10a commit a105113
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,43 @@
"""
from enum import Enum

class ShotType(Enum):
"Status of shot, paired with point value"
MISS = 0
TWO = 2
THREE = 3

class ShotAttempt:
"""
A single shot attempt
"""
def __init__(self, start:int, end:int) -> None:
"""
Initializes shot attempt containing
start: first frame
end: last frame
playerid: shot's player
type: MISSED, TWO, or THREE
"""
#IMMUTABLE
self.start : int = start
self.end : int = end

#MUTABLE
self.playerid : int = None
self.type : ShotType = None

def check(self) -> bool:
"verifies if well-defined"
try:
assert (self.start <= self.end)
assert (self.start != None and self.end != None
and self.playerid != None and self.type != None)
except:
return False
return True


class BallState(Enum):
"""
Indicates the status of the ball at any given frame.
Expand Down

0 comments on commit a105113

Please sign in to comment.