Skip to content

Commit

Permalink
adding pseudovalues for return value of template functions
Browse files Browse the repository at this point in the history
  • Loading branch information
lunathanael committed Mar 12, 2024
1 parent 34469dd commit f9a3c18
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions clash_royale/envs/game_engine/arena.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ def __init__(self, width: int =8, height: int=18) -> None:
def reset(self) -> None:
pass

def step(self) -> None:
def step(self, frames: int=1) -> None:
pass

def get_entities(self) -> List[Entity]:
pass
return []

def play_card(self, x: int, y: int, card: Card) -> None:
pass
6 changes: 3 additions & 3 deletions clash_royale/envs/game_engine/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ def get_pseudo_legal_cards(self) -> list[Card]:
for card in self.hand:
if card.elixir <= self.elixir:
legal_cards.append(card)

return legal_cards

def step(self,
elixir_rate: float,
frames: int=1) -> None:
"""
Called with the value of elixir_rate and frame to update the elixir of player after 'frame' number of frames
to better customize the elixir_rate that can vary depends on game modes.
"""

self.elixir += (elixir_rate / self.fps) * frames

def pop(self, card_index: int) -> None:

"""
Expand Down
5 changes: 3 additions & 2 deletions clash_royale/envs/game_engine/struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,16 @@ class DefaultScheduler(GameScheduler):
"""
Class for default 1v1 game scheduling
"""

def elixir_rate(self) -> float:
pass
return 0

def game_state(self) -> int:
"""
Function to get current game state:
ex: Game is over, double elixir, overtime, etc.
"""
pass
return 0



Expand Down

0 comments on commit f9a3c18

Please sign in to comment.