🐛 Small difficulty setting fix

This commit is contained in:
jona605a
2020-08-04 11:44:29 +02:00
parent 3ca56b80ed
commit e1b767be68
2 changed files with 12 additions and 7 deletions

View File

@ -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