|
|
|
@ -7,7 +7,8 @@ use advent_of_code::main;
|
|
|
|
|
main!();
|
|
|
|
|
|
|
|
|
|
fn solve(input: &str) -> Result<String, Box<Error>> {
|
|
|
|
|
let re = Regex::new(r"(?P<players>\d+) players; last marble is worth (?P<points>\d+) points").unwrap();
|
|
|
|
|
let re = Regex::new(r"(?P<players>\d+) players; last marble is worth (?P<points>\d+) points")
|
|
|
|
|
.unwrap();
|
|
|
|
|
let caps = re.captures(input).unwrap();
|
|
|
|
|
let player_count = caps.name("players").unwrap().as_str().parse()?;
|
|
|
|
|
let marble_count: usize = caps.name("points").unwrap().as_str().parse()?;
|
|
|
|
@ -17,7 +18,11 @@ fn solve(input: &str) -> Result<String, Box<Error>> {
|
|
|
|
|
|
|
|
|
|
fn play(player_count: usize, marble_count: usize) -> usize {
|
|
|
|
|
let mut scores = vec![0; player_count];
|
|
|
|
|
let mut circle = vec![Marble{value: 0, next: 0, prev: 0}];
|
|
|
|
|
let mut circle = vec![Marble {
|
|
|
|
|
value: 0,
|
|
|
|
|
next: 0,
|
|
|
|
|
prev: 0,
|
|
|
|
|
}];
|
|
|
|
|
|
|
|
|
|
let mut current_player = 0;
|
|
|
|
|
let mut current_index: usize = 0;
|
|
|
|
|