aturfah / cmplxsys530-final

Final Project for Complex Systems 530 WN18
MIT License
2 stars 2 forks source link

Ladder errors out when trying to match with no available players #150

Closed aturfah closed 5 years ago

aturfah commented 5 years ago

Using following config

game_choice: 4
num_players: 10
num_games: 10
multithread: 1
selection_size: 10
config: "sample_simulations/sim_configs/sample_pkmn_config.json"

Get following error when matching players

Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/home/ali/Documents/projects/cmplxsys530-final/simulation/pkmn_simulation.py", line 124, in battle
    results = main_sim.ladder.run_game()
  File "/home/ali/Documents/projects/cmplxsys530-final/ladder/base_ladder.py", line 148, in run_game
    player, opp = self.match_players()
  File "/home/ali/Documents/projects/cmplxsys530-final/ladder/base_ladder.py", line 106, in match_players
    opponent_choice = randint(0, len(candidate_opponents)-1)
  File "/usr/lib/python3.6/random.py", line 221, in randint
    return self.randrange(a, b+1)
  File "/usr/lib/python3.6/random.py", line 199, in randrange
    raise ValueError("empty range for randrange() (%d,%d, %d)" % (istart, istop, width))
ValueError: empty range for randrange() (0,0, 0)
aturfah commented 5 years ago

Addressed in #152