diff --git a/shared/examples/day_three_build_car.rs b/shared/examples/day_three_build_car.rs index a96d80e..5321807 100644 --- a/shared/examples/day_three_build_car.rs +++ b/shared/examples/day_three_build_car.rs @@ -6,7 +6,6 @@ async fn main() { &("codes.advent.supersecret.verification".parse().unwrap()), &("1337".parse().unwrap()), "ABCDE-FGHIJ", - "what did the muffin say to the other muffin?", ) .await .expect("failed to build car"); diff --git a/shared/src/advent/challenges/day_three/day_three.rs b/shared/src/advent/challenges/day_three/day_three.rs index 3cf2ee7..54f44a2 100644 --- a/shared/src/advent/challenges/day_three/day_three.rs +++ b/shared/src/advent/challenges/day_three/day_three.rs @@ -49,7 +49,6 @@ impl AdventChallenge for DayThree { &("codes.advent.supersecret.verification".parse().unwrap()), &("1337".parse().unwrap()), &code, - "hellooooooo", ) .await .map_err(|e| AdventError::ShouldNotHappen(format!("failed to render car: {e}")))?; diff --git a/shared/src/advent/challenges/day_three/repo.rs b/shared/src/advent/challenges/day_three/repo.rs index c08c57f..98b63c5 100644 --- a/shared/src/advent/challenges/day_three/repo.rs +++ b/shared/src/advent/challenges/day_three/repo.rs @@ -3,10 +3,30 @@ use std::io::Cursor; use atrium_api::types::string::{Nsid, RecordKey}; use atrium_crypto::keypair::P256Keypair; use atrium_repo::{Repository, blockstore::{CarStore, MemoryBlockStore}}; +use rand::seq::IndexedRandom; use serde::Serialize; const CHALLENGE_DID: &str = "did:plc:3oktyyf7u4ecnvdwf3ogehpd"; +const VERY_BAD_JOKE_SETUPS: &[&str] = &[ + "what do you call a cow with two legs?", + "what do bees do if they need a ride?", + "what do you call a monkey that loves doritos?", + "why did the can crusher quit her job?", + "when’s the best time to go to the dentist?", + "why do seagulls fly over the sea?", + "what do you call a farm that makes bad jokes?", + "why do fish live in saltwater?", + "what kind of streets do ghosts haunt?", + "what do you call it when one cow spies on another?", + "what happens when a frog’s car breaks down?", + "what does a zombie vegetarian eat?", + "what do you call it when a snowman throws a tantrum?", + "why did the scarecrow win an award?", + "what did the buffalo say when his son left?", + "wait, you don’t want to hear a joke about potassium?", +]; + #[derive(Debug, thiserror::Error)] pub enum CarBuildError { #[error("Signing error: {0}")] @@ -33,7 +53,6 @@ pub async fn manufacture_car( collection: &Nsid, rkey: &RecordKey, verification_code: &str, - message: &str, ) -> Result, CarBuildError> { let did = CHALLENGE_DID.parse().unwrap(); @@ -47,10 +66,11 @@ pub async fn manufacture_car( // add record let key = format!("{}/{}", collection.as_str(), rkey.as_str()); let created_at = &chrono::Utc::now().to_rfc3339(); + let joke = VERY_BAD_JOKE_SETUPS.choose(&mut rand::rng()).unwrap_or(&"no joke"); let record = ChallengeRecord { created_at, verification_code, - message, + message: joke, }; let (cb, _cid) = repo.add_raw(&key, record).await?; let sig = keypair.sign(&cb.bytes())?; @@ -75,7 +95,6 @@ mod tests { &("codes.advent.supersecret.verification".parse().unwrap()), &("1337".parse().unwrap()), "ABCDE-FGHIJ", - "what did the muffin say to the other muffin?", ) .await .expect("build a car");