Skip to content

Commit

Permalink
Delete outdated base class and hide private methods
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 672943454
Change-Id: I835595810781f909999c349b84952bfd7eea5520
  • Loading branch information
jagapiou authored and copybara-github committed Sep 10, 2024
1 parent a7895a1 commit bfd1136
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 94 deletions.
18 changes: 7 additions & 11 deletions concordia/environment/game_master.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
from concordia.typing import agent as agent_lib
from concordia.typing import clock as game_clock
from concordia.typing import component
from concordia.typing import game_master as simulacrum_game_master
from concordia.utils import concurrency
from concordia.utils import helper_functions
import termcolor
Expand Down Expand Up @@ -75,7 +74,7 @@ class LogEntry:
summary: str


class GameMaster(simulacrum_game_master.GameMaster):
class GameMaster:
"""A generic game master."""

def __init__(
Expand Down Expand Up @@ -196,9 +195,6 @@ def extend_history(self, new_history: Sequence[Mapping[str, Any]]):
def get_memory(self) -> associative_memory.AssociativeMemory:
return self._memory

def get_data_frame(self):
return self._memory.get_data_frame()

def _print(self, entry, color=None):
print(termcolor.colored(entry, color or self._log_color))

Expand All @@ -209,7 +205,7 @@ def reset(self):
def get_player_names(self):
return list(self._players_by_name.keys())

def update_from_player(self, player_name: str, action_attempt: str):
def _update_from_player(self, player_name: str, action_attempt: str):
prompt = interactive_document.InteractiveDocument(self._model)

concurrency.map_parallel(
Expand Down Expand Up @@ -292,7 +288,7 @@ def get_externality(externality):

return event_statement

def view_for_player(self, player_name):
def _view_for_player(self, player_name):
"""Send observations to a player."""
for comp in self._components.values():
state_of_component = comp.partial_state(player_name)
Expand All @@ -303,7 +299,7 @@ def view_for_player(self, player_name):

return

def update_components(self) -> None:
def _update_components(self) -> None:
concurrency.run_tasks({
f'{component.name}.update': functools.partial(
helper_functions.apply_recursively,
Expand All @@ -318,8 +314,8 @@ def _step_player(
player: deprecated_agent.BasicAgent,
action_spec: agent_lib.ActionSpec | None = None,
):
self.update_components()
self.view_for_player(player_name=player.name)
self._update_components()
self._view_for_player(player_name=player.name)

if action_spec is None:
action_spec_this_time = self._action_spec[player.name]
Expand All @@ -329,7 +325,7 @@ def _step_player(
action = player.act(action_spec_this_time)
action_spec_this_time.validate(action)

self.update_from_player(action_attempt=action, player_name=player.name)
self._update_from_player(action_attempt=action, player_name=player.name)

def step(
self,
Expand Down
83 changes: 0 additions & 83 deletions concordia/typing/game_master.py

This file was deleted.

0 comments on commit bfd1136

Please sign in to comment.