<commit_before>use std::collections::HashSet;

use std::io;
use std::io::prelude::*;


pub fn main() {
    let mut x = 0;
    let mut y = 0;
    let mut rx = 0;
    let mut ry = 0;
    let mut houses = HashSet::new();
    houses.insert((x,y));

    let stdin = io::stdin();
    for line in stdin.lock().lines() {
      let line = line.unwrap();
      for c in line.chars() {
            match c.to_string().as_ref() {
                ">" => x += 1,
                "<" => x -= 1,
                "^" => y += 1,
                "v" => y -= 1,
                _ => panic!()
            }
            houses.insert((x,y));
      }
    }
    println!("Part 1: {}", houses.len());
}<commit_msg>finish parth 2 of day 3<commit_after>use std::io;
use std::io::prelude::*;
use std::collections::HashSet;

struct Santa {
    x: i32,
    y: i32
}

fn step(c: char, s: &mut Santa) {
    match c {
        '>' => s.x += 1,
        '<' => s.x -= 1,
        '^' => s.y += 1,
        'v' => s.y -= 1,
        _ => panic!()
    }
}

pub fn main() {
    let mut p1_santa = Santa {x: 0, y: 0};
    let mut p2_santa = Santa {x: 0, y: 0};
    let mut p2_robo  = Santa {x: 0, y: 0};

    let mut part1_visited = HashSet::new();
    let mut part2_visited = HashSet::new();

    part1_visited.insert((0,0));
    part2_visited.insert((0,0));

    let mut roboturn: bool = false;

    let stdin = io::stdin();
    for line in stdin.lock().lines() {
      let line = line.unwrap();
      for c in line.chars() {
            step(c, &mut p1_santa);
            if roboturn {
                step(c, &mut p2_robo);
            } else {
                step(c, &mut p2_santa);
            }
            roboturn = !roboturn;
            part1_visited.insert((p1_santa.x, p1_santa.y));
            part2_visited.insert((p2_santa.x, p2_santa.y));
            part2_visited.insert((p2_robo.x, p2_robo.y));
      }
    }
    println!("Part 1: {}", part1_visited.len());
    println!("Part 2: {}", part2_visited.len());
}
{'fraction_non_alphanumeric': 0.18076535750251763, 'fraction_numerical': 0.026183282980866064, 'mean_word_length': 1.7635605006954103, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '607288', 'n_tokens_mistral': 775, 'n_tokens_neox': 741, 'n_words': 177}