Recent Posts
Advent 2024 Day 04
Time once again to review my Advent of Code solutions! The GitHub repo with all my solutions can be found here. Also featuring the latest die or dice from the Dice Envy Advent Calendar; scroll below the AoC code to see today’s die.
Advent of Code
Today I did not attempt the advent of code problem. It involved solving a word search in which there could be overlapping words as well as, if I read it correctly, multiple words starting from the same place. I’m guessing it’s to be done with a depth-first or breadth-first search in which you kill off searches if you can’t continue. I know these sorts of problems present themselves every year, but I never have time to learn during the AoC period (with work, life, and Christmas in the way) and I never make it a priority to relearn (I was taught this back in undergrad). So rather than waste my time on something I know that I won’t know how to do, I’ll save it for another time - maybe when I’m taking time off closer to Christmas/New Years Day.
Advent 2024 Day 03
Time once again to review my Advent of Code solutions! Also the latest die or dice from the Dice Envy Advent Calendar; scroll below the AoC code to see today’s die.
Advent of Code
As the years have piled on, Eric Wasl has thrown in references to past years’ problems. However, as of day 3 we now have 2 references (perhaps that’s what the historian story line is about). Day 02 had you visit the location of 2015 Day 19 and today visited the location of 2020 Day 2 (my first year doing Advent of Code!) The only thing I’m slightly worried about is if this signals that this year will be a grand finale for the annual event.
Advent 2024 Day 02
Time once again to review my Advent of Code solutions! Also the latest die or dice from the Dice Envy Advent Calendar; scroll below the AoC code to see today’s die.
Advent of Code
Day 01
First off, a look back at yesterday as I was able to find time to attempt a solution in Rust.
use std::fs::File;
use std::io::{self, BufRead};
use std::path::Path;
use counter::Counter;
// The output is wrapped in a Result to allow matching on errors.
// Returns an Iterator to the Reader of the lines of the file.
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())
}
fn main() {
// File hosts.txt must exist in the current path
if let Ok(lines) = read_lines("../../input.txt") {
let mut left_side: Vec<i64> = Vec::new();
let mut right_side: Vec<i64> = Vec::new();
// Consumes the iterator, returns an (Optional) String
for line in lines.flatten() {
let mut line_vals = line.split_whitespace();
left_side.push(line_vals.next().expect("Something went wrong").parse().expect("Something else went wrong?"));
right_side.push(line_vals.next().expect("Something went wrong").parse().expect("Something else went wrong?"));
}
left_side.sort();
right_side.sort();
let mut sum: Vec<i64> = Vec::new();
for n in 0..left_side.len(){
sum.push((right_side[n]-left_side[n]).abs())
}
let num_counts = right_side.iter().collect::<Counter<_>>();
let mut products: Vec<i64> = Vec::new();
for n in 0..left_side.len(){
products.push(left_side[n]*num_counts[&left_side[n]] as i64);
}
println!("The total distance is {}", sum.iter().sum::<i64>());
println!("The similarity is {}", products.iter().sum::<i64>())
}else { println!("no input.txt") }
}
For the input parsing I stole this from the Rust by Example page from the Rust developers. I also put it into my input parsing folder for the future. I find Rust to be like the parts of Haskell that I hate combined with the parts of non-scripting languages that I hate. It’s like the opposite of Go. See for example how I had to do 2 “expects” when populating the left and right side because I can’t guarantee the type. I’m sure it’s part of what makes this such a great language for having less footguns than C or C++, but for something like Advent of Code, it keeps it from being a langauge I’ll probably be doing in real time. As I go back to work tomorrow, I expect to probably almost never do a Rust solution on the day of. Frankly, I’m not sure if I’ll do a Go solution in addition to my Python solution. It’s going to depend upon how things go and how much free time I have on any given night.
Talk Python Bits
Michael Kennedy from the podcasts Python Bytes and Talk Python has recently written a couple blog posts that I wanted to highlight here. First up is his post about rewriting the Talk Python site in Quart (aka async Flask). Three and a half years ago I wrote about realizing that it’s not about Django vs Flask vs FastAPI, but actually about finding the right framework for your workload. I didn’t completely state my current thought process in that blog post, but I was pretty close to the advice I currently give. If you want a Python-based site that needs CMS features and you don’t want to have to reinvent the world, Django is your framework. If you are making websites where you want to be in control of every puzzle piece, then you want flask. You only bring in what you need. And if you’re writing REST API based site (controversy about whether REST truly is REST aside), you want FastAPI. Well, I respect Michael Kennedy’s opinion on this matter for a few reasons:
Advent 2024 Day 01
December has finally arrived and with it my favorite activity of the month - Advent of Code! I also wanted to give myself a fun little present this year, so I bought the Dice Envy Advent Calendar. Every day I’ll get a fun new die (or dice!). Scroll below the AoC code to see today’s die.
Advent of Code
Let’s start off with Advent of Code. This year I haven’t done any of the Advent of Code problems ahead of December so I was a bit rusty. One is not often using the same algorithms or libraries for Advent of Code as one does for everyday programming. I started off with Python since that’s my most comfortable language. First you can head over to today’s page to see the prompt. If you’re not solving the problems yourself, you won’t be able to see the prompt for part 2, so in summary:
Cities: Skylines II Milford County Dec 2024 Tour
I’ve been working on Milford County for quite some time - nearly a year at this point. I was inspired by the way that City Planner Plays designs his “cities” in Cities: Skylines and Cities: Skylines II; he makes regions that eventually become a megalopolis rather than simply designing one city. While I did orignally start out trying to think of things in story terms as he does, I am not quite disciplined enough to do that. However, I do think that building regionally is one way to end up with more natural looking cities rather than just having a gridded city. Milford County is starting to reach the level of development where I will start merging areas, so I wanted to do a small tour of the region as-is. First off, here is the region from above. I couldn’t figure out how to get the camera to zoom out far enough, so this is from the normal game view with the tools cropped out. (In hindsight I think I could have probably played with the camera settings to zoom out)
Final Concert of 2024: Kill Lincoln's No Normal Release Show
As I told someone the day after attending the concert, there’s a reason that humans eventually came upon the format for a church service that we currently have. There is something powerful about a room full of people all singing the same song, in one room, with one purpose. You can get a similar feeling at an arena (whether for sports or a concert), but there’s extra special connection when you’re shoulder to shoulder and jumping around together. (Not to mention the inherent trust in your fellow concert-goers when crowd surfing) This particular November has been a little hard for me. I can’t quite pinpoint the source of the general malaise, but I spent a good chunk of the month in a real funk. I was just starting to recover when I went to the concert and it just super-charged me. I think it really helps that ska, in general, is a positive force in the world. Many ska bands tend to support important causes, including participating in collaborative albums/concerts like Ska Against Racism. As I mentioned in my review of Kill Lincoln’s No Normal, the band grew on me and I enjoyed last year’s concert for their This is New Tone documentary so I definitely wanted to attend their release show.
Twin 2024 Portraits
This year I wanted to take the twins’ portraits outside. I’d been wanting to do it at the park for a few years now, but this year the timing actually worked out well. Unlike in years past, Sam wasn’t as keen on having his photo taken so he went full anime on this one:
Even throwing Stella into the mix didn’t get him peeking:
But I did get lots of great photos of Stella:
Review: Kill Lincoln - No Normal
This year I continued to get new ska music from Bad Time Records, including this album by Kill Lincoln whose frontman is the head of Bad Time Records. Modern ska has gone off in many directions. Some bands, like Calamatrix, have gone back to their reggae roots. Half Past Two, who has an album I’ll be writing about soon, has a third wave ska 1990s sound. Kill Lincoln is squarely in the ska-punk realm. It’s fast, it’s hard, and it’s loud. It took me a while to get into the sound, having discovered ska via the 1990s Christian ska bands The Orange County Supertones and Five Iron Frenzy and the secular band No Doubt. (Interestingly, FIF have gone the rock with horns route while No Doubt has gone a more reggae route)
What is the best D&D Character Sheet? A Comparison
When I first played D&D with David maybe 3 Christmases ago, one of the most baffling things for me to understand was my character sheet. Take a looka t the first page of Sam’s Dungeon in a Box character sheet:
Ignoring how busy this page is, one of the biggest design issues I see right away is that all of the trait boxes are incorrectly prioritized. I have seen people argue for completely eliminating the scores from the sheet because you don’t ever use those scores. Instead, you use the modifiers (the +# or -#). Yet on this sheet those numbers are teeny, tiny compared to the numbers that are functionally useless. (Except during character creation) I would otherwise say there’s not too much that’s bad about this page - it gives you the information you will need most often. The second page has information you might need to refer to so that you don’t need to keep referring to the Player’s Handbook (PHB)