Overview
Comment: | 202408 2nd star |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
9395df6993597fb8dbaa110014994d2a |
User & Date: | nnz on 2024-12-08 17:11:10 |
Other Links: | manifest | tags |
Context
2024-12-09
| ||
11:50 | 202409 1st star check-in: 8682072363 user: nnz tags: trunk | |
2024-12-08
| ||
17:11 | 202408 2nd star check-in: 9395df6993 user: nnz tags: trunk | |
16:02 | 202408 1st star check-in: 6c8d6b453f user: nnz tags: trunk | |
Changes
Modified aoc2024.c from [98ee960fa7] to [05505307b8].
︙ | |||
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | + + + + - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + | (void)len; // unused argument struct TextGrid tg; tg.data = data; tg.cols = strchr(data, '\n') - data + 1; tg.rows = tg.cols - 1; // rows includes the '\n' unsigned anti[512][2]; // locations of antinodes; col at index 0, row at 1 unsigned nanti = 0; unsigned anti2[1024][2]; // locations of antinodes; col at index 0, row at 1 unsigned nanti2 = 0; char *p = data; while (*p) { while ((*p == '.') || (*p == '\n')) p++; if (*p) { // p points to an antenna unsigned prow = TGrow(&tg, p), pcol = TGcol(&tg, p); char *q = strchr(p+1, *p); while (q) { // q points to an antenna of the same type as p unsigned qrow = TGrow(&tg, q), qcol = TGcol(&tg, q); int deltarow = (int)qrow - (int)prow; int deltacol = (int)qcol - (int)pcol; int anticol = (int)pcol - deltacol; int antirow = (int)prow - deltarow; unsigned *ff; if (TGvalid(&tg, (unsigned)anticol, (unsigned)antirow) && (*TGcharptr(&tg, (unsigned)anticol, (unsigned)antirow) != '\n')) { |
︙ |