🐛
This commit is contained in:
@@ -50,7 +50,7 @@ class HexGame():
|
||||
return self.placeHex(channel,commands[1], user)
|
||||
except:
|
||||
return "I didn't get that. To place a piece use \"!hex place [position]\". A valid position is e.g. \"E2\".", False, False, False, False
|
||||
|
||||
|
||||
# Undo
|
||||
elif commands[0] == "undo":
|
||||
return self.undoHex(channel, user)
|
||||
@@ -82,11 +82,10 @@ class HexGame():
|
||||
else:
|
||||
return "I didn't get that. Use \"!hex start [opponent]\" to start a game, \"!hex place [position]\" to place a piece, \"!hex undo\" to undo your last move or \"!hex stop\" to stop a current game.", False, False, False, False
|
||||
|
||||
|
||||
# Starts the game
|
||||
def hexStart(self, channel, user, opponent):
|
||||
game = self.bot.database["hex games"].find_one({"_id":channel})
|
||||
|
||||
|
||||
if game == None:
|
||||
if opponent in ["1","2","3","4","5"]:
|
||||
difficulty = int(opponent)
|
||||
@@ -108,7 +107,7 @@ class HexGame():
|
||||
# Opponent is another player
|
||||
difficulty = 3
|
||||
diffText = ""
|
||||
|
||||
|
||||
# board is 11x11
|
||||
board = [ [ 0 for i in range(BOARDWIDTH) ] for j in range(BOARDWIDTH) ]
|
||||
players = [user,opponent]
|
||||
@@ -141,7 +140,7 @@ class HexGame():
|
||||
player = turn
|
||||
else:
|
||||
player = players.index(user)+1
|
||||
|
||||
|
||||
if player == turn:
|
||||
board = game["board"]
|
||||
|
||||
@@ -155,7 +154,6 @@ class HexGame():
|
||||
turn = 1 if turn == 2 else 2
|
||||
self.bot.database["hex games"].update_one({"_id":channel},{"$set":{"turn":turn}})
|
||||
|
||||
|
||||
# Checking for a win
|
||||
logThis("Checking for win")
|
||||
winner = self.evaluateBoard(game["board"])[1]
|
||||
|
||||
Reference in New Issue
Block a user