fixed a bug in field generation which meant that the lines of the first hit square can't be mines

master
panki27 7 years ago
parent fa2509343b
commit 803d2ad25e

@ -129,8 +129,8 @@ def setup_playfield(w, h, x, y):
minesleft = MINECOUNT minesleft = MINECOUNT
while minesleft > 0: while minesleft > 0:
randx = random.randint(0, width-1) randx = random.randint(0, width-1)
randy = random.randint(1, height-1) randy = random.randint(0, height-1)
if playfield[randy][randx] != MINE and randx != x and randy != y: if playfield[randy][randx] != MINE and ([randx, randy] != CURSOR_POSITION):
playfield[randy][randx] = MINE playfield[randy][randx] = MINE
minesleft -= 1 minesleft -= 1
FIELD_GENERATED = True FIELD_GENERATED = True

Loading…
Cancel
Save