Created
December 10, 2022 13:22
-
-
Save maksverver/ee2ee796a814cdb5acaa18644a6e0947 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -349,7 +350,8 @@ | |
//int minx = 0, miny = 0, maxx = 0, maxy = 0; | |
BitGrid grid; | |
- int numCells = 0; | |
+ grid.Set(0, 0); | |
+ int numCells = 1; | |
while (ptr < end) | |
{ | |
@@ -364,17 +366,18 @@ | |
{ | |
int d = dir; | |
Move lastMove; | |
- for (int k = 0; k < NumKnots; k++) | |
+ for (int k = 0; k < NumKnots && d != None; k++) | |
{ | |
auto& state = knotStates[k]; | |
lastMove = States[state][d]; | |
state = lastMove.nextState; | |
d = lastMove.moveDir; | |
} | |
- x += lastMove.dx; | |
- y += lastMove.dy; | |
- | |
- numCells += grid.Set(x, y); | |
+ if (d != None) { | |
+ x += lastMove.dx; | |
+ y += lastMove.dy; | |
+ numCells += grid.Set(x, y); | |
+ } | |
} | |
} | |
tsimulate.Stop(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment