Advent of Code

Diff
Login

Diff

Differences From Artifact [7e73975195]:

To Artifact [5c45b25c23]:


92
93
94
95
96
97
98
99
100


101
102

103
104
105
106
107
108
109

110
111
112
113
114
115
116
92
93
94
95
96
97
98


99
100


101
102
103
104
105
106


107
108
109
110
111
112
113
114







-
-
+
+
-
-
+





-
-
+







    }
    unsigned output[100];
    size_t outlen = 0;
    unsigned ip = 0;
    while (ip + 1 < np) {
        ip = instruction(ip, p[ip], p[ip+1], reg, output, &outlen);
    }
    printf("Program's output is {");
    for (unsigned k = 0; k < outlen; k++) {
    printf("Program's output is {%u", output[0]);
    for (unsigned k = 1; k < outlen; k++) {
        if (k) putchar(',');
        putchar((int)output[k] + '0');
        printf(",%u", output[k]);
    }
    printf("}\n");

    printf("Program is          (%u", p[0]);
    for (unsigned k = 1; k < np; k++) {
        if (k) putchar(',');
        putchar((int)p[k] + '0');
        printf(",%u", p[k]);
    }
    printf(")\n");

    reg[3] = 202322936867370;
#if 0
    // I'm not happy with my "solution".
    // It wasn't the program who found it.