🐛
This commit is contained in:
@@ -599,7 +599,6 @@ class Blackjack():
|
|||||||
else:
|
else:
|
||||||
reason = "(highest value)"
|
reason = "(highest value)"
|
||||||
|
|
||||||
|
|
||||||
if topLevel:
|
if topLevel:
|
||||||
if hand["split"] >= 1:
|
if hand["split"] >= 1:
|
||||||
winningsTemp, netWinningsTemp, reasonTemp = self.calcWinnings(hand["other hand"],dealerValue,False,dealerBlackjack,dealerBusted)
|
winningsTemp, netWinningsTemp, reasonTemp = self.calcWinnings(hand["other hand"],dealerValue,False,dealerBlackjack,dealerBusted)
|
||||||
|
|||||||
@@ -173,8 +173,8 @@ class FourInARow():
|
|||||||
winDirection = ""
|
winDirection = ""
|
||||||
winCoordinates = [0,0]
|
winCoordinates = [0,0]
|
||||||
|
|
||||||
for row in range(len(board)):
|
for row in range(rowCount):
|
||||||
for place in range(len(board[row])):
|
for place in range(columnCount):
|
||||||
if won == 0:
|
if won == 0:
|
||||||
piecePlayer = board[row][place]
|
piecePlayer = board[row][place]
|
||||||
if piecePlayer != 0:
|
if piecePlayer != 0:
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ class HexGame():
|
|||||||
return self.placeHex(channel,commands[1], user)
|
return self.placeHex(channel,commands[1], user)
|
||||||
except:
|
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
|
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
|
# Undo
|
||||||
elif commands[0] == "undo":
|
elif commands[0] == "undo":
|
||||||
return self.undoHex(channel, user)
|
return self.undoHex(channel, user)
|
||||||
@@ -82,11 +82,10 @@ class HexGame():
|
|||||||
else:
|
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
|
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
|
# Starts the game
|
||||||
def hexStart(self, channel, user, opponent):
|
def hexStart(self, channel, user, opponent):
|
||||||
game = self.bot.database["hex games"].find_one({"_id":channel})
|
game = self.bot.database["hex games"].find_one({"_id":channel})
|
||||||
|
|
||||||
if game == None:
|
if game == None:
|
||||||
if opponent in ["1","2","3","4","5"]:
|
if opponent in ["1","2","3","4","5"]:
|
||||||
difficulty = int(opponent)
|
difficulty = int(opponent)
|
||||||
@@ -108,7 +107,7 @@ class HexGame():
|
|||||||
# Opponent is another player
|
# Opponent is another player
|
||||||
difficulty = 3
|
difficulty = 3
|
||||||
diffText = ""
|
diffText = ""
|
||||||
|
|
||||||
# board is 11x11
|
# board is 11x11
|
||||||
board = [ [ 0 for i in range(BOARDWIDTH) ] for j in range(BOARDWIDTH) ]
|
board = [ [ 0 for i in range(BOARDWIDTH) ] for j in range(BOARDWIDTH) ]
|
||||||
players = [user,opponent]
|
players = [user,opponent]
|
||||||
@@ -141,7 +140,7 @@ class HexGame():
|
|||||||
player = turn
|
player = turn
|
||||||
else:
|
else:
|
||||||
player = players.index(user)+1
|
player = players.index(user)+1
|
||||||
|
|
||||||
if player == turn:
|
if player == turn:
|
||||||
board = game["board"]
|
board = game["board"]
|
||||||
|
|
||||||
@@ -155,7 +154,6 @@ class HexGame():
|
|||||||
turn = 1 if turn == 2 else 2
|
turn = 1 if turn == 2 else 2
|
||||||
self.bot.database["hex games"].update_one({"_id":channel},{"$set":{"turn":turn}})
|
self.bot.database["hex games"].update_one({"_id":channel},{"$set":{"turn":turn}})
|
||||||
|
|
||||||
|
|
||||||
# Checking for a win
|
# Checking for a win
|
||||||
logThis("Checking for win")
|
logThis("Checking for win")
|
||||||
winner = self.evaluateBoard(game["board"])[1]
|
winner = self.evaluateBoard(game["board"])[1]
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import math
|
import math
|
||||||
import os
|
|
||||||
|
|
||||||
from PIL import Image, ImageDraw, ImageFont
|
from PIL import Image, ImageDraw, ImageFont
|
||||||
from funcs import logThis
|
from funcs import logThis
|
||||||
@@ -161,10 +160,10 @@ class DrawHex():
|
|||||||
try:
|
try:
|
||||||
with Image.open(FILEPATH) as im:
|
with Image.open(FILEPATH) as im:
|
||||||
d = ImageDraw.Draw(im,"RGBA")
|
d = ImageDraw.Draw(im,"RGBA")
|
||||||
|
|
||||||
# Write player names and color
|
# Write player names and color
|
||||||
for p in [1,2]:
|
for p in [1,2]:
|
||||||
playername = getName(game["players"][p%2])
|
playername = self.bot.funcs.getName(game["players"][p%2])
|
||||||
|
|
||||||
x = X_NAME[p]
|
x = X_NAME[p]
|
||||||
x -= NAME_fnt.getsize(playername)[0] if p==2 else 0 # player2's name is right-aligned
|
x -= NAME_fnt.getsize(playername)[0] if p==2 else 0 # player2's name is right-aligned
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import time # Used for logging
|
|||||||
import logging # Used for... you know... logging
|
import logging # Used for... you know... logging
|
||||||
import wikia # Used by findWikiPage
|
import wikia # Used by findWikiPage
|
||||||
import os # Used by makeFiles
|
import os # Used by makeFiles
|
||||||
import pymongo # Used by transferUsers
|
|
||||||
|
|
||||||
logging.basicConfig(filename="gwendolyn.log", level=logging.INFO)
|
logging.basicConfig(filename="gwendolyn.log", level=logging.INFO)
|
||||||
|
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ class SwRoll():
|
|||||||
emoji += 'L'
|
emoji += 'L'
|
||||||
if char == "<:dark:691010101901000852>":
|
if char == "<:dark:691010101901000852>":
|
||||||
emoji += 'B'
|
emoji += 'B'
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
# Returns emoji that symbolize the dice
|
# Returns emoji that symbolize the dice
|
||||||
|
|||||||
Reference in New Issue
Block a user