Commit 5fba1b44 authored by Taddeüs Kroes's avatar Taddeüs Kroes

Smarter way of looking at empty columns

parent d1321855
......@@ -54,16 +54,29 @@ class State:
for col in range(COLUMNS):
yield self.nrows() - self.colskip(col)
def hole_score(self):
score = 0
for col in range(COLUMNS):
for row in range(self.nrows()):
i = row * COLUMNS + col
if self.blocks[i] != NOBLOCK:
break
score += row + 1
return score
def score(self, points, moves, prev):
frag = self.fragmentation()
colsizes = list(self.colsizes())
mincol = min(colsizes)
#mincol = min(colsizes)
maxcol = max(colsizes)
colsize_score = maxcol, colsizes.count(maxcol), -mincol
colsize_score = maxcol, colsizes.count(maxcol) #, -mincol
#colsize_score = tuple(sorted(colsizes, reverse=True))
#if prev.nrows() >= 6:
# return colsize_score, -points, frag, len(moves)
colsize_score = maxcol, self.hole_score()
prev_colsize = max(prev.colsizes())
if prev_colsize >= COLSIZE_PRIO:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment