def _get_wage_from_game_master_memory(
    memory: associative_memory.AssociativeMemory,
    initial_wage: float,
):
  """Retrieve the latest wage from the game master memory."""
  wage = initial_wage
  retrieved = memory.retrieve_by_regex(
      regex=r'\[set wage\].*',
      sort_by_time=True,
  )
  if retrieved:
    result = retrieved[-1]
    wage = float(result[result.find('[set wage]') + len('[set wage]') + 1 :])
  return wage
Retrieve the latest wage from the game master memory.
examples/deprecated/modular/environment/labor_collective_action.py