Ejemplo n.º 1
0
    def save_model(self, name: Optional[str] = None) -> None:
        if name is None:
            now = Utils.get_now_as_str()
            player_name = self.name.replace(' ', '_').replace('(', '').replace(
                ')', '').strip()
            name = f'{player_name}_{now}'

        self._nn.save(name)
Ejemplo n.º 2
0
    def _create_unique_log_file(self, log_dir_path: Path) -> None:
        extension = 'txt'
        log_name = Utils.get_now_as_str()
        log_path = log_dir_path.joinpath('.'.join([log_name, extension]))
        cnt = 0

        while log_path.exists():
            log_path = log_dir_path.joinpath('.'.join(
                [log_name, '_', str(cnt), extension]))
            cnt += 1

        with open(str(log_path), 'w') as file:
            file.write('')

        self._log_path = log_path