Added MIN_PLAYERS setting.

This commit is contained in:
Yizhe Shen 2014-02-16 20:22:27 -05:00
parent 510dcfa9bf
commit 9ad5713471
2 changed files with 6 additions and 5 deletions

View File

@ -2337,8 +2337,8 @@ def start(cli, nick, chann_, rest):
cli.msg(chan, "Please wait at least {0} more seconds.".format(dur))
return
if len(villagers) < 4:
cli.msg(chan, "{0}: Four or more players are required to play.".format(nick))
if len(villagers) < var.MIN_PLAYERS:
cli.msg(chan, "{0}: {1} or more players are required to play.".format(nick, var.MIN_PLAYERS))
return
for pcount in range(len(villagers), 3, -1):
@ -2921,8 +2921,8 @@ def game_stats(cli, nick, chan, rest):
# Check for invalid input
rest = rest.strip()
if not rest.isdigit() or int(rest) > var.MAX_PLAYERS or int(rest) < 4:
cli.notice(nick, "Please enter an integer between {0} and {1}.".format(4, var.MAX_PLAYERS))
if not rest.isdigit() or int(rest) > var.MAX_PLAYERS or int(rest) < var.MIN_PLAYERS:
cli.notice(nick, "Please enter an integer between {0} and {1}.".format(var.MIN_PLAYERS, var.MAX_PLAYERS))
return
# Attempt to find game stats for the given game size.

View File

@ -8,6 +8,7 @@ STATS_RATE_LIMIT = 60
VOTES_RATE_LIMIT = 60
ADMINS_RATE_LIMIT = 300
SHOTS_MULTIPLIER = .12 # ceil(shots_multiplier * len_players) = bullets given
MIN_PLAYERS = 4
MAX_PLAYERS = 21
DRUNK_SHOTS_MULTIPLIER = 3
NIGHT_TIME_LIMIT = 120
@ -333,7 +334,7 @@ def get_game_totals():
size_totals = []
total = 0
with conn:
for size in range(4, MAX_PLAYERS + 1):
for size in range(MIN_PLAYERS, MAX_PLAYERS + 1):
c.execute("SELECT size, totalgames FROM gamestats WHERE size=?", (size,))
row = c.fetchone()
if row: