-
Notifications
You must be signed in to change notification settings - Fork 0
/
new_day.sh
executable file
·92 lines (69 loc) · 1.64 KB
/
new_day.sh
1
2
3
4
5
6
7
8
9
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash
DAY=$(printf "%02d" $1)
DIR="src/day${DAY}"
mkdir -p ${DIR}
cat <<EOT > ${DIR}/mod.rs
use std::fs;
pub fn run() {
let input = fs::read_to_string("src/day${DAY}/input.txt").expect("Failed to read input");
println!("Solution 1: {}", part1(&input));
println!("Solution 2: {}", part2(&input));
}
fn part1(input: &str) -> i32 {
0
}
fn part2(input: &str) -> i32 {
0
}
EOT
cat <<EOT > ${DIR}/tests.rs
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_part1() {
let input = "test input data";
assert_eq!(part1(input), 0); // Update expected result
}
#[test]
fn test_part2() {
let input = "test input data";
assert_eq!(part2(input), 0); // Update expected result
}
}
EOT
touch ${DIR}/input.txt
cat <<EOT > ${DIR}/notes.md
# Day ${DAY}: [Puzzle Title]
## Problem Description
---
## Brainstorming
### Input structure:
### Key observations:
### Edge cases:
### Language specific considerations:
---
## Plan
1. Parse the input.
2. Implement solution for part 1:
- Steps:
3. Solve part 2 (if revealed):
- Steps:
4. Write tests for edge cases and example cases.
---
## TODO
- [ ] Parse input.
- [ ] Write the \`part1\` function.
- [ ] Test \`part1\` with example data.
- [ ] Solve part 2.
- [ ] Optimize if needed.
---
## Notes
- (Additional thoughts about the problem.)
---
## Example Cases
| Input | Expected Output Part 1 | Expected Output Part 2 |
|--------------------------|------------------------|-------------------------|
| | | |
EOT
echo "Setup complete for day ${DAY}"