diff --git a/2023/day17_clumsy_crucible/Cargo.toml b/2023/day17_clumsy_crucible/Cargo.toml new file mode 100644 index 0000000..00f9b76 --- /dev/null +++ b/2023/day17_clumsy_crucible/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "day17_clumsy_crucible" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] + +[dev-dependencies] +criterion = "0.5.1" + +[[bench]] +name = "test_benchmark" +harness = false diff --git a/2023/day17_clumsy_crucible/challenge.txt b/2023/day17_clumsy_crucible/challenge.txt new file mode 100644 index 0000000..2418f7b --- /dev/null +++ b/2023/day17_clumsy_crucible/challenge.txt @@ -0,0 +1,123 @@ +The lava starts flowing rapidly once the Lava Production Facility is operational. As you leave, the reindeer offers you a parachute, allowing you to quickly reach Gear Island. + +As you descend, your bird's-eye view of Gear Island reveals why you had trouble finding anyone on your way up: half of Gear Island is empty, but the half below you is a giant factory city! + +You land near the gradually-filling pool of lava at the base of your new *lavafall*. Lavaducts will eventually carry the lava throughout the city, but to make use of it immediately, Elves are loading it into large [crucibles](https://en.wikipedia.org/wiki/Crucible) on wheels. + +The crucibles are top-heavy and pushed by hand. Unfortunately, the crucibles become very difficult to steer at high speeds, and so it can be hard to go in a straight line for very long. + +To get Desert Island the machine parts it needs as soon as possible, you'll need to find the best way to get the crucible *from the lava pool to the machine parts factory*. To do this, you need to minimize *heat loss* while choosing a route that doesn't require the crucible to go in a *straight line* for too long. + +Fortunately, the Elves here have a map (your puzzle input) that uses traffic patterns, ambient temperature, and hundreds of other parameters to calculate exactly how much heat loss can be expected for a crucible entering any particular city block. + +For example: + +``` +2413432311323 +3215453535623 +3255245654254 +3446585845452 +4546657867536 +1438598798454 +4457876987766 +3637877979653 +4654967986887 +4564679986453 +1224686865563 +2546548887735 +4322674655533 + +``` + +Each city block is marked by a single digit that represents the *amount of heat loss if the crucible enters that block*. The starting point, the lava pool, is the top-left city block; the destination, the machine parts factory, is the bottom-right city block. (Because you already start in the top-left block, you don't incur that block's heat loss unless you leave that block and then return to it.) + +Because it is difficult to keep the top-heavy crucible going in a straight line for very long, it can move *at most three blocks* in a single direction before it must turn 90 degrees left or right. The crucible also can't reverse direction; after entering each city block, it may only turn left, continue straight, or turn right. + +One way to *minimize heat loss* is this path: + +``` +2>>34^>>>1323 +32v>>>35v5623 +32552456v>>54 +3446585845v52 +4546657867v>6 +14385987984v4 +44578769877v6 +36378779796v> +465496798688v +456467998645v +12246868655 + +``` + +This path never moves more than three consecutive blocks in the same direction and incurs a heat loss of only `*102*`. + +Directing the crucible from the lava pool to the machine parts factory, but not moving more than three consecutive blocks in the same direction, *what is the least heat loss it can incur?* + +Your puzzle answer was `855`. + +\--- Part Two --- +---------- + +The crucibles of lava simply aren't large enough to provide an adequate supply of lava to the machine parts factory. Instead, the Elves are going to upgrade to *ultra crucibles*. + +Ultra crucibles are even more difficult to steer than normal crucibles. Not only do they have trouble going in a straight line, but they also have trouble turning! + +Once an ultra crucible starts moving in a direction, it needs to move *a minimum of four blocks* in that direction before it can turn (or even before it can stop at the end). However, it will eventually start to get wobbly: an ultra crucible can move a maximum of *ten consecutive blocks* without turning. + +In the above example, an ultra crucible could follow this path to minimize heat loss: + +``` +2>>>>>>>>1323 +32154535v5623 +32552456v4254 +34465858v5452 +45466578v>>>> +143859879845v +445787698776v +363787797965v +465496798688v +456467998645v +122468686556v +254654888773v +432267465553v + +``` + +In the above example, an ultra crucible would incur the minimum possible heat loss of `*94*`. + +Here's another example: + +``` +111111111111 +999999999991 +999999999991 +999999999991 +999999999991 + +``` + +Sadly, an ultra crucible would need to take an unfortunate path like this one: + +``` +1>>>>>>>1111 +9999999v9991 +9999999v9991 +9999999v9991 +9999999v>>>> + +``` + +This route causes the ultra crucible to incur the minimum possible heat loss of `*71*`. + +Directing the *ultra crucible* from the lava pool to the machine parts factory, *what is the least heat loss it can incur?* + +Your puzzle answer was `980`. + +Both parts of this puzzle are complete! They provide two gold stars: \*\* + +At this point, you should [return to your Advent calendar](/2023) and try another puzzle. + +If you still want to see it, you can [get your puzzle input](17/input). \ No newline at end of file diff --git a/2023/day17_clumsy_crucible/src/lib.rs b/2023/day17_clumsy_crucible/src/lib.rs new file mode 100644 index 0000000..a8a0320 --- /dev/null +++ b/2023/day17_clumsy_crucible/src/lib.rs @@ -0,0 +1,170 @@ +use core::fmt::Display; +use std::collections::{HashMap, BinaryHeap}; + +#[derive(Debug, PartialEq, Eq)] +pub enum MapError { + NoPath, + ParseIntError(char), +} + +impl Display for MapError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::NoPath => write!(f, "Unable to find any path from start to destination"), + Self::ParseIntError(e) => write!(f, "Unable to parse into integer: {e}"), + } + } +} + +#[derive(PartialEq, Eq)] +enum CrucibleType { Normal, Ultra, } + +impl CrucibleType { + fn min(&self) -> u8 { + match self { + Self::Normal => 1, + Self::Ultra => 4, + } + } + + fn max(&self) -> u8 { + match self { + Self::Normal => 3, + Self::Ultra => 10, + } + } +} + +#[derive(Clone, Copy, PartialEq, Eq, Hash)] +enum Direction { + North, + West, + East, + South, +} + +impl Direction { + fn coming_from(&self, (x, y): (usize, usize)) -> (usize, usize) { + match self { + Self::North => (x, y-1), + Self::West => (x-1, y), + Self::East => (x+1, y), + Self::South => (x, y+1), + } + } + + fn perpendicular(&self) -> [Self; 2] { + match self { + Self::North | Self::South => [Self::West, Self::East], + Self::West | Self::East => [Self::North, Self::South], + } + } + + fn positions_with(&self, (x, y): (usize, usize), dist: u8, crucible_type: &CrucibleType) -> Vec<((usize, usize), Self, u8)> { + let (min, max) = (crucible_type.min(), crucible_type.max()); + match (self, dist, x, y) { + (Self::North, s, _, 0) if s < min => Vec::new(), + (Self::West, s, 0, _) if s < min => Vec::new(), + (d, s, x, y) if s < min => vec![(d.coming_from((x, y)), *d, s+1)], + (d, m, x, y) if m == max => d.perpendicular() + .iter() + .filter(|dir| (x > 0 || dir != &&Self::West) && (y > 0 || dir != &&Self::North)) + .map(|dir| (dir.coming_from((x, y)), *dir, 1)) + .collect(), + (d, n, x, y) => d.perpendicular() + .iter() + .map(|dir| (dir, 1)) + .chain(std::iter::once((d, n+1))) + .filter(|(dir, _dist)| (x > 0 || dir != &&Self::West) && (y > 0 || dir != &&Self::North)) + .map(|(dir, dist)| (dir.coming_from((x, y)), *dir, dist)) + .collect(), + + } + } +} + +#[derive(PartialEq, Eq)] +struct State { + estimated_costs: usize, + pos: (usize, usize), + dir: Direction, + dist: u8, +} + +impl PartialOrd for State { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + +impl Ord for State { + fn cmp(&self, other: &Self) -> std::cmp::Ordering { + other.estimated_costs.cmp(&self.estimated_costs) + } +} + +pub fn run(input: &str) -> Result<(usize, usize), MapError> { + let map = input.lines().map(|line| line.chars().map(|c| c.to_digit(10).ok_or(MapError::ParseIntError(c)).map(|n|n as u8)).collect::, _>>()).collect::, _>>()?; + let first = cheapest_path(&map, &CrucibleType::Normal)?; + let second = cheapest_path(&map, &CrucibleType::Ultra)?; + Ok((first, second)) +} + +fn cheapest_path(map: &[Vec], crucible_type: &CrucibleType) -> Result { + let dest = (map.last().unwrap().len()-1, map.len()-1); + let mut costs = HashMap::from([(((0, 0), Direction::East, 0), 0), (((0, 0), Direction::South, 0), 0)]); + let mut open_set = BinaryHeap::from([ + State{ estimated_costs: dest.0 + dest.1, pos: (0, 0), dir: Direction::East, dist: 0, }, + State{ estimated_costs: dest.0 + dest.1, pos: (0, 0), dir: Direction::South, dist: 0, }, + ]); + + while let Some(state) = open_set.pop() { + let (pos, dir, dist) = (state.pos, state.dir, state.dist); + let old_costs = *costs.get(&(pos, dir, dist)).unwrap(); + if pos == dest { + if dist >= crucible_type.min() { + return Ok(old_costs); + } else { + continue; + } + } + for (new_pos, new_dir, new_dist) in dir.positions_with(pos, dist, crucible_type) { + if new_pos.1 <= dest.1 && new_pos.0 < map[new_pos.1].len() { + let new_costs = old_costs + map[new_pos.1][new_pos.0] as usize; + let new_est = new_costs + dest.0.abs_diff(new_pos.0) + dest.1.abs_diff(new_pos.1); + let best_so_far = if new_dist > crucible_type.min() { + (crucible_type.min()..=new_dist).map(|i| *costs.get(&(new_pos, new_dir, i)).unwrap_or(&usize::MAX)).min().unwrap() + } else { + *costs.get(&(new_pos, new_dir, new_dist)).unwrap_or(&usize::MAX) + }; + if new_est < best_so_far { + costs.insert((new_pos, new_dir, new_dist), new_costs); + open_set.push(State{ estimated_costs: new_est, pos: new_pos, dir: new_dir, dist: new_dist, }); + } + } + } + } + Err(MapError::NoPath) +} + +#[cfg(test)] +mod tests { + use super::*; + use std::fs::read_to_string; + + fn read_file(name: &str) -> String { + read_to_string(name).expect(&format!("Unable to read file: {name}")[..]).trim().to_string() + } + + #[test] + fn test_sample() { + let sample_input = read_file("tests/sample_input"); + assert_eq!(run(&sample_input), Ok((102, 94))); + } + + #[test] + fn test_challenge() { + let challenge_input = read_file("tests/challenge_input"); + assert_eq!(run(&challenge_input), Ok((855, 980))); + } +} diff --git a/2023/day17_clumsy_crucible/tests/challenge_input b/2023/day17_clumsy_crucible/tests/challenge_input new file mode 100644 index 0000000..c3884e8 --- /dev/null +++ b/2023/day17_clumsy_crucible/tests/challenge_input @@ -0,0 +1,141 @@ +123312311331422231344241131124441413421444543222351355523342553432442632536125414535541252125221355213432344535323323442421144313213332323121 +311333112214222331122441332323551424121152121141511254545244334424353453555423222664242143344432154523435543213212434134122133414334323221131 +122332341233412444144141133332314244222321524425222433636462235562466236223445346533624463145335515535234141113254121221422121123133332323333 +123112234123222422212322335125454355431334514142514432445542354235365422653546366452333222222235253532134455524453535413311313133242324434121 +131232441242332421134125221134152221523514241315364533426444432524625262565663254462246424235453313123513322215111514245242141112434241124131 +331221111122324431112213232445321223534433441364322546535342545645425465366666436652265454242326423452413232255143344412224222443412144444443 +213224244421132223415521155542454521454245562524645343354565355456364223262354663354366424232365256321255531415314211141421421242334413432211 +331142334134312144413332451141255252123556423463463263362626334254334436546263334662555325466325326526521523343134354434335444333232433134413 +232211212211422312242515245552315323345553425536646442356666452336636553535422323355353222462222335364661231221355132113543424342323321412443 +334324124223313211421445212352314521433226454445622554222253423325522622464632633656325465424342452244236233132115131312435323123141234444434 +313214121342312145112442254224432435454435633462243444254663266535253462333354524446232234325336265455452423334233242355255411411441144233431 +423341312321135424533145133313255332464523422646425325453466642463433624233244655226434553533344432555662523325325214452221541233331121214112 +224411131231343133434255321434415224255453462552625333363533326626575635745366332266564652646353354235525622645541325252541221444211341112242 +443444241443243151154221221511653655565425232665364324634655737737663647446745674634466234543354625343323422665253212531421514521234323224134 +242221224225125311135513531144454666553555624433452345666354537757346367464365447467565335533666233444236345356433153425252455131525144323423 +232124242214553223342255223155663253445343522666526537444436374765735645557754744563657365434622632664522445255423553324343522233155233231233 +312312344153431144354511236245235254634636335463367355333744745767767445643334345363775653634563223242246655526642453325241344322244344332342 +212424412121411441432231163456643522235244564435745573643444534577564676344556557646756344465375662653433666442444632253442212243341422231123 +112131431232444555131353555353562535435523265454666663654376666334743743634367677763734476456344356522656236466562634425433441234424141434242 +242224231514315235311334243456235366525623367565344345446675737535357576667755747667645735333774634456222626362466666262253132225444223142421 +424113441154452351122523533662255462656433435753647553346466636576476573755745554564676635664444443445566463564524232555222122315311142454413 +131425321245244553543224265545422645344647335373544333563756746446377344366637733464665465574563774575345236645565252532424111152342242542233 +343311315325451353412632462622265636453745746534467337667763664355367457345743773564546365637545373767534442224543535625442442143322224555221 +424455332553121254155643324333343245636633463677563665656756556566465533637644535353755564535333373743556555236533556362363545125241451452441 +241445522243321351424444624446563555366437653443636456476656575348884457748658653465363473677476737747345575566434242255422542143121332242122 +242341531344152112465665333454336236475344676763565367763744755556766748455676764744477653477677776665434375736365352452462535254315515115331 +315321251135224463555522664664434444345455777535446653366878686874654855878766487886645337576346343545776655676556462535334622524552315322515 +421523521135155153226636436223636343476654565464446743855687778466656658756565444876566884663367444566755446735226532254255453643355125553233 +431151232114115654233452235454566733434356555665553375548785554677755555785457446547868545546735767453366574337466226543432233633224323454523 +422414542322123262254522454655444544453745567337544748568646586664686744747577674686768466487535354554446565743654466536425266552345512521315 +411513531431235625242656224327367573655454453734857688545864856788785544646756674786685444456564757547454357554477443352365653426215225424335 +444531543311265253624342662264356675577455566465584655747557547847577754865688548444458487646485865653364744365564545436656545533221321122453 +115132153532244636466662336743534453647377573658478864644684554755767687664548466554754785465455555774646545737364566536222224534332513121254 +542555145113356556466522443454757653565445357747675476875865775657784887447485788584758457546476767566574745533574475662544436535324154223153 +135314233552453524345342474763653436736564867668857648788744857766654757474788588846674747846588656757674775456757775326665463253345312324542 +522215145453645244233234575737367676343734754674865465478767588746577555558847778655676755455485745767443463474565533434452665225562223432135 +343331522152332222432465734436646365644745856577877847748684787588659578989989644778754846566478687675774665776673673534652253334255523545132 +252245521636365543224546376454755756364684788566545887864865656867858956687967767787685857464485486857767765374363374364626266453222222513455 +251234423666456365344444353753364744474575477688875865688878896877968567575685797877856746874554584577577746565535575736623546563622554522511 +554341324224563425335243566637563353358477878748787877659658995696887879697767965588868484486445678555774435466445777763753345364533435443154 +215143112652524546533657774675556745545445458546464754758669977898699969767676568796766688555584858746486687665354754647753552466432626325321 +552244563246465423427334575756536746678866688467778696999775885685878876958758675979556578988488568844477546355674353557755336445643224252322 +544414353526554343566656357775363745574864758566578855878669569767967659555557996895568976687858677758477867476647576774753252635355226334122 +222453423356324546643344364667655464668455547457547976697989959958686659566699666888798889656475764646674684777566646635674742444336323323253 +121415323252245544435567775764646688764564454548776857669655755785888577569877955985595959787558867756877776483636553665766322544454652533333 +431342643423356246333466333344536888665646765447867776777767687679898665597586569867966955568977868757544888485654577664356765636353456335534 +413222236552262555646764663557485887845767867579979557589667967868758798999797856996885655897799646777686787566747656343777446564223635626111 +133516543626636523735375774553565464857875766688956687989789758898876867678598777757857956665568574765486484746754355353463553226244323565151 +353432654224653335346575635566484857758457858575956575558656968658987766779666998668588675757758658566484785677845473355457463662342355643242 +525523453655432337674367745766874774746786658697575886877996976797799887767987875676778759568656559766778586744487463457465767724565236343321 +211432366456623547754766667778564786447678699767779858695578979896968777886996867876598577765669585688454484475546335443553767625243232435623 +454242544352263247637365577476867458488464878596988876787688799897867999666866698979997997568975655776456755464765655375737646343322362466364 +415255334425633346647635373376864788748465887688898968555798866977786877689698899678798558795658898577685458686575847674564343374553522654523 +311226333563664464757336344477855854785467695689857698788986979899687797966788997967668776895659796565565747564756663334654755355445533452461 +444542563252253754534735747678466664768879769889585557887897679969789788997978869686679689675977787569854865566575463435336675344563552242263 +246443344322363637445377756656657868858777898888955989897969868889778968969998697979779869996685858899858654646786566664346557547252452234254 +253266233244427544656455655765874644764788785965688569976798988898887878887897976996969779798969777588684585485848656556673747547462462262524 +533425332255253567567643446447485845775657986765899567698998789676769776778769898778968899956569765597996778684786766663446753365346664326653 +215664424423223635376477658687857764788888568958978779799877896886677996686868798689868767799657596665997854787556575734437565564444253423543 +554232633224554465366563765464858775887677899895675879986668896776669787786977999688798669787865795858577578445678667633775634546745555652365 +444443454646447444574773747468864546589866569786985768666697789686777799998998868988676797885665585778555445584575677756656455666335234653363 +463626465555545443556343576647476876577766796577968898988688868697777787788977888966777899969885767759876587788756678557657634377335464554343 +224526656426556636446653346876766874668978558798959989799766686679798788799888898869966676786596556789956576674787554457536377545323266654563 +553365634263475677633763355754865585787588575589969967767997876998889887898978999689887688979877987866668577847448865433633747745465252336425 +426345646544436634546374378854867867787978868788686888669698777778777897777797897866969999788768766558597945544855757545644336756522662256532 +536334632546556547546637665448555658858996565777768896869787798779888799879997779869667677877995565895567696467776847483577445674555354462356 +532662452342336467563676757578566648955556689595696898679667777897787889798979888767897967797799989976889865466757544666367655475656542524233 +246335434242676634735444848864876647655656967777996696889798789988988777989987887776676686967686778975689995858875874584777643467365453232462 +353443466525533565533436748587675877858978776958787876976877889978898798989988897896796868889896998955985578875785464463373755375756264222656 +664243533324667473536753757665646868758559976568667879768976898977778879887797879797896996996896778686776566474857765863375653546472262554244 +545246622522344556354575757776575485568969566567769667986988978787778787997979788997676769987678799966999794768757774765474364333342645435435 +453435246344347653745363857656574545888896697685698776978788989987898789887788879976976998786898868856679554777866686575747655337735235426346 +525254334636545567335536748777844467697665585967677787866778798989988899897978889987776769878987965968976754546467674785554537443332534226552 +634625444545653765367573445546885586785899876586779866798879797898777789987777897999667899999765659779876785655744768775344374346754546536434 +465453442625335347365675658858858856878896996898887787877698999988797897977978879897989696799967696776567857566564867667655776656566346236234 +532424445525645344346444848658567845555586658659986796888688889779799998777877897876897678678885576558875857855888667884635766646353636452355 +342224526626535647633554587878455756657695596985868896676877887879999797777778898877788967989988689756987975748845664844454463637573234425433 +232544553623363357365557645766866745898656789788997677869767888999979899879898787798796888669787998889555555888886664744534555454634435434466 +336554234253356376373534666776858846465996885895868888987678669799888978789889979789879696786665578986598676457688548846647666754563454622423 +262325255234255553533657768456886488556957869976997868669698996979897778999887979978778679898886696789597857446878887634645457774453623656533 +254445263464645755653635357448855568898676955575978969796768869879988979787799778687998789988895975967556558447467878864735333463354455235452 +565246245622437555655554385765578667779755577658568899987998887769797879988878679689786869896669596679879785867565485437637777476322632345425 +433522352453645543665535777684774844458979658799998769778776778869697888888866886678677799866565866867558858776676864843576654376732363235433 +135523256223567776567734645478787857669685775955779667979789787687867766976676678667697968797989689687668788568774557575657675636724355534564 +215355646233267446644553478475684466876895679898586998667968786686868998796997686888688778887867897778986775578544767343757557373564262522444 +155456546555425645374737667676877757858575886567585699787667988777697996677967997889678669788759796998767887645776744556655334766425334462425 +342443644656337447454435476654547745774759558858769688698966666779998968668867887797886787889886867779986486658788767473437363775243332266243 +434532553566255664653666555687855755787876799887779856699989987786797796987697686867997688599866785799754767687454456667673467757243334265434 +425666424535442476764463634467687785744889675659999667777788999666687799768688879769988958777557858768678485466645744763567773373525444654245 +123322425463644755343446677478477475688886885559667885596767888887668788999789768988998769959976875589467847876647435674655646354362264323521 +352653546343224663737644377548486756854669699858965775989679686966978669886877899986988685657789698869784584858748553533453545343454634344241 +414644533566265476567433564657758856545454586796755855897958686786788699767669678687996967957956985666668874768884434656347733452464454666331 +433445242345455545733743437554784555857855667878776875687965986776999876798777768886859955568895587864555656757587365443676766735644326562255 +514253642425344673765676443745876446665476759889656999858788588999878996886776776578875997775695576487444657687475756777746467762643246624343 +133424454344244423366343555363787657867467467755989786758598959586778889886968859987958695888898695757574688745843646554346373626545225656424 +225322536226535363547355356774455547845587487575976679787888955556666788568697698686995877996659654854677558784535637556646433322444423636233 +115212434352245246533554635333777857658568644576596958886967555678975779779585759695896567576856868884587564777534675436574564443425242344212 +415415626645636252763377565547458857648448864776866598989865687565586979768586598698895667587788877758484665665775733434637473264634666434542 +434113545624263522343646734535645585657764847774698956758657696667665866775867999555696579759575474554847656447335677753334552266665334652345 +544344436235665266646377346777773578868667787467559875965668885889778657865569656967755759785468844877467477645446376454337526566465665434253 +244115325253453523656645377643737684458688644658484695797767786586855589599657666775859887874644675845567444776745647555777445644424662424412 +323532335334653435354346635644553367575678754446866865798765975955796775555675596855899688685464656587645646363347367536745654465364336545513 +253245416253663655232347643466633635457847586785746658558778766879797678767876787986886865486875657864454774537656546767646643625663453414452 +342533336265556364422373773476434335354558477778866668868569579876786679869885677687788886588644578676458574355374567445526234534264622234521 +134522235352632252364547637647554774356647676785654485456855785799997995765899669987886854587775848685756863474534576777325336322346221432122 +433312315666243632263443733736733743576557645788486766877876758778658577895788999754484874576884656754488645545465675565225464446222643113324 +314241454253353445662532655556776645575444564675888478857477747647886886986898776888875646874547665445865653556364556473242444323524655133253 +434234431554345645353325455737575544365734685656668767574768755584774757776566646488477746744787586558567363344335476566243266443332625445314 +423334344133463355235663267376376547376477755457448487785765475676865854864685568554685568564885687576534377656434677366322325335433154352541 +143115531452634246634566625577457777535336584664658776876448674876774668588576475646868746585484684667373435366733334543455252234554351334325 +123144524411356323335225355773446364445467777776788774464467685888488545786868774847784477478445856735446747575547733663222245324324411431255 +214414543153523225354563425255767735537374533785546444747488654457674584767686747864747488588748436445454674337465554255346365242321522125314 +332254325543532266422442455567647636436546757756476875488584586776855657784678785847557677658557556355656444566776625433665623562345233411414 +335121213544235345256443265362353665476753367476464758874784584757546754784554657447665488487465373474463567553755443525344532356124451332452 +445114433524324566234643434225534346354557345647463358657665774875578675756544665485685464735373656373746345336422263222525323565151533144452 +234524342523244134226445524545453374646646735555357564468747776768848758747746545457776644373375436637434546636552266353353245524141323235532 +321223254234533325456344332662352376755477645675633457763774648675466445574874455878456677376363444435344547334643532564423323343312125313533 +243513545351241414522664334542556365575774436575765766776743567477768688787685648546433444454755556565556434752254426222653265421434324113353 +433453444131343543633224352223345247633753567476466463753567363367658544445757635454376463555766735653463543266543552442622645522114514434554 +243232243124133531426532522244443434546364676737675567437373365536336364334647757474344453664475654665637642352624445242434435412351213125543 +141333532455111422555435335444222532323463463635644444374353744335335544455576333554337455467365343777347522666646236254566535213432432114141 +112214431522314123314554336522252436535253474434335574577636375564547375455475475433454767357356753777366534245623342423554412241211222534231 +124122345125253224255346546525462344554234557537443467473564537563743736446356654467367463344373377447646353542242446652241425142415425421441 +324122223233542554323452434346426655366654633464433477574334637467334436573436757653654337757566557433664466623535362446142335331153121343333 +444231432335244525244152333262656633565555435555575734447655556674344634764654477374556545445374734535662533364425422523552121441334445141111 +113413244135452455112554544545456526364364656353766654453767674753663536675563474437666553433435243255636254252646633313445413222511434134123 +212322124511521542315533235533536233344553342562446664554634543433463435537565456333447663773742353223344264562635234453353223324215314324232 +334422232245133233414113253546445264343422523322654643656735343643443664634573445663563467645442462254234232546524532425532515231112232114133 +143214341324415542331513551512346323642433333553365346557345546773733373454357763744453465326656226456544426233346212123135244451535314314412 +314112224133512512154242331551246326263343323332325555432445553734336767544577636546354535254245223524422623554442513141335215354432242221434 +214424143432322513411422451441543534555256433623355523262425455223446533634344524625253266344423222434542256434441155135413444353232214233433 +132214434113121322241424542112342252542465564262655622465364665343426423425454355465642462345333225255446355434253243523411341232124212433433 +223421433143331114451225133444552346532622436366235642364425663366325625526563535336635542634323566346546625341221143125251213114343233132141 +414321434232222312523445234245431151353465325546552462443326626256355436646533545432244555346363246456542314434113422313522135122132224441342 +213143121424444124322115243331554453352643324335545523532644466465554525542322636634266633542542645622452335115514415535424132314424423344312 +214232422144232124455155444423414232142455565654223466422255324243564562255444355644246252644246546454133344335131333423525234121311421432341 +111113234212134311441551351143155223153121125335262243365326256562264524526226446326244222566636333512231333133551114213425334423331244421323 +312441323434141124341245511411441141454531142444455562445325432326426322464224432236433543324424364143215245521314223545252124111314424223412 +323222322413211331332331521441551222414143411235332635545565223456665424352246542665552455552222313512552241544345135343134221232312313321431 +212112344113122223244211413121253253252354424542354336255553263354563363265326254655222254441131333434253533333514353223212411312321242122113 +212111232124431344341334235442142543432154245335111442453434256522236244446665423232645562533235211325152541151423524114441231321311233121232 diff --git a/2023/day17_clumsy_crucible/tests/sample_input b/2023/day17_clumsy_crucible/tests/sample_input new file mode 100644 index 0000000..f400d6e --- /dev/null +++ b/2023/day17_clumsy_crucible/tests/sample_input @@ -0,0 +1,13 @@ +2413432311323 +3215453535623 +3255245654254 +3446585845452 +4546657867536 +1438598798454 +4457876987766 +3637877979653 +4654967986887 +4564679986453 +1224686865563 +2546548887735 +4322674655533