Overview
Comment: | 202408 1st star |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
6c8d6b453fa1f933f6155a2e8c3a51c0 |
User & Date: | nnz on 2024-12-08 16:02:59 |
Other Links: | manifest | tags |
Context
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 | |
15:25 | 202408 found the antinodes; counting to do check-in: ce30145a0d user: nnz tags: trunk | |
Changes
Modified Makefile from [5fd029b772] to [e5558dd887].
| 1 2 3 4 5 6 7 8 | - + |
|
︙ |
Modified aoc2024.c from [ffa5f1e4f3] to [98ee960fa7].
︙ | |||
10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 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 | + + + + + + + + - - + - - - - - - + + + + - - - - - + + + + - - - + + - - - - - - + + + - - - - - - - + - - - - - - - + + - - - - - - - - - + + + + + + - - | /* === aoc202408 ======================================================= Oh! another square of text! Idea: for all points p with an antenna find all points q>p with a corresponding frequency. For each such pair calculate the 2 antinodes and add the resulting points (if not there already) to an array. The answer to Part One is the number of elements in the array ===================================================================== */ static unsigned *antinode_find(unsigned (*a)[2], size_t n, unsigned col, unsigned row) { for (size_t k = 0; k < n; k++) { if ((a[k][0] == col) && (a[k][1] == row)) return a[k]; } return NULL; } void aoc202408(char *data, size_t len) { (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' |
︙ |
Modified aocutils.c from [462345b34b] to [e6035b6b40].
1 2 3 4 5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | - + - - + + | #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include "aocutils.h" |
︙ |
Modified aocutils.h from [8f6a78c0fe] to [11e9112422].
1 2 3 4 5 6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | - + - - + + | #ifndef AOCUTILS_H_INCLUDED #define AOCUTILS_H_INCLUDED #include <stdbool.h> struct TextGrid { |
︙ |