diff --git a/src/Visp.Compiler/Transforms/SyntaxMacroExpander.fs b/src/Visp.Compiler/Transforms/SyntaxMacroExpander.fs index 0189d37..c3b4b83 100644 --- a/src/Visp.Compiler/Transforms/SyntaxMacroExpander.fs +++ b/src/Visp.Compiler/Transforms/SyntaxMacroExpander.fs @@ -17,11 +17,7 @@ open System.Collections.Generic let (|MatchingText|) str (pat: SynMacroPat) = match pat with - | SynMacroPat.Symbol(it, _) -> - if it.Text = str then - true - else - false + | SynMacroPat.Symbol(it, _) -> if it.Text = str then true else false | _ -> false let (|DiscardPredicate|Not|) (pat: SynMacroPat) = @@ -40,7 +36,7 @@ let rec private matchesPat (args: SynMacroBody list) (pats: SynMacroPat list) = // printfn "matching %A with %A" arg pt let temp = match (pt, arg) with - | (DiscardPredicate, SynMacroBody.Discard _) -> + | (DiscardPredicate, SynMacroBody.Discard _) -> // printfn "DISCAAARD pt: %A lhs: %A\nRESTPAT:\n%A\nARGREST:\n%A" pt arg rest argRest true // TODO: Constant matching diff --git a/visp/examples/aoc2023/day7.visp b/visp/examples/aoc2023/day7.visp new file mode 100644 index 0000000..06bd9f8 --- /dev/null +++ b/visp/examples/aoc2023/day7.visp @@ -0,0 +1,292 @@ +;; Copyright 2023 Ville Penttinen +;; Distributed under the MIT License. +;; https://github.com/vipentti/visp-fs/blob/main/LICENSE.md +;; +;; for basic syntax highlighting +;; vim: set syntax=clojure: +(require SpanUtils "0.4.0") + +(open System) +(open System.Collections.Generic) +(open System.Text.RegularExpressions) +(open SpanUtils.Extensions) + +(fn WriteResult (part value ex) + (printfn "%s: %A %A" part value (= value ex))) + +(let example (not (Array.contains "full" ARGV))) +(let day "day7") +(let filepath (+ "./inputs/" day (if example "_example" "") ".txt")) + +(let splitOptions + (bor StringSplitOptions.TrimEntries StringSplitOptions.RemoveEmptyEntries)) + +(fn SplitLines ([text: string]) + (text.EnumerateSplitSubstrings ((!array #\lf #\cr), splitOptions))) + +(type Cards list) + +(union Hand + (FiveOfKind Cards) + (FourOfKind Cards) + (FullHouse Cards) + (ThreeOfKind Cards) + (TwoPair Cards) + (OnePair Cards) + (HighCard Cards) + + (member t.Cards + (match t + [(FiveOfKind c) c] + [(FourOfKind c) c] + [(FullHouse c) c] + [(ThreeOfKind c) c] + [(TwoPair c) c] + [(OnePair c) c] + [(HighCard c) c] + )) +) + +(fn HandRank ([hand: Hand]) + (match hand + [(FiveOfKind _) 7] + [(FourOfKind _) 6] + [(FullHouse _) 5] + [(ThreeOfKind _) 4] + [(TwoPair _) 3] + [(OnePair _) 2] + [(HighCard _) 1] + )) + +(fn CardsToHand ([s: Cards]) + (let cardCounts (->> (List.countBy id s) (List.sortByDescending snd))) + (let counts (->> cardCounts (List.map snd))) + (match counts + [(5 :: []) + (FiveOfKind s)] + [(4 :: 1 :: []) + (FourOfKind s)] + [(3 :: 2 :: []) + (FullHouse s)] + [(3 :: _ :: rest) + (ThreeOfKind s)] + [(2 :: 2 :: rest) + (TwoPair s)] + [(2 :: _ :: rest) + (OnePair s)] + [_ (HighCard s)] + )) + +(fn CardsToHandPart2 ([s: Cards]) + (let cardCounts (->> + s + (List.filter #(not (= %1 #\J))) + (List.countBy id) + (List.sortByDescending snd))) + (let counts (->> cardCounts (List.map snd))) + (let jokerCount (->> s (List.filter #(= %1 #\J)) +Length)) + + (let res (match (counts . jokerCount) + [(5 :: _ . 0) (FiveOfKind s)] + [(_ . 5) (FiveOfKind s)] + + [(4 :: _ . 1) (FiveOfKind s)] + [(4 :: _ . 0) (FourOfKind s)] + + [(3 :: _ . 2) (FiveOfKind s)] + [(3 :: _ . 1) (FourOfKind s)] + [(3 :: 2 :: _ . 0) (FullHouse s)] + [(3 :: _ . 0) (ThreeOfKind s)] + + [(2 :: _ . 3) (FiveOfKind s)] + [(2 :: _ . 2) (FourOfKind s)] + [(2 :: 2 :: _ . 1) (FullHouse s)] + [(2 :: _ . 1) (ThreeOfKind s)] + [(2 :: 2 :: _ . 0) (TwoPair s)] + [(2 :: _ . 0) (OnePair s)] + + [(1 :: _ . 4) (FiveOfKind s)] + [(1 :: _ . 3) (FourOfKind s)] + [(1 :: _ . 2) (ThreeOfKind s)] + [(1 :: _ . 1) (OnePair s)] + [(_ . _) (HighCard s)] + )) + + + ;; (if (> jokerCount 0) + ;; (begin + ;; (let temp (sprintf "%A" counts)) + ;; (printfn "JOKER %A vs %-15s = %A" jokerCount temp res) + ;; ) + ;; ) + + res +) + +(fn SpanToCards ([s: System.ReadOnlySpan]) + (mut rev (!list)) + + (for/in [c s] + (set! rev (cons c rev))) + + (List.rev rev)) + +(fn SpanToHand ([s: System.ReadOnlySpan]) + (->> (SpanToCards s) CardsToHand)) + +(fn StringToCards ([s: string]) + (SpanToCards (s.AsSpan))) + +(fn StringToHand ([s: string]) + (->> s StringToCards CardsToHand)) + +;; A, K, Q, J, T, 9, 8, 7, 6, 5, 4, 3, or 2. +(fn CardRank ([ch: char]) + (match ch + [#\A 14] + [#\K 13] + [#\Q 12] + [#\J 11] + [#\T 10] + [#\9 9] + [#\8 8] + [#\7 7] + [#\6 6] + [#\5 5] + [#\4 4] + [#\3 3] + [#\2 2] + [_ (failwithf "unsupported card '%c'" ch)] + )) + +(fn CardRankPart2 ([ch: char]) + (match ch + [#\A 14] + [#\K 13] + [#\Q 12] + [#\T 10] + [#\9 9] + [#\8 8] + [#\7 7] + [#\6 6] + [#\5 5] + [#\4 4] + [#\3 3] + [#\2 2] + [#\J 1] + [_ (failwithf "unsupported card '%c'" ch)] + )) + +(fn rec CompareCards ([lhs: Cards] [rhs: Cards]) + (match (lhs . rhs) + [((lhs :: lhsrest) . (rhs :: rhsrest)) + (let res (compare (CardRank lhs) (CardRank rhs))) + (cond_ + [(= res 0) + (CompareCards lhsrest rhsrest) + ] + [_ res]) + ] + [(([]) . ([])) + 0 + ] + [_ (failwithf "todo %A %A" lhs rhs)] + )) + +(fn rec CompareCardsPart2 ([lhs: Cards] [rhs: Cards]) + (match (lhs . rhs) + [((lhs :: lhsrest) . (rhs :: rhsrest)) + (let res (compare (CardRankPart2 lhs) (CardRankPart2 rhs))) + (cond_ + [(= res 0) + (CompareCardsPart2 lhsrest rhsrest) + ] + [_ res]) + ] + [(([]) . ([])) + 0 + ] + [_ (failwithf "todo %A %A" lhs rhs)] + )) + +(fn CompareHands ([lhs: Hand] [rhs: Hand]) + (let lhsRank (HandRank lhs)) + (let rhsRank (HandRank rhs)) + + (cond_ + [(= lhsRank rhsRank) (CompareCards lhs.Cards rhs.Cards)] + [_ (compare lhsRank rhsRank)] + )) + +(fn CompareHandsPart2 ([lhs: Hand] [rhs: Hand]) + (let lhsRank (HandRank lhs)) + (let rhsRank (HandRank rhs)) + + (cond_ + [(= lhsRank rhsRank) (CompareCardsPart2 lhs.Cards rhs.Cards)] + [_ (compare lhsRank rhsRank)] + )) + +(fn ParseHands (ctor text) + (mut lines (SplitLines text)) + (let res (new ResizeArray<_>)) + + (while (lines.MoveNext) + (let line lines.Current) + + (mut lineEnu (line.EnumerateSplitSubstrings (#\space, splitOptions))) + (let _ (lineEnu.MoveNext)) + (let hand (SpanToCards lineEnu.Current)) + (let _ (lineEnu.MoveNext)) + (let bid (span->int32 lineEnu.Current)) + (res.Add ((ctor hand) . bid)) + + ()) + + (List.ofSeq res)) + +(let fileText (System.IO.File.ReadAllText filepath)) +(let part1hands (ParseHands CardsToHand fileText)) +(let part1ordered (->> part1hands + (List.sortWith #(CompareHands (fst %1) (fst %2))) +)) +(let part1 (->> part1ordered + (Seq.map snd) + (Seq.mapi #(* (inc %1) %2)) + (Seq.reduce add) +)) + +(WriteResult "part1" part1 (if example 6440 253910319)) + +(let part2hands (ParseHands CardsToHandPart2 fileText)) +(let part2ordered (->> part2hands + (List.sortWith #(CompareHandsPart2 (fst %1) (fst %2))) +)) +(let part2 (->> part2ordered + (Seq.map snd) + (Seq.mapi #(* (inc %1) %2)) + (Seq.reduce add) +)) + +(WriteResult "part2" part2 (if example 5905 254083736)) + +;; (printfn "%A" (CardsToHandPart2 (StringToCards "QQQJA"))) +;; (printfn "%A" (CardsToHandPart2 (StringToCards "T55J5"))) +;; (printfn "%A" (CardsToHandPart2 (StringToCards "KTJJT"))) + + +;; (printfn "Compare %A" +;; (CompareHands +;; (StringToHand "33332") +;; (StringToHand "2AAAA") +;; ) +;; ) + +;; (printfn "Compare %A" +;; (CompareHands +;; (StringToHand "77788") +;; (StringToHand "77888") +;; ) +;; ) + +() diff --git a/visp/examples/aoc2023/inputs/day7.txt b/visp/examples/aoc2023/inputs/day7.txt new file mode 100644 index 0000000..20ce6b3 --- /dev/null +++ b/visp/examples/aoc2023/inputs/day7.txt @@ -0,0 +1,1000 @@ +5J984 114 +766KQ 685 +6KQK6 169 +2A663 361 +7T849 916 +AKKQA 144 +99KKK 430 +787J8 587 +7JJ77 757 +5AA9A 561 +A7T4J 166 +Q9A7J 843 +32QT5 11 +88555 936 +99899 421 +K88KK 784 +AA222 806 +6A5T7 911 +5A53A 896 +8J544 827 +99952 377 +9JQ44 950 +KQKK3 670 +963J5 490 +7JJ99 91 +Q6QQJ 571 +26622 866 +68J8T 395 +TQK56 106 +5JJK9 285 +A67AA 197 +99949 645 +56422 955 +A94AJ 636 +8888K 729 +K5993 584 +777J8 445 +2T42T 514 +JTK7J 7 +TA5TT 18 +96J29 249 +44254 801 +44579 130 +QQQAA 903 +A3839 159 +AATAA 511 +6K59A 347 +Q7968 27 +63636 315 +28282 136 +7J44Q 603 +T6JT6 538 +5KA3Q 692 +87Q88 787 +99599 574 +T9AAJ 299 +A737K 663 +7K539 80 +555QQ 240 +5AAAK 897 +233AA 294 +2T233 793 +J5559 357 +T7AJ7 569 +72729 807 +KKQKK 163 +K6KK6 997 +254K5 34 +J7TTK 155 +62Q8T 975 +3AAQK 621 +6QJJQ 500 +AK736 276 +KK666 840 +Q7Q57 260 +836T6 859 +2K22K 5 +97589 216 +ATA2A 783 +5JJ5J 864 +6QJJ6 158 +59K9K 323 +KKK77 893 +33AAA 922 +Q6A3K 669 +6238K 333 +QAQ46 283 +954QK 268 +634TA 471 +22823 393 +A8TQ8 749 +33T3T 727 +5AA77 288 +77KQ7 622 +587KK 42 +AAAKA 736 +T7J77 939 +89A5T 881 +A494K 467 +35T4A 641 +QT85K 937 +7J5T7 337 +QQ4KA 989 +9TA46 492 +7KKKK 224 +JQ478 431 +69665 609 +32Q2Q 967 +QQ9QJ 977 +TAJQK 710 +94448 200 +J4422 678 +2A822 340 +A72K7 179 +J8JJ6 290 +8KAK6 549 +644J6 659 +444K9 612 +3KA97 402 +J3333 928 +96855 261 +Q3K43 779 +33494 303 +4T297 687 +J998A 349 +T999T 860 +79246 341 +97J8J 990 +2J954 448 +338A8 281 +K9999 724 +6666A 327 +JJJ8J 704 +KK5J5 942 +328T5 573 +TT6T4 699 +JQQQQ 961 +Q37TQ 354 +6668K 608 +82222 368 +4449J 650 +TA6AQ 172 +T5J29 383 +52555 24 +A98KA 175 +A2J63 65 +45594 149 +9J784 930 +KJKTK 350 +44484 839 +56585 273 +JQQ46 945 +8JKKK 400 +KK4T4 617 +5K553 1 +2227T 225 +T3TTK 853 +8TT88 404 +8TJ64 270 +A927K 594 +A79A7 589 +JT499 957 +Q88Q8 730 +2A2TQ 913 +AQT58 87 +444AQ 737 +7777J 452 +TTT39 8 +JAAAA 243 +43533 102 +53333 598 +6QQQ6 711 +33JTT 308 +98QQJ 124 +66644 300 +64K36 46 +JT8K9 921 +35AA3 848 +2QQ72 161 +2A4QQ 90 +6J777 52 +9T299 75 +JJ999 204 +7977K 499 +32357 742 +JQTKT 810 +89998 81 +82QTQ 734 +778AQ 522 +T992A 847 +TT85T 138 +K9KQK 841 +Q6654 367 +333JQ 122 +QQ655 219 +76699 966 +4J784 66 +7AJ84 557 +J363T 548 +23487 732 +6635A 604 +22J92 223 +44494 983 +JTTKK 214 +993AA 61 +35462 147 +T6666 94 +5QQ22 946 +58QQ5 607 +569K8 520 +97J7A 940 +9955K 356 +99J9A 797 +57566 863 +77KK7 447 +6K999 504 +QQ6A6 111 +49979 712 +Q888T 882 +45875 611 +Q8A9A 735 +6Q2QQ 648 +44545 370 +4A994 177 +5KQKK 86 +TT9TT 241 +TQQ4T 145 +2366J 705 +J5388 796 +555TK 317 +KK822 959 +T44JA 614 +2Q762 295 +33539 570 +AA7J7 215 +22277 314 +366JA 129 +58888 17 +8A8A8 302 +54499 919 +884JJ 412 +5Q554 150 +AT96K 649 +27K2K 190 +4J2K7 776 +99QA7 886 +A4558 760 +TT3TT 850 +92522 183 +33777 460 +99246 802 +45995 373 +66866 618 +KA77K 496 +66QQ8 221 +55755 780 +658KQ 994 +78T77 910 +K55K5 951 +T9KA7 728 +K6923 97 +T7977 189 +7AAAA 275 +J9666 255 +66736 918 +339Q9 803 +34333 599 +J9599 157 +JATTA 267 +Q336K 312 +J6598 40 +Q8Q8J 537 +T2TTT 76 +7T7T7 502 +24222 682 +55K5J 865 +29692 743 +99276 543 +5KQQQ 938 +7T78K 889 +6577Q 310 +645KA 78 +68222 854 +33K25 998 +66K66 207 +59939 510 +7858J 521 +A9947 55 +T2J3Q 374 +9QJ39 898 +AATA8 733 +AT38T 700 +K7Q29 384 +26JQK 19 +J5333 263 +52K95 525 +QQAQT 459 +88868 808 +9QJ55 233 +3KAA2 651 +7633A 953 +45542 126 +96T88 494 +KKK95 182 +3TQ56 572 +8QTTT 747 +5TTT3 428 +445J5 164 +5788T 399 +7KQKQ 653 +A5688 826 +T3JTT 51 +7JJ79 713 +355AT 782 +TQJKQ 388 +KKT9K 409 +22332 465 +A6566 824 +AJA99 2 +654J6 43 +55T45 948 +7989T 697 +2249J 206 +33336 991 +8932A 472 +5A6T6 245 +2T2TT 429 +9JQJ9 242 +J7JAA 746 +78TQ4 809 +99494 563 +28JA3 547 +A3A9A 389 +9QQTT 696 +73T89 390 +825JQ 186 +737Q3 654 +K33T3 481 +QQ8QQ 418 +66A5A 201 +5Q327 965 +23233 970 +T33TT 26 +T45JJ 420 +88684 32 +KT696 758 +A3A8A 324 +JTA78 518 +J3838 539 +KJAAA 606 +92999 237 +39933 22 +922KA 365 +T44T4 871 +49J3T 680 +66688 716 +8Q68Q 721 +6676J 844 +2K426 986 +Q6J3K 952 +96A64 104 +84448 907 +A9A76 888 +TTT4T 887 +44TKT 805 +22QQ2 123 +78293 208 +58T59 634 +92TKQ 773 +J9J9J 184 +JQQQK 218 +5T88T 885 +T6TT9 980 +22J22 154 +7Q777 364 +47474 909 +AAAA9 979 +75655 292 +TJ942 693 +Q4AT4 9 +T8J85 745 +JJK7K 777 +76T8A 309 +88A7A 332 +74Q3J 656 +56TJ5 211 +23K72 475 +QK8K8 318 +2922Q 264 +T4QQ9 666 +97999 676 +K83T8 173 +552J7 553 +6J7KA 162 +ATA7T 778 +AA94K 681 +83K63 414 +K77K3 441 +544JJ 305 +J2252 625 +46JJ8 25 +4282A 466 +66468 630 +98Q5Q 739 +62346 371 +4K89Q 926 +8222K 462 +4T33T 794 +82T38 534 +5A55A 973 +AAKKJ 535 +6A342 505 +TQTTT 588 +KA8A4 256 +J2454 116 +89K5J 723 +43855 199 +38T47 140 +J9AA2 551 +24242 422 +T2KTK 963 +5493Q 532 +67446 647 +J5QQQ 133 +KK6KK 748 +JTTA8 6 +5A78A 644 +59552 29 +7JAAA 449 +6QK43 686 +8288K 668 +777KJ 917 +87656 869 +55322 901 +5AA5A 544 +48888 222 +4Q794 101 +97979 360 +5J37Q 93 +2QKK9 497 +52525 134 +7847K 923 +TAJTT 879 +4ATQK 64 +53Q22 440 +K843Q 195 +555T5 286 +JQQAA 643 +JQQJQ 506 +J329J 329 +72222 981 +79J99 877 +9QQ97 236 +QJ676 593 +TTJJT 446 +KQAKK 394 +68886 738 +7238T 799 +K32K3 258 +29442 673 +8Q87Q 212 +6J965 444 +A7J45 454 +J99KK 637 +42AA2 105 +J6556 478 +33ATJ 473 +26A6Q 517 +QJQJ5 932 +K45TT 425 +894TK 944 +99A97 411 +A8557 583 +T2T99 398 +K43Q2 397 +K3TT3 72 +QQQQ6 278 +Q5KK5 450 +TT222 660 +TTT7T 185 +4JTQJ 56 +77A77 375 +78888 345 +7AQT2 905 +84A58 899 +4KQ28 230 +T8529 16 +42424 894 +99922 451 +Q9QQ2 352 +32299 403 +2K465 396 +68Q3T 313 +4AJ44 635 +993J3 108 +27772 845 +JAA3A 818 +43242 468 +JQ52J 718 +4K3KK 702 +22KK3 493 +Q5QKA 82 +22666 413 +J3Q29 120 +694K3 876 +888Q8 229 +2AQQ9 271 +843Q9 890 +6476J 250 +82T49 457 +AJ2K2 988 +Q678T 674 +Q4T9T 792 +25274 519 +555TQ 714 +52858 852 +579JJ 355 +JT664 771 +68JQT 559 +K4KKK 455 +QAA9Q 321 +2T2JA 836 +K68J2 706 +JTTT5 69 +TQ58T 580 +ATKT7 464 +7J977 765 +T4487 536 +8K382 672 +54533 284 +92A99 392 +K995J 344 +78737 67 +A5623 319 +389QA 307 +J4244 210 +7799J 156 +3A44A 89 +44458 825 +263K5 213 +TTTJT 228 +33833 862 +333Q9 616 +8J888 639 +4J446 372 +8Q423 193 +4T55T 57 +8949J 731 +KK5K5 331 +Q99AQ 279 +6T262 73 +A725T 53 +59555 4 +2A27A 165 +3A72A 23 +2K5A5 358 +K98TA 822 +55554 100 +777T7 474 +QJAKK 369 +352J5 586 +8A639 615 +63Q3J 655 +26QQJ 829 +TTT66 417 +6QA8A 949 +47A78 31 +47J74 437 +86342 419 +36T59 508 +6Q8K6 891 +646AA 987 +46666 342 +85QK8 320 +98588 289 +96969 251 +K5QQK 85 +J7775 755 +88484 435 +4JAQT 426 +4J5J6 816 +522Q8 741 +83QA5 868 +3J6J3 984 +2J2QQ 15 +44644 247 +6AA6A 912 +4922A 96 +TTAAA 160 +A9JTJ 433 +J5799 59 +K7K72 453 +TTJ9T 873 +J844T 821 +45343 744 +555A5 385 +T724J 812 +46TT7 830 +KQJ29 768 +3K33K 343 +J977K 381 +999J2 664 +4863K 92 +48Q6K 434 +44J4J 971 +99Q99 458 +89898 432 +78772 37 +753J2 756 +7K75A 143 +45556 578 +4Q6AT 287 +K35JK 992 +999KK 338 +Q6KQQ 856 +Q2264 469 +47TKA 107 +85559 280 +88777 239 +45TTJ 766 +QQ988 180 +7A3A3 456 +23397 556 +7TJK2 470 +6T6T6 366 +A585J 391 +2K2Q4 914 +AA6AJ 135 +A4AA4 560 +4TK48 823 +34944 566 +33977 226 +T8TTJ 833 +777K7 170 +9J388 683 +95955 304 +TTQQJ 205 +2T6A2 501 +52424 690 +JAT2J 512 +95566 769 +TA3KJ 633 +55A45 487 +AA333 209 +A5K29 601 +8AA8A 3 +27AK6 610 +44445 786 +2K44Q 137 +9KA59 359 +TQ488 118 +36886 934 +J7KJ5 993 +77787 410 +A777A 44 +76732 626 +3K3KT 838 +KK46K 513 +J3633 781 +J3733 555 +99399 804 +9K6T4 552 +9K9QT 171 +5TT59 408 +8T37J 929 +2864K 12 +55333 259 +4485K 662 +Q7QQQ 336 +TTTTA 638 +Q3T33 947 +98993 296 +J4334 642 +3J999 139 +3QQ44 60 +43K92 597 +56733 695 +22Q39 117 +4J2J8 775 +3QQQ3 217 +66558 795 +AA2K2 762 +22JJ2 531 +85742 851 +87QTK 20 +8JT6T 187 +244Q4 188 +2TT49 335 +44K44 152 +883A9 585 +T6J32 376 +5JK2J 148 +J8J38 379 +36KT2 567 +JT662 602 +JQ5KT 83 +2222Q 627 +Q699Q 763 +9Q24Q 798 +TJ7A5 576 +8958Q 109 +2T73T 322 +Q7493 88 +3J33J 872 +9J8J8 722 +J7A2K 191 +55758 119 +Q6466 326 +79352 115 +3T3K6 252 +464Q4 995 +356J8 740 +J9JQT 540 +96233 554 +92AJ5 79 +42228 709 +4J84K 346 +74A4A 178 +89229 277 +2T6J2 565 +Q9Q99 49 +T33Q2 45 +9Q9A3 985 +63969 541 +Q44QQ 524 +A9999 935 +ATTTA 815 +Q75JQ 238 +4787J 596 +QQ7Q7 564 +5J7T3 386 +98T99 382 +T8J82 884 +64464 297 +TTT2J 753 +699J9 623 +5J755 167 +333A3 751 +JJAAA 867 +A8A58 969 +TKKKK 232 +TT57T 1000 +JJJJJ 35 +Q8Q2Q 906 +44A44 363 +38A2K 203 +J5KAQ 691 +K2KK6 328 +6AQQQ 878 +7K5TA 999 +AQ272 95 +86JAT 298 +7TATQ 125 +3K382 439 +3TT99 509 +TKJJ2 99 +6J4K2 752 +28687 244 +A243A 689 +QQQA8 168 +6AK5Q 407 +3J739 870 +T565T 933 +QTAAQ 351 +539K8 311 +77T9Q 819 +889T5 98 +55T9J 924 +2Q5J3 968 +KQ32Q 631 +5K225 142 +57788 715 +AQQAA 198 +JQ24K 77 +78788 174 +2293J 488 +77772 958 +57995 849 +KT87T 754 +J895J 141 +T36KA 254 +AAA2A 334 +3A999 58 +TJ2JT 416 +K2227 545 +5J3T5 550 +64964 925 +63T69 41 +2TQQ4 837 +KJA87 533 +3778J 528 +JQJ9A 21 +42J36 227 +529K7 196 +QT8K3 832 +J8QQ5 84 +8K6J4 976 +J8JQ8 231 +5AJ8A 591 +Q9T66 498 +7557J 70 +T48JT 476 +75552 632 +AAAQA 282 +75725 401 +T996Q 405 +467T8 39 +KQKQK 620 +4Q237 265 +A9JAA 892 +A3K7Q 772 +3Q6J5 132 +634J3 904 +Q6255 272 +8A9A8 13 +QQQQ5 590 +56566 112 +66477 701 +56QJQ 640 +QAK84 875 +4KQQT 68 +63QTQ 526 +K425T 71 +888KK 362 +J984K 489 +6666J 931 +33732 770 +7227J 482 +KK5K2 895 +A2588 707 +58333 248 +3928K 253 +KKTQK 131 +94A77 121 +Q8688 527 +JQK99 339 +KT335 491 +2J22A 387 +32977 717 +6A6A8 834 +2K2KK 54 +A997A 726 +6J66J 652 +27979 151 +A66T6 235 +4J444 694 +4A8K4 579 +J6AJ4 28 +244QA 74 +366KJ 220 +7T3T3 814 +49494 954 +8866Q 811 +T3K42 613 +7Q878 257 +6793Q 813 +K993K 262 +2544A 306 +9J999 62 +4TT98 47 +22225 790 +JATKA 855 +43726 629 +6T556 820 +AJT2T 523 +2227A 978 +6QQJ6 427 +A4A7A 529 +88882 63 +88T88 791 +555JA 677 +J8J88 708 +KK9KK 516 +45455 831 +T54TT 463 +J3T66 661 +535J9 10 +3A2AA 671 +2J22T 764 +JQ7KK 725 +33337 720 +ATT3J 192 +Q7QTQ 153 +27A3Q 767 +J63JA 423 +KT453 293 +27TTJ 658 +K7Q54 477 +64Q46 436 +984TQ 679 +AAJ54 817 +4K424 858 +55T7Q 575 +79377 274 +4JQ54 194 +434Q2 181 +AJQ8K 128 +2TT92 595 +37J7T 605 +QQ8Q4 920 +4999T 484 +K4K7K 880 +9222K 443 +77767 646 +AJJAJ 964 +A782J 785 +35A7K 789 +QJ42J 703 +4J243 14 +JTAAA 835 +A7425 479 +A5TTA 546 +9Q298 562 +53935 582 +6643Q 406 +4TJJT 507 +26666 234 +QQ5Q2 480 +557AA 624 +TQ35Q 495 +72767 38 +T95A4 146 +88KA5 996 +35735 592 +KJJKK 577 +453K6 883 +AA4AA 542 +67895 530 +KKKKJ 684 +6469Q 316 +648J5 842 +74747 483 +3J63A 874 +4K5TA 960 +65555 915 +26K2K 759 +TT933 941 +AA2J6 667 +33344 675 +KKKAA 788 +55656 600 +634T7 36 +7TTQJ 438 +TJ444 902 +2266J 291 +77775 325 +66JQ6 378 +69669 461 +27K86 568 +493AT 688 +5JJ5A 503 +T5TTT 956 +TJT73 982 +8J272 380 +KT9TT 103 +463A4 48 +66TTK 719 +27QJJ 246 +JQ5Q5 330 +A39T2 900 +QQ33T 800 +5JJ55 774 +38526 424 +77774 828 +A547T 761 +5449J 110 +KKAA4 301 +6T549 176 +39AA3 972 +55977 628 +727A4 127 +4J247 665 +97777 202 +K5Q38 353 +5J555 558 +KA587 943 +77667 908 +KJ7T4 348 +69667 974 +3JT38 750 +33AAQ 415 +TJ22T 962 +76876 927 +75722 515 +A3822 581 +7Q44Q 857 +QQQAQ 33 +9AA9A 266 +Q7QJ2 619 +J7K72 846 +7A6A6 861 +666Q6 657 +333JA 113 +7243A 442 +2KT94 50 +8898T 485 +3AJ53 30 +42J22 698 +585J6 269 +QT527 486 diff --git a/visp/examples/aoc2023/inputs/day7_example.txt b/visp/examples/aoc2023/inputs/day7_example.txt new file mode 100644 index 0000000..e3500c3 --- /dev/null +++ b/visp/examples/aoc2023/inputs/day7_example.txt @@ -0,0 +1,5 @@ +32T3K 765 +T55J5 684 +KK677 28 +KTJJT 220 +QQQJA 483