Advent of Code

Check-in [fc7808669f]
Login

Check-in [fc7808669f]

Overview
Comment:202406 confirm 4 for repetitions
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: fc7808669f2f6b95533e94f285298b297a3077f17d44ed258a7d1b25d1cd47d2
User & Date: nnz on 2024-12-06 16:32:27
Other Links: manifest | tags
Context
2024-12-06
16:45
not that it matters, but bug squashed check-in: aec632be32 user: nnz tags: trunk
16:32
202406 confirm 4 for repetitions check-in: fc7808669f user: nnz tags: trunk
16:28
202406 2nd star (not pretty) check-in: 6538876b94 user: nnz tags: trunk
Changes

Modified aoc2024.c from [4d7b1de895] to [f86e25f6c6].

67
68
69
70
71
72
73
74

75
76
77
78
79
80
81
82
83

84
85
86
87
88
89
90
67
68
69
70
71
72
73

74
75
76
77
78





79
80
81
82
83
84
85
86







-
+




-
-
-
-
-
+







            bool looping = false;
            while (!looping && validpos(size, row_pos + deltarow, col_pos + deltacol)) {
                switch (data[linearize2d(size, (unsigned)(row_pos+deltarow), (unsigned)(col_pos+deltacol))]) {
                    default: puts("stepped on default"); exit(EXIT_FAILURE);
                    case '#': if (data[linearize2d(size, (unsigned)(row_pos), (unsigned)(col_pos))] == '8') looping = true;
                              rightturn(&deltarow, &deltacol);
                              break;
                    case '8': looping = true; break;
                    case '4': looping = true; break;
                    case '.': data[linearize2d(size, (unsigned)(row_pos+deltarow), (unsigned)(col_pos+deltacol))] = '0';
                              /*fallthrough*/
                    case '1':
                    case '2':
                    case '3':
                    case '4':
                    case '5':
                    case '6':
                    case '7': data[linearize2d(size, (unsigned)(row_pos+deltarow), (unsigned)(col_pos+deltacol))]++;
                    case '3': data[linearize2d(size, (unsigned)(row_pos+deltarow), (unsigned)(col_pos+deltacol))]++;
                              row_pos += deltarow;
                              col_pos += deltacol;
                              break;
                }
            }
            if (looping) positions++;
        }