16 bool grid
[2*BASE
][2*BASE
]; // cheat: size it by analysis done in part 1
17 int x
= BASE
, y
= BASE
;
19 void travel(int dx
, int dy
, int n
)
25 if (grid
[x
][y
] && !found
) {
27 printf ("revisiting spot %d,%d, distance of %d\n", x
- BASE
, y
- BASE
,
28 abs (x
- BASE
) + abs (y
- BASE
));
39 int maxx
= BASE
, minx
= BASE
, maxy
= BASE
, miny
= BASE
;
41 while (scanf ("%c%d, ", &c
, &l
) == 2) {
69 printf ("final distance is %d\n", abs (x
- BASE
) + abs (y
- BASE
));
70 printf ("grid size x=%d to %d y=%d to %d\n", minx
- BASE
, maxx
- BASE
,
71 miny
- BASE
, maxy
- BASE
);