mirror of
https://github.com/Ajetski/advent-of-code.git
synced 2025-09-30 09:33:19 -09:00
use super for macro
This commit is contained in:
parent
8dbc7961b4
commit
85d01d6f4f
@ -55,11 +55,9 @@ advent_of_code_macro::solve_problem!(
|
|||||||
input.lines().map(|line| line.split(' ').map(|s| s.chars().next().unwrap()).collect()).collect()
|
input.lines().map(|line| line.split(' ').map(|s| s.chars().next().unwrap()).collect()).collect()
|
||||||
},
|
},
|
||||||
part one |data: Input| {
|
part one |data: Input| {
|
||||||
use super::Shape;
|
|
||||||
data.iter().map(|round| Shape::from_char(round[1]).result(&Shape::from_char(round[0]))).sum()
|
data.iter().map(|round| Shape::from_char(round[1]).result(&Shape::from_char(round[0]))).sum()
|
||||||
},
|
},
|
||||||
part two |data: Input| {
|
part two |data: Input| {
|
||||||
use super::Shape;
|
|
||||||
data.iter().map(|round| match round[1] {
|
data.iter().map(|round| match round[1] {
|
||||||
'X' => Shape::from_char(round[0]).wins_to().as_int(),
|
'X' => Shape::from_char(round[0]).wins_to().as_int(),
|
||||||
'Y' => Shape::from_char(round[0]).as_int() + 3,
|
'Y' => Shape::from_char(round[0]).as_int() + 3,
|
||||||
|
@ -10,6 +10,7 @@ macro_rules! solve_problem {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
paste::paste! {
|
paste::paste! {
|
||||||
mod [<day_ $day _tests>] {
|
mod [<day_ $day _tests>] {
|
||||||
|
use super::*;
|
||||||
type Input = $input_type;
|
type Input = $input_type;
|
||||||
fn parse_input(s: &str) -> Input {
|
fn parse_input(s: &str) -> Input {
|
||||||
$parse_input(s)
|
$parse_input(s)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user