📝 Replaced "lastMove" with "gameHistory", so you can now undo several times in a row

This commit is contained in:
jona605a
2020-08-09 23:26:18 +02:00
parent 437c3e7668
commit bc11c5dd24
2 changed files with 13 additions and 31 deletions

View File

@ -21,7 +21,7 @@ LINETHICKNESS = 15
HEXTHICKNESS = 6 # This is half the width of the background lining between every hex
X_THICKNESS = HEXTHICKNESS * math.cos(math.pi/6)
Y_THICKNESS = HEXTHICKNESS * math.sin(math.pi/6)
BACKGROUND_COLOR = (230,230,230)
BACKGROUND_COLOR = (235,235,235)
BETWEEN_COLOR = BACKGROUND_COLOR
BLANK_COLOR = "lightgrey"
PIECECOLOR = {1:(237,41,57),2:(0,165,255),0:BLANK_COLOR} # player1 is red, player2 is blue
@ -41,16 +41,12 @@ SMOL_SIDELENGTH = SIDELENGTH * 0.6
def drawBoard(channel):
logThis("Drawing empty Hex board")
# Creates the empty image
im = Image.new('RGB', size=(CANVAS_WIDTH, CANVAS_HEIGHT),color = BACKGROUND_COLOR)
# 'd' is a shortcut to drawing on the image
d = ImageDraw.Draw(im,"RGBA")
# The board is indexed with [row][column]
# Drawing all the hexagons
for column in BOARDCOORDINATES:
for startingPoint in column:
x = startingPoint[0]
@ -98,22 +94,6 @@ def drawBoard(channel):
d.text( (X_OFFSET + HEXAGONWIDTH*(i/2+11) + 30 , Y_OFFSET + 6 + i*HEXAGONHEIGHT) , str(i+1), font=fnt, fill=TEXTCOLOR)
# Write player names and color
"""
with open("resources/games/hexGames.json", "r") as f:
data = json.load(f)
board = data[channel]["board"]
# Getting player names
players = data[channel]["players"]
if players[0] == "Gwendolyn":
player1 = "Gwendolyn"
else:
player1 = getName(players[0])
if players[1] == "Gwendolyn":
player2 = "Gwendolyn"
else:
player2 = getName(players[1])
"""
with open("resources/games/hexGames.json", "r") as f:
data = json.load(f)
for p in [1,2]: