|
@@ -54,16 +54,29 @@ class State:
|
|
|
for col in range(COLUMNS):
|
|
for col in range(COLUMNS):
|
|
|
yield self.nrows() - self.colskip(col)
|
|
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):
|
|
def score(self, points, moves, prev):
|
|
|
frag = self.fragmentation()
|
|
frag = self.fragmentation()
|
|
|
colsizes = list(self.colsizes())
|
|
colsizes = list(self.colsizes())
|
|
|
- mincol = min(colsizes)
|
|
|
|
|
|
|
+ #mincol = min(colsizes)
|
|
|
maxcol = max(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))
|
|
#colsize_score = tuple(sorted(colsizes, reverse=True))
|
|
|
#if prev.nrows() >= 6:
|
|
#if prev.nrows() >= 6:
|
|
|
# return colsize_score, -points, frag, len(moves)
|
|
# return colsize_score, -points, frag, len(moves)
|
|
|
|
|
|
|
|
|
|
+ colsize_score = maxcol, self.hole_score()
|
|
|
|
|
+
|
|
|
prev_colsize = max(prev.colsizes())
|
|
prev_colsize = max(prev.colsizes())
|
|
|
|
|
|
|
|
if prev_colsize >= COLSIZE_PRIO:
|
|
if prev_colsize >= COLSIZE_PRIO:
|