|
|
@@ -81,6 +81,8 @@ class State:
|
|
|
return 0
|
|
|
|
|
|
def holes(self):
|
|
|
+ #return self.imbalance()
|
|
|
+
|
|
|
start_row = self.empty_rows()
|
|
|
score = 0
|
|
|
for col in range(COLUMNS):
|
|
|
@@ -232,6 +234,13 @@ class State:
|
|
|
|
|
|
return -points
|
|
|
|
|
|
+ def imbalance(self):
|
|
|
+ colsizes = tuple(self.nrows - skip
|
|
|
+ for col, skip in enumerate(self.colskip))
|
|
|
+ #if not self.colbusy(col))
|
|
|
+ mean = sum(colsizes) / len(colsizes)
|
|
|
+ return sum((size - mean) ** 2 for size in colsizes)
|
|
|
+
|
|
|
def gen_moves(self):
|
|
|
if self.held == NOBLOCK:
|
|
|
yield self
|