diff --git a/pythonium/bots/pacific_player.py b/pythonium/bots/pacific_player.py index 4a652e6..6111bb5 100644 --- a/pythonium/bots/pacific_player.py +++ b/pythonium/bots/pacific_player.py @@ -12,5 +12,5 @@ class Player(StandardPlayer): Same as :class:`standard_player.Player` but always build carriers """ - name = "Nofight Ink." + class_fantasy_name = "Nofight Ink." tenacity = 0 diff --git a/pythonium/bots/random_walk.py b/pythonium/bots/random_walk.py index bc71d1a..3405a96 100644 --- a/pythonium/bots/random_walk.py +++ b/pythonium/bots/random_walk.py @@ -9,7 +9,7 @@ class Player(AbstractPlayer): Move the available ships randomly """ - name = "Walkers" + class_fantasy_name = "Walkers" def next_turn(self, galaxy, context): diff --git a/pythonium/bots/standard_player.py b/pythonium/bots/standard_player.py index 563cd50..99812f6 100644 --- a/pythonium/bots/standard_player.py +++ b/pythonium/bots/standard_player.py @@ -9,7 +9,7 @@ class Player(AbstractPlayer): - name = "Solar Fed." + class_fantasy_name = "Solar Fed." colonization_transfer = Transfer(clans=50, megacredits=100) colonization_carrier_autonomy = 5 colonization_refill_transfer = ( diff --git a/pythonium/game.py b/pythonium/game.py index 6a4bdf1..59ad2ac 100644 --- a/pythonium/game.py +++ b/pythonium/game.py @@ -23,8 +23,6 @@ def __init__( :param game_mode: Class that define some game rules :type game_mode: :class:GameMode """ - if len(players) != len({p.name for p in players}): - raise ValueError("Player names must be unique") self.game_mode = game_mode self.players = players diff --git a/pythonium/main.py b/pythonium/main.py index 5c29f5f..b53c877 100644 --- a/pythonium/main.py +++ b/pythonium/main.py @@ -7,6 +7,7 @@ import time import uuid import webbrowser +from datetime import date from datetime import datetime as dt from pathlib import Path @@ -68,8 +69,11 @@ def run( _players = [] for player_module in players: player = importlib.import_module(player_module) - _player = player.Player() + fantasy_name = player.Player.class_fantasy_name + _player_name = f"{random_name(len(fantasy_name))} [{fantasy_name}]" + _player = player.Player(_player_name) _players.append(_player) + # breakpoint() if stream_state: output_handler = StreamOutputHanlder() diff --git a/pythonium/player.py b/pythonium/player.py index 9accb7f..e3f716d 100644 --- a/pythonium/player.py +++ b/pythonium/player.py @@ -6,7 +6,8 @@ @attr.s class AbstractPlayer: - name: str = attr.ib(init=False) + name: str = attr.ib(init=True) + """ Player's name. Please make it short (less than 12 characters), or you will break the gif and reports.