from games.jax_game import JaxGame
from games.jax_goofspiel import JaxGoofspiel
from games.jax_leduc import JaxLeduc
from games.jax_oshi_zumo import JaxOshiZumo
import numpy as np

def stringify(a: list[float]) -> str:
  return ",".join(str(i) for i in a)

def destringify(a: str) -> list[float]:
  return np.array([float(i) for i in a.split(",")])

def get_game_name(game: JaxGame) -> str:
  if isinstance(game, JaxGoofspiel):
    return f"goofspiel_{game.cards}_{game.points_order}"
  elif isinstance(game, JaxLeduc):
    return "leduc"
  elif isinstance(game, JaxOshiZumo):
    return f"oshi_zumo_{game.board_size}_{game.initial_coins}"
  else:
    raise ValueError(f"Game {game} is not supported")
