DeaconBlue's recent activity

  1. Comment on Whatever happened to _____? in ~talk

    DeaconBlue
    Link Parent
    Foundry is so cool! I have it set up for my groups too and there are SO MANY resource packs for random tabletop rulesets.

    Foundry is so cool! I have it set up for my groups too and there are SO MANY resource packs for random tabletop rulesets.

    1 vote
  2. Comment on Day 6: Trash Compactor in ~comp.advent_of_code

    DeaconBlue
    Link
    Late to the party here but I got to it eventually. Part 1 is straightforward. I think my strategy for part 2 was pretty good though. Read the lines in backward, iterate across the operator line...

    Late to the party here but I got to it eventually.

    Part 1 is straightforward. I think my strategy for part 2 was pretty good though. Read the lines in backward, iterate across the operator line until you hit a relevant character. For each iteration, make a number out of each numeric line, do the operation, then flush the temporary number holder.

    Part 1
    use std::{
        env,
        fs::File,
        io::{self, BufRead},
        path::Path,
        time::Instant,
    };
    fn main() {
        let args: Vec<String> = env::args().collect();
        part_one(&args[1]);
        part_two(&args[1]);
    }
    
    fn part_one(file: &str) -> i64 {
        let mut number_lines: Vec<Vec<i64>> = vec![];
        let mut part1_total: i64 = 0;
        let mut function_line = vec![];
        if let Ok(lines) = read_lines(&file) {
            let now = Instant::now();
    
            for line in lines {
                let line = line.unwrap();
                if line.contains('*') {
                    line.split_whitespace()
                        .for_each(|x| function_line.push(String::from(x)));
                } else {
                    number_lines.push(
                        line.split_whitespace()
                            .map(|x| x.parse::<i64>().unwrap())
                            .collect(),
                    )
                }
            }
    
            for (i, operator) in function_line.into_iter().enumerate() {
                let mut nums_to_operate = vec![];
                for vec in &number_lines {
                    nums_to_operate.push(vec[i]);
                }
                part1_total += operate(&nums_to_operate, operator.chars().next().unwrap());
            }
            let elapsed = now.elapsed();
            println!("Part 1: {part1_total}");
            println!("Elapsed: {:.2?}", elapsed);
        }
        return part1_total;
    }
    fn part_two(file: &str) -> i64 {
        let mut number_lines: Vec<Vec<char>> = vec![];
        let mut function_line: Vec<char> = vec![];
        let mut part2_total: i64 = 0;
        if let Ok(lines) = read_lines(&file) {
            let now = Instant::now();
            for line in lines {
                let line = line.unwrap();
                if line.contains('*') {
                    function_line = line.chars().rev().collect();
                } else {
                    number_lines.push(line.chars().rev().collect())
                }
            }
    
            let mut nums: Vec<i64> = vec![];
            for n in 0..function_line.len() {
                let mut chars = vec![];
                for line in &number_lines {
                    if !line[n].is_whitespace() {
                        chars.push(line[n])
                    }
                }
                if chars.len() > 0 {
                    let s: String = chars.into_iter().collect();
                    nums.push(s.parse::<i64>().unwrap());
                }
                if function_line[n] == '*' || function_line[n] == '+' {
                    part2_total += operate(&nums, function_line[n]);
                    nums.clear();
                }
            }
            let elapsed = now.elapsed();
            println!("Part 2: {part2_total}");
            println!("Elapsed: {:.2?}", elapsed);
        }
        return part2_total;
    }
    
    fn operate(nums: &Vec<i64>, operator: char) -> i64 {
        let mut tmp_total: i64 = 0;
        if operator == '*' {
            tmp_total = 1;
            nums.into_iter().for_each(|x| tmp_total = tmp_total * x);
        } else {
            nums.into_iter().for_each(|x| tmp_total = tmp_total + x);
        }
        return tmp_total;
    }
    fn read_lines<P>(filename: P) -> io::Result<io::Lines<io::BufReader<File>>>
    where
        P: AsRef<Path>,
    {
        let file = File::open(filename)?;
        Ok(io::BufReader::new(file).lines())
    }
    
  3. Comment on Day 7: Laboratories in ~comp.advent_of_code

    DeaconBlue
    Link
    Coming back to the days I hadn't completed because of Real Life Obligations. This one seemed alarmingly easy. All of the edge cases were conveniently removed from the input, so no cases of side by...

    Coming back to the days I hadn't completed because of Real Life Obligations.

    This one seemed alarmingly easy. All of the edge cases were conveniently removed from the input, so no cases of side by side splitters or splitters on the grid edge that would make this single pass a problem. I think it would have been interesting if they did some kind of diamond shape with wrap-around requirements. If there were items on the grid edge, I would have just done the classic trick of grid problems where you just bump the grid size by one and ignore it later.

    Parts 1 and 2
    use std::{
        env,
        fs::File,
        io::{self, BufRead},
        path::Path,
        time::Instant,
    };
    fn main() {
        let args: Vec<String> = env::args().collect();
        if let Ok(lines) = read_lines(&args[1]) {
            let now = Instant::now();
            let mut split_count = 0;
            let mut context: Vec<i64> = Vec::new();
            for line in lines {
                for (i, char) in line.expect("").chars().enumerate() {
                    if let Some(state) = context.get_mut(i) {
                        if *state > 0 && char == '^' {
                            context[i - 1] += context[i];
                            context[i + 1] += context[i];
                            context[i] = 0;
                            split_count += 1;
                        }
                    } else {
                        if char == 'S' {
                            context.push(1);
                        } else {
                            context.push(0);
                        }
                    }
                }
            }
            let elapsed = now.elapsed();
            println!("Part 1: {split_count}");
            println!("Part 2: {:?}", context.iter().sum::<i64>());
            println!("Elapsed: {:.2?}", elapsed);
        }
    }
    
    fn read_lines<P>(filename: P) -> io::Result<io::Lines<io::BufReader<File>>>
    where
        P: AsRef<Path>,
    {
        let file = File::open(filename)?;
        Ok(io::BufReader::new(file).lines())
    }
    
  4. Comment on I don't care much for symbolism in ~creative

    DeaconBlue
    (edited )
    Link
    One of the most frustrating parts of my various literature classes in university was the insistence that every single word on the page was symbolic. We would have discussions on why we thought...

    One of the most frustrating parts of my various literature classes in university was the insistence that every single word on the page was symbolic. We would have discussions on why we thought that the author told us that the walls were a color, and what the hidden symbolic meaning might be.

    One time we were looking at the first chapter of The Hobbit and there was an at-length discussion on what the author could have possibly meant by this:

    In a hole in the ground there lived a hobbit. Not a nasty, dirty, wet hole, filled with the ends of
    worms and an oozy smell, nor yet a dry, bare, sandy hole with nothing in it to sit down on or to
    eat: it a was a hobbit-hole, and that means comfort.

    It had a perfectly round door like a porthole, painted green, with a shiny yellow brass knob in
    the exact middle. The door opened on to a tube-shaped hall like a tunnel: a very comfortable
    tunnel without smoke, with panelled walls, and floors tiled and carpeted, provided with polished
    chairs, and lots and lots of pegs for hats and coats- the hobbit was fond of visitors.

    The professor was insistent that there was more to these sentences than telling us that the hobbit was well off, liked visitors, and lived comfortably in an underground home.

    Why would the knob be in the middle of the door? What does that symbolize?

    I dunno, I thought maybe a children's book might do something a little bit silly and whimsical in door design because it is a children's book.

    No, it is symbolizing that the hobbit follows the straight and narrow path and is unlikely to stray.

    Nah. Not buying it. If the goal was to do that symbolically then he wouldn't dedicate the next page and a half to directly explaining how the Bagginses never do anything interesting or out of the ordinary.

    9 votes
  5. Comment on Day 12: Christmas Tree Farm in ~comp.advent_of_code

    DeaconBlue
    Link
    LOL what a silly final puzzle. I went with an equally silly one-liner. Part 1 Console.WriteLine(File.ReadAllLines("redacted").Where(x => x.Contains('x')).Where(x =>...

    LOL what a silly final puzzle. I went with an equally silly one-liner.

    Part 1
    Console.WriteLine(File.ReadAllLines("redacted").Where(x => x.Contains('x')).Where(x => (int.Parse(x.Split(':')[0].Split('x')[0]) * int.Parse(x.Split(':')[0].Split('x')[1])) >= (x.Split(':')[1].Split(' ').Where(y => !string.IsNullOrWhiteSpace(y)).ToList().Select(y => int.Parse(y)).Sum() * 9)).Count());
    
  6. Comment on Day 11: Reactor in ~comp.advent_of_code

    DeaconBlue
    Link
    Seems like there was one standard way to do it. Tricky input for part 2. I was afraid of infinite loops but the input was convenient on that front. C# today because I was doing it with a coworker....

    Seems like there was one standard way to do it. Tricky input for part 2. I was afraid of infinite loops but the input was convenient on that front.

    C# today because I was doing it with a coworker.

    Parts 1 and 2
    using System.Diagnostics;
    
    var sample = "redacted";
    var sample2 = "redacted";
    var real = "redacted";
    var _devices = new List<Device>();
    foreach (var line in File.ReadAllLines(real))
    {
        _devices.Add(new Device(line.Split(":")[0], line.Split(":")[1].Split(" ").Where(x => !String.IsNullOrWhiteSpace(x)).ToList()));
    }
    Stopwatch sw = new Stopwatch();
    sw.Start();
    Console.WriteLine("Part 1: " + Count_Paths("you", "out", new Dictionary<string, long>()));
    sw.Stop();
    Console.WriteLine("Part 1 Elapsed Time: " + sw.Elapsed);
    
    sw.Restart();
    
    var a = Count_Paths("svr", "dac", new Dictionary<string, long>());
    var b = Count_Paths("dac", "fft", new Dictionary<string, long>());
    var c = Count_Paths("fft", "out", new Dictionary<string, long>());
    var d = Count_Paths("svr", "fft", new Dictionary<string, long>());
    var e = Count_Paths("fft", "dac", new Dictionary<string, long>());
    var f = Count_Paths("dac", "out", new Dictionary<string, long>());
    
    var subsetA = a * b * c;
    var subsetB = d * e * f;
    
    Console.WriteLine("Part 2A: " + subsetA);
    Console.WriteLine("Part 2B: " + subsetB);
    Console.WriteLine("Part 2 Total: " + (subsetA + subsetB));
    sw.Stop();
    Console.WriteLine("Part 2 Elapsed Time: " + sw.Elapsed);
    
    long Count_Paths(string startingDevice, string endingDevice, Dictionary<string, long> countCache)
    {
        if (countCache.ContainsKey(startingDevice))
            return countCache[startingDevice];
    
        long pathCount = 0;
    
        foreach (var device in _devices.First(x => x.Name == startingDevice).Outputs)
        {
            if (device == endingDevice)
                return 1;
            pathCount += Count_Paths(device, endingDevice, countCache);
        }
        if (countCache.ContainsKey(startingDevice))
            countCache[startingDevice] = pathCount;
        else
            countCache.Add(startingDevice, pathCount);
        return pathCount;
    }
    
    public class Device(string name, List<string> outputs)
    {
        public string Name = name;
        public List<string> Outputs = outputs;
    }
    
  7. Comment on Day 11: Reactor in ~comp.advent_of_code

    DeaconBlue
    (edited )
    Link Parent
    I am going to hide this to avoid hinting to others, but was this intentional or a happy accident? You are checking `svr -> fft -> dac -> out` but you aren't checking `svr -> dac -> fft -> out` to...

    I am going to hide this to avoid hinting to others, but was this intentional or a happy accident?

    You are checking `svr -> fft -> dac -> out` but you aren't checking `svr -> dac -> fft -> out` to add them together.

    My input (and I assume everyone's) had no paths from dac -> fft so the second set ended up being irrelevant anyway. Your code wouldn't work if there was even 1 path from dac -> fft.

    1 vote
  8. Comment on System76 launches first stable release of COSMIC desktop and Pop!_OS 24.04 LTS in ~tech

    DeaconBlue
    Link Parent
    Checking out some other posts on the blog, apparently Ladybird has similarly unfortunate issues. I am really excited about the Ladybird project but I will need to read more about this.

    Checking out some other posts on the blog, apparently Ladybird has similarly unfortunate issues. I am really excited about the Ladybird project but I will need to read more about this.

    5 votes
  9. Comment on System76 launches first stable release of COSMIC desktop and Pop!_OS 24.04 LTS in ~tech

    DeaconBlue
    (edited )
    Link Parent
    Same, I tried it for a bit. Eventually I decided that if I was going to fight jank, I may as well learn to fight it closer to core.

    Same, I tried it for a bit. Eventually I decided that if I was going to fight jank, I may as well learn to fight it closer to core.

    1 vote
  10. Comment on System76 launches first stable release of COSMIC desktop and Pop!_OS 24.04 LTS in ~tech

    DeaconBlue
    Link Parent
    Huh. Now I know. I swear, it is impossible to use any kind of project where someone in the pipeline isn't a dickhead.

    Huh. Now I know.

    I swear, it is impossible to use any kind of project where someone in the pipeline isn't a dickhead.

    6 votes
  11. Comment on System76 launches first stable release of COSMIC desktop and Pop!_OS 24.04 LTS in ~tech

    DeaconBlue
    (edited )
    Link Parent
    Because of the tiling nature? If so, you could check out Niri which does a horizontal scroll thing. I tried it on my laptop and wasn't a big fan of the scrolling nature but it did work very well!

    and not Hyprland

    Because of the tiling nature?

    If so, you could check out Niri which does a horizontal scroll thing. I tried it on my laptop and wasn't a big fan of the scrolling nature but it did work very well!

    2 votes
  12. Comment on Whatever happened to _____? in ~talk

    DeaconBlue
    Link Parent
    They made a movie called El Camino that showed Jesse after the show. It was pretty good I thought. I haven't seen the spinoff show about the lawyer.

    Breaking Bad after series original ending?

    They made a movie called El Camino that showed Jesse after the show. It was pretty good I thought.

    I haven't seen the spinoff show about the lawyer.

    5 votes
  13. Comment on Whatever happened to _____? in ~talk

    DeaconBlue
    Link
    What happened to Steel Sticks for N64 controllers? https://steelsticks64.com/ The guy that was making them has had "all gone but making more" for the joystick components for years. I haven't seen...

    What happened to Steel Sticks for N64 controllers?

    https://steelsticks64.com/

    The guy that was making them has had "all gone but making more" for the joystick components for years. I haven't seen any updates anywhere.

    6 votes
  14. Comment on Whatever happened to _____? in ~talk

    DeaconBlue
    Link Parent
    Despite the backtracking, they showed their hand. I know of several tables (mine included, after my current campaign ends) that will not be purchasing any new DnD materials and have taken the...

    Despite the backtracking, they showed their hand. I know of several tables (mine included, after my current campaign ends) that will not be purchasing any new DnD materials and have taken the opportunity to check out other game systems.

    31 votes
  15. Comment on Without looking, do you have a vague idea of your coordinates? in ~talk

    DeaconBlue
    Link Parent
    You don't think any Tildes users are sapient birds that might have a spot on the bouey?

    You don't think any Tildes users are sapient birds that might have a spot on the bouey?

    5 votes
  16. Comment on Without looking, do you have a vague idea of your coordinates? in ~talk

  17. Comment on Without looking, do you have a vague idea of your coordinates? in ~talk

    DeaconBlue
    Link Parent
    I want to say it's not terribly far off the west coast of Africa (on the Equator) but my map skills aren't strong enough to use that to guess anywhere else in the world.

    I want to say it's not terribly far off the west coast of Africa (on the Equator) but my map skills aren't strong enough to use that to guess anywhere else in the world.

    2 votes
  18. Comment on Without looking, do you have a vague idea of your coordinates? in ~talk

    DeaconBlue
    Link Parent
    Oh that's way too detailed for me. I just figure anything +- 2 degrees (either way) of my city is something I could get to in an afternoon. Whole numbers only for my knowledge.

    I wouldn't know well enough to navigate in my city or anything.

    Oh that's way too detailed for me. I just figure anything +- 2 degrees (either way) of my city is something I could get to in an afternoon. Whole numbers only for my knowledge.

    4 votes
  19. Without looking, do you have a vague idea of your coordinates?

    I was recently talking to a group of people about a random plot point in a video game, wherein a character reveals some coordinates written down on a sheet of paper and says something to the...

    I was recently talking to a group of people about a random plot point in a video game, wherein a character reveals some coordinates written down on a sheet of paper and says something to the effect of "I think that's nearby, I will check it out." Nearly everyone in the group was thrown back by that, saying that there is no way that the character would know their coordinates off hand.

    Later on, through entirely unrelated circumstances (some SciFi show where a human told aliens to drop him at specific coordinates), coordinates came up in a discussion with my family. Half of the family knew, half the family didn't know, and both halves were surprised by the other half.

    I would be able to tell you if some random coordinate were within a reasonable drive of my city or not. I am curious about the ratio of people on Tildes that would know.

    (I have absolutely no idea how to tag this)

    58 votes
  20. Comment on Winter boot recommendations for women in ~life.style

    DeaconBlue
    Link Parent
    Backing Sorel. I have had a pair for a decade that I wear snowmobiling everywhere from the rockies to northern Canada. They keep my feet warm and dry, and I can throw the inner layer and outer...

    Backing Sorel. I have had a pair for a decade that I wear snowmobiling everywhere from the rockies to northern Canada.

    They keep my feet warm and dry, and I can throw the inner layer and outer layers beside a furnace or fire to dry them both separately quite quickly.

    This is anecdotal for Men's boots, but the brand itself seems good.

    8 votes