Example #1
0
 def get_players(self):
     player_records = self.retrieve(
         "select * from players where active > 0")
     players = [
         util.parse_player_record(player) for player in player_records
     ]
     return players
Example #2
0
 def show_ranks(self, tsv=False):
     print()
     if tsv:
         print ("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s" % ("name", "last_seen", "rank", "skill", "mu", "sigma", "ngames", "active"))
     else:
         print ("{:<25}{:<20}{:^6}  {:^10}{:^10}{:^10}{:^8}{:^8}    {:<30}".format("name", "last_seen", "rank", "skill", "mu", "sigma", "ngames", "active", "path"))
     sql = "select * from players where active > 0 order by skill desc" if self.exclude_inactive else "select * from players order by skill desc"
     for p in self.db.retrieve(sql):
         print(str(util.parse_player_record(p)))
Example #3
0
 def edit_path(self, name, path):
     p = self.db.get_player((name,))
     if not p:
         print ('Bot name %s not found, no edits made' %(name))
     else:
         p = util.parse_player_record(p[0])
         print ("Updating path for bot %s" % (name))
         print ("Old path: %s" % p.path)
         print ("New path: %s" % path)
         self.db.update_player_path(name, path)
Example #4
0
 def run_matches(self, rounds):
     player_records = self.manager.db.retrieve("select * from players where active > 0")
     players = [util.parse_player_record(player) for player in player_records]
     self.total_players = len(players)
     if self.total_players > 3:
         players_max = 4
         self.manager.players_max = 4
     if len(players) < 2:
         print("Not enough players for a game. Need at least " + str(self.manager.players_min) + ", only have " + str(len(players)))
         print("use the -h flag to get help")
     else:
         self.manager.players = players
         self.manager.rounds = rounds
         self.manager.run_rounds(self.cmds.player_dist, self.cmds.map_dist)