221 results for "":
Day 2 (Advent of Code 2022)
Part 1
In the day 2 challenge, we’re playing Rock Papers Scissors.
We’re given a strategy guide like so:
A Y
B X
C Z
Left column is “their move”: A means Rock, B means Paper, C means Scissors. Right column is “our move”: X means Rock, Y means Paper, Z means Scissors.
Each line corresponds to a turn, and we must calculate the total score we get. Picking “Rock” gives 1 point, “Paper” gives 2 points, and “Scissors” gives 3. Losing the round gives 0 points, drawing gives 3, winning it gives 6.
Async fn in trait... not
Async fn in trait… not
I was planning on showing the in-progress async_fn_in_trait feature in the
context of my website, but it turns out, I can’t!
My website uses two databases: one local SQLite database for content, and a shared Postgres database for user credentials, preferences etc. Migrations are run on startup, and each migration implements one of the following traits:
The promise of Rust
The part that makes Rust scary is the part that makes it unique.
And it’s also what I miss in other programming languages — let me explain!
Rust syntax starts simple.
This function prints a number:
fn show ( n : i64 ) {
println! ( "n = {n}" );
}
And this program calls that function — it looks like any C-family language so far, we got parentheses, we got curly brackets, we got, uhh…
Ludum Dare #25 Post-mortem
Last week-end, I participated to Ludum Dare for the fourth time in a row!
Downloads: Linux (64) | OS/X | Windows
Story
So here is our entry: Legithief. The backstory is simple, yet cunning: you are an ordinary thief practicing ordinary acts of thievery in the houses of ordinary people to make a living. But one day.. you are quietly robbing yet another home, when you are suddenly smashed in the head with a bat.
Day 10 (Advent of Code 2022)
Onwards! To the day 10 puzzle.
I don’t see a way to make part 1 especially fun — so let’s just get to it.
Parsing
As usual, let’s reach for the nom crate…
$ cargo add nom@7
(cut)
…to parse the input into nicely-organized Rust data structures:
// in `src/main.rs`
use nom::{
branch:: alt,
bytes:: complete:: tag,
combinator::{ map value
sequencepreceded
->
noop =
addx = nomcharactercompletei32
noop addx i
->
=>
_ =>
Day 4 (Advent of Code 2020)
It’s time for Day 4 of the Advent of Code 2020!
Now, I’ve already had a look at the problem statement, at least for part 1, and I’m not particularly excited.
But it will allow me to underline some of the points I’ve recently been *trying to make about types and correctness.
Ah, yes, the novel.
The problem is to parse passports, with fields like these:
Lestac: The Making Of
Update: Lestac is now available in Early Access on itch.io! Read more on the official page
So, Lestac is out! Ain’t that something? For those who don’t know, it’s Sylvain and I’s entry for Ludum Dare 28, a video game jam that happens every four months.
Here’s how it looks:
You can play it now if you haven’t yet - it’s available for Linux, OS/X, and Windows. And then you can come back and read this postmortem if you will!
Deploying at the edge
Disclaimer:
Although I no longer work for the company my website is hosted on, and this article is written in way that mentions neither my previous or current hosting provider: at the time of this writing, I don’t pay for hosting.
One thing I didn’t really announce (because I wanted to make sure it worked before I did), is that I’ve migrated my website over completely from a CDN (Content Delivery Network) to an ADN (Application Delivery Network), and that required some architectural changes.
Day 6 (Advent of Code 2022)
Today I am joining you from the relative discomfort of my living room (since my better half has commandeered the home office due to Way Too Many Calls) to tackle the day 6 challenge, which I’m excited about: maybe despite, maybe because of, the low-grade fever I’m under.
Part 1
Our input is a jumble of letters, and we’re supposed to find the position of the first substring that’s “four different characters”.
Day 8 (Advent of Code 2022)
In the day 8 problem, our input is a height map:
30373
25512
65332
33549
35390
This is a 5x5 grid, and every number denotes the height of a tree. For part 1, we must find out how many trees are visible from the outside of the grid.
If we consider the first row, from the left: only the 3 is visible: it
obscures the 0. From the right, 3 and 7 are visible.