diff options
| -rw-r--r-- | day8/__init__.py | 27 | ||||
| -rw-r--r-- | day8/example.txt | 5 | ||||
| -rw-r--r-- | day8/input.txt | 99 |
3 files changed, 131 insertions, 0 deletions
diff --git a/day8/__init__.py b/day8/__init__.py new file mode 100644 index 0000000..21e18d2 --- /dev/null +++ b/day8/__init__.py | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | # -*- coding: utf-8 -*- | ||
| 2 | from abc import ABC | ||
| 3 | from typing import Iterator, Any, List | ||
| 4 | |||
| 5 | from aoc import BaseAssignment | ||
| 6 | |||
| 7 | |||
| 8 | class Assignment(BaseAssignment): | ||
| 9 | trees: List[str] | ||
| 10 | |||
| 11 | def row_at(self, y: int) -> List[int]: | ||
| 12 | return [int(i) for i in self.trees[y]] | ||
| 13 | |||
| 14 | def col_at(self, x: int): | ||
| 15 | return [int(i[x]) for i in self.trees] | ||
| 16 | |||
| 17 | def run(self, input: Iterator) -> Any: | ||
| 18 | self.trees = list(input) | ||
| 19 | |||
| 20 | width = len(self.trees[0]) | ||
| 21 | height = len(self.trees) | ||
| 22 | |||
| 23 | return ((width - 1) * 2) + ((height - 1) * 2) | ||
| 24 | |||
| 25 | |||
| 26 | class AssignmentOne(Assignment): | ||
| 27 | example_result = 21 | ||
diff --git a/day8/example.txt b/day8/example.txt new file mode 100644 index 0000000..16d6fbd --- /dev/null +++ b/day8/example.txt | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | 30373 | ||
| 2 | 25512 | ||
| 3 | 65332 | ||
| 4 | 33549 | ||
| 5 | 35390 | ||
diff --git a/day8/input.txt b/day8/input.txt new file mode 100644 index 0000000..011b25f --- /dev/null +++ b/day8/input.txt | |||
| @@ -0,0 +1,99 @@ | |||
| 1 | 201020000020303322022230330032044230113031313453252125532013420102412124020323433212213002201211011 | ||
| 2 | 221122211131113232104233242130410414321444153244521454234151454403433303343014014211200020130201021 | ||
| 3 | 102112213233022132323042313331110325141414514433444245122521543551413102221240240323013132010021012 | ||
| 4 | 212122031103022003403234000212443324321434314422155233242453534233211343234422013224013220221331221 | ||
| 5 | 120021002213013004322300004342351223253453131112554355354434514543424530141014330412112220012030100 | ||
| 6 | 110030220312301221303240114023511313251235452554153313533532225523321252124201204244311022232032121 | ||
| 7 | 121312201031322130110230412421442225245334123131515145212234133433233415522311231022134311321000221 | ||
| 8 | 020100230031324430434024341335115412553414512562656363444145352221421522445422002030434102031122130 | ||
| 9 | 220000230104403311312243233214515515435446342656324242626366645135422532125214432110131210310103230 | ||
| 10 | 003003023131341211210331221223524241336226535362556324264636464225534143523153343232320341113023131 | ||
| 11 | 112223200042240014101242254443335526426222663425434645266646256425232421555443522443343343040222212 | ||
| 12 | 231012311120242400241444133551534245553543635524435534563436246556633523214513454134202402412222032 | ||
| 13 | 220330240202202404535344311352665323254453226554432365224562355554363363151333234523041303220413221 | ||
| 14 | 121002021430011334451344213364255233644624234666262534356622453454246624421544511143144103011020033 | ||
| 15 | 202020322113024543532552542653345533456452562654645534656235562433434436334415143435524332020024003 | ||
| 16 | 310110320114244152352314562242344252626553665353436643466362666566456525655324341215522140012022100 | ||
| 17 | 110221133144051254241134634243634566337575354377753676574754763556336655255552215423315301120131010 | ||
| 18 | 023103330131235322233516355555532625334656646336557633446767674554556336223544425443251340040433200 | ||
| 19 | 132432123105353411452624322225325575374337563365746736564554336544355525366432631211232245344411413 | ||
| 20 | 033132343444521244516544436535523466654537667544744476663746573636745636442363332524245254113330422 | ||
| 21 | 240212240325552121365552256263733535565735746335463466567544543567734476366523225543133253533443332 | ||
| 22 | 014040044113115313255646226444543555553356676643554577634743436547456666263336536224543412443204140 | ||
| 23 | 400012201233335543436555243267766533635344636448755547767763564464353465424466233534541535134330223 | ||
| 24 | 310321424323512214423252666345734663434464454477755755574766576757375645452364256455231125523143113 | ||
| 25 | 120341315235134355553326253673657737467854647875554685867768888363564466744522656643243411411202421 | ||
| 26 | 211424435534222552464542277754654673778574565664685656668785788674337456733762422665562115243331420 | ||
| 27 | 041224121545426324343433735556775558747778655475548446546444644855836447336533256244246131551211221 | ||
| 28 | 323022135312246564666246753547457576485774746455864785476454854456677544744755446355253333324224223 | ||
| 29 | 422404312454164254356374377556777545446888854765488865674655784555588374336774323453664635521512403 | ||
| 30 | 320111121333525633233467447363474754757666544975878856568786557468785844346456746244362554214155023 | ||
| 31 | 432133454253265442345345367564745678767664779676785676798694645576758675675747735332642463312112442 | ||
| 32 | 303044543315533422426665357566548776856698687968965877966777576476455648334774674336234564143523313 | ||
| 33 | 141124135323365336635663746548446444577695886575586577666799555466665865475376647553423643512423530 | ||
| 34 | 214355155153534342435373445867856445699798866765787679777879657677674465463366466546466355423513541 | ||
| 35 | 003314452422264644754655647484847787556699986866665997688995697585544577454635535652562622625554232 | ||
| 36 | 315232221245242552336775778457657668657989955685775566796966866855746586478664734656234355514532113 | ||
| 37 | 114523555126323526455355657567578457756678568766677866966877997875946568856775756354534423351113425 | ||
| 38 | 323154212432364243635574378486488795588786589898766869768775675985574687587653464466455563533245312 | ||
| 39 | 315513155645632255373634478746559855698786877669779868866968696889595665758655537764544622435452211 | ||
| 40 | 155455415243234246537643657878448578656566766676798978896899986985897445746483446365556345462215431 | ||
| 41 | 132413352225424265436564845767665787788796666978899699878767689797576774668475563457633455426325145 | ||
| 42 | 035342443624642673756568758755467769877698897769966699866679798958679645876645565566733542646215143 | ||
| 43 | 252343432363525635777736884647665956669776899668776967669967686779669885785475437576333252562122345 | ||
| 44 | 411311213323642436666665454786686569677689978787778968768667697778676656447454536774434556532524442 | ||
| 45 | 325115355463345543664455455688586966988886788699779997996789877987877886457686473773546434644314535 | ||
| 46 | 433555536433446454546485748745986879998796687879987888976878898856799789848876646575536265334111424 | ||
| 47 | 545552165343435735755454777565959567986989967798977988887789877895885889675565554633442654643654425 | ||
| 48 | 534223446223323736633585867855878669869696967889999787899679788795669667766454554437732624542231312 | ||
| 49 | 115411526646527737747346785446589788969689987798978778889786868668995757566484657566775233634435121 | ||
| 50 | 344525324534526535464368486565899669977988997898987977887886966767756889676855867574773434232411251 | ||
| 51 | 212512245524437756563668454567599955986988888977789987788876798885976658848846474664543353623513415 | ||
| 52 | 551242242534355353554587765457785895879698687978789997977777789686767995845757837367743655563315111 | ||
| 53 | 333112226262653563744368577646597976867687789887788779798677766986556597758484573466337344546512342 | ||
| 54 | 121453322644444354654584784688689598898878667899999977787999989686675767768757754646344363534211134 | ||
| 55 | 415125366435452537577667458578656866778878878989887897798696876865789875444444476657445326253554534 | ||
| 56 | 531113124455566744773445888477797596776969696979979799976899787979559588468555864477433426232435435 | ||
| 57 | 444525352562435775533756588888599876778978668889988889987788876698578696586586766446442222434453551 | ||
| 58 | 011423454424543744555648557788899588786976898979897878676876899758695857847865556577643446232444355 | ||
| 59 | 113421412445663737435776446764868968996886799867787678867889686575587867867668433433575266324212535 | ||
| 60 | 145313224636652244437535645477787898657898779786667978667976987965688977844457744773662435264235354 | ||
| 61 | 322444552534333347547755588474678658788868996769867787869968657869969757854476677475346522364245435 | ||
| 62 | 155451413634255633367675574887588657599988966986786889869999699857556674786566436355453655255335313 | ||
| 63 | 011115224526426436457765544677789855685775669668769679776898685585875448877747355533463542265253313 | ||
| 64 | 421513353634556643545746565788448798995557797867679997976966568778684755844657453474324363644422132 | ||
| 65 | 424124123234232356335437365774776476777675995766896668885965685798754488687775575546465336614141113 | ||
| 66 | 224525232426666356376347735456687547888958866599959977868595685699855768855537645475325566411521441 | ||
| 67 | 010452514236325625664763535865858674855756888557776597995795768884668555854353653373442452223555110 | ||
| 68 | 233452123533246442646765653487474644476798588579559689875968697974478784843437774765534656111433334 | ||
| 69 | 334334531432222443267675376487857555675967869879855979697965677677654566636735646454225662144133140 | ||
| 70 | 001225254155444434645666766357784466776477977878858787696555844667676744356533335232323623531345103 | ||
| 71 | 302135311134435335527576674573867586767686688596997797787797478864775445673573367224525231252152212 | ||
| 72 | 021404135525242534545665443545765777746456888579777989695865687784648643756566573366254213344555213 | ||
| 73 | 044343323333323665255564365457338554886888546875566766477546647686484333337574565545432645234453401 | ||
| 74 | 231000311153344624642634556547376875677587555667576684856587746845654457543436343466453314145250040 | ||
| 75 | 200012424534143465246433675577347368864864757878448674875474676547545557443443256425556112543112221 | ||
| 76 | 224122332451313652563435455457334565685444887787864765466648855483744576536663554253355253222220142 | ||
| 77 | 043224025444321226454346556743664643465465845468785848846464877773545666355223262524421325243212321 | ||
| 78 | 011040433124534116256654345354363635553646677845786467868647636353444766632635336654314321515320323 | ||
| 79 | 331402111232145443263353466367765354433665344655866647668766566467474454662654334463114315541101210 | ||
| 80 | 141103243533333225463465245644376767537677653735747535776456356376475676223566524434314115221424420 | ||
| 81 | 122341124454254443564665254462753646774546734435734653654337646565366653525255342315353143231112131 | ||
| 82 | 330241244331352334326263342332334543656756577774736743347437637454636626622453322353151335342031410 | ||
| 83 | 101011141113311355121535244662346675667453474664477373444434537764332345353422642151445213331300321 | ||
| 84 | 202434003224355125334313254642523662545676534675755643446547547664446622455236424145114330232141343 | ||
| 85 | 223234300341032154514515266265623564465444376553447554737466375246532435533642331333435534213043030 | ||
| 86 | 311120432040113211154333223444563336266242444543434767633353325334535623424341534254112432413322201 | ||
| 87 | 201001024310404525411124234435523356244264563453345644646332455353525233353423222122553440131133000 | ||
| 88 | 230101031024214425345433251153455563362556546652446245554534555434622455613435314215221041142342212 | ||
| 89 | 002221213412420132124132321151523626344332445632454654365454525366352463343212512523014244333223200 | ||
| 90 | 100132021423121332553234241241144454442525436534326442642454344636254511213144453134023432124110122 | ||
| 91 | 010031101411142421225123351233451143554553325465225435565244533246241145141153143241213213041000302 | ||
| 92 | 023323303001214031042243121311443352365626544526226433435636553353223153445124413242211232310121003 | ||
| 93 | 010332220132301212403032412131445344225445255636665232224563245351225444153421101444022242211023131 | ||
| 94 | 200231322211423420140141514424354541422215543125636226333224413143525251333221024210333121131120023 | ||
| 95 | 110121032233102443112231002123151545531214331415224411123531145123422253222101330122000430133010030 | ||
| 96 | 011001132223211344301013433412413154113522251445542421555254214443451322303310300203231022121333310 | ||
| 97 | 021200232231012000201011020121322235235233535533352543221242332553452143101022000414323230132102112 | ||
| 98 | 002101113203023310140322141401244212541455241424152514451444325212444422133103022314330130021132222 | ||
| 99 | 100002203323321203402423434324400223225443334554221555514312335522000320202144212403130203231300110 | ||
