summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2022-01-20 23:12:16 -0500
committerJune McEnroe <june@causal.agency>2022-01-20 23:12:16 -0500
commit997ab4af41b0bef3203f06962f35d3e2ecabdff1 (patch)
treece3d6a358d80fd3e9f5a1bb1da9d17410e00e1a5
parentAdd SDL2Config.cmake workarounds for MinGW compiler (diff)
downloadwep-997ab4af41b0bef3203f06962f35d3e2ecabdff1.tar.gz
wep-997ab4af41b0bef3203f06962f35d3e2ecabdff1.zip
Only use cells for moveColumn
So long as the move queuer doesn't use empty tableau stacks correctly,
it shouldn't use them at all. This way it's easier to do the correct
moves manually.
Diffstat (limited to '')
-rw-r--r--freecell.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/freecell.c b/freecell.c
index 06276d3..16b13f8 100644
--- a/freecell.c
+++ b/freecell.c
@@ -188,18 +188,17 @@ static uint moveDepth(uint src) {
 	return n;
 }
 
-static uint freeCells(uint cells[], uint dst) {
+static uint freeCells(uint cells[]) {
 	uint len = 0;
-	for (uint i = Cell1; i <= Tableau8; ++i) {
-		if (i == dst) continue;
+	for (uint i = Cell1; i <= Cell4; ++i) {
 		if (!stacks[i].len) cells[len++] = i;
 	}
 	return len;
 }
 
 static void moveColumn(uint dst, uint src) {
-	uint cells[StacksLen];
-	uint free = freeCells(cells, dst);
+	uint cells[4];
+	uint free = freeCells(cells);
 
 	uint depth;
 	for (depth = moveDepth(src); depth; --depth) {