diff --git a/funcs/games/fourInARow.py b/funcs/games/fourInARow.py index 2648add..c418a48 100644 --- a/funcs/games/fourInARow.py +++ b/funcs/games/fourInARow.py @@ -32,11 +32,16 @@ def fourInARowStart(channel, user, opponent): if opponent in ["1","2","3","4","5"]: difficulty = int(opponent) opponent = "Gwendolyn" - elif opponent in ["0","6","7","8","9","10","69","100","420"]: - return "That difficulty doesn't exist", False, False, False, False + elif opponent.lower() == "gwendolyn": + difficulty = 3 + opponent = "Gwendolyn" else: - # Opponent is another player - difficulty = "5" + try: + int(opponent) + return "That difficulty doesn't exist", False, False, False, False + except: + # Opponent is another player + difficulty = 5 board = [ [ 0 for i in range(columnCount) ] for j in range(rowCount) ] players = [user,opponent] @@ -137,7 +142,7 @@ def parseFourInARow(command, channel, user): return "I didn't get that. Use \"!fourinarow start [opponent]\" to start a game. To play against the computer, use difficulty 1 through 5 as the [opponent].", False, False, False, False elif commands[0] == "start": # Starting a game - if len(commands) == 1: # if the commands is "!hex start", the opponent is Gwendolyn + if len(commands) == 1: # if the commands is "!fourinarow start", the opponent is Gwendolyn commands.append("3") return fourInARowStart(channel,user,commands[1]) # commands[1] is the opponent diff --git a/funcs/games/hex.py b/funcs/games/hex.py index e4ea18d..60c6b49 100644 --- a/funcs/games/hex.py +++ b/funcs/games/hex.py @@ -17,7 +17,7 @@ def parseHex(command, channel, user): elif commands[0] == "start": # Starting a game if len(commands) == 1: # if the commands is "!hex start", the opponent is Gwendolyn - commands.append("Gwendolyn") + commands.append("2") return hexStart(channel,user,commands[1]) # commands[1] is the opponent # Stopping the game @@ -46,7 +46,7 @@ def hexStart(channel, user, opponent): data = json.load(f) if user.lower() != opponent.lower(): - if channel not in data["4 in a row games"]: + if channel not in data["hex games"]: if opponent in ["1","2","3","4","5"]: difficulty = int(opponent)