From e0fd7d8a3455c21ebca24a9cb57ecffbe3ae4dc8 Mon Sep 17 00:00:00 2001 From: richmans Date: Wed, 8 Apr 2026 21:50:17 +0200 Subject: [PATCH] debugging --- farm/farm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/farm/farm.c b/farm/farm.c index 750ecfd..6aa3a36 100644 --- a/farm/farm.c +++ b/farm/farm.c @@ -154,11 +154,13 @@ int run_simulations(struct Maps* maps, struct Program* program) { if (map->cells[cell_from(ant->cell, 3)] == v1) dirs[found_dirs++] = 3; if (map->cells[cell_from(ant->cell, 4)] == v1) dirs[found_dirs++] = 4; if (found_dirs == 0) { - res = (rnum(&rstate) % 4) + 1; + res = 0; } else if (found_dirs == 1) { + debug("FOUND 1\n"); res = dirs[0]; } else { int dirrie = rnum(&rstate) % found_dirs; + debug("FOUND %d\n", found_dirs); res = dirs[dirrie]; } set_reg(ant, v2, res); @@ -171,7 +173,7 @@ int run_simulations(struct Maps* maps, struct Program* program) { set_reg(ant, ins->arg2, v1); break; case INS_PICKUP: - debug("PICKUP?\n"); + debug("PICKUP? %d %d\n", ant->carrying, food[ant->cell]); if (!ant->carrying && food[ant->cell] > 0) { ant->carrying = food[ant->cell]--; debug("PICKUP!\n");