From e603b6eb27c902545b893fe2fa89d54c41f9d4a4 Mon Sep 17 00:00:00 2001 From: deckelmouck Date: Thu, 7 Dec 2023 07:28:54 +0100 Subject: [PATCH 01/14] preparing day07 --- 2023/Day07/input | 1000 ++++++++++++++++++++++++++++++++++++++++ 2023/Day07/solution.cs | 61 +++ 2023/Day07/test | 5 + README.md | 1 + 4 files changed, 1067 insertions(+) create mode 100644 2023/Day07/input create mode 100644 2023/Day07/solution.cs create mode 100644 2023/Day07/test diff --git a/2023/Day07/input b/2023/Day07/input new file mode 100644 index 0000000..e84bbe2 --- /dev/null +++ b/2023/Day07/input @@ -0,0 +1,1000 @@ +467K3 95 +JK5QK 838 +44664 725 +8QAK3 134 +53A3A 945 +7QQJ7 164 +J8J89 236 +38QAT 166 +Q7944 755 +35333 526 +5J787 482 +4K769 829 +37773 960 +QJ78K 282 +3J39Q 326 +TJ2QQ 255 +J4338 337 +QK3KK 187 +5K8KQ 380 +93785 500 +795JT 382 +Q399Q 391 +99J99 206 +T5555 716 +Q7Q8Q 990 +QQJJQ 346 +34344 332 +K4J44 763 +2A36T 974 +77757 461 +55446 907 +99JJ9 962 +K29KQ 177 +99666 961 +688KK 249 +5A558 767 +TT6K2 630 +5Q4A4 872 +JTKQ4 969 +A5AAA 421 +JAA4Q 680 +55K69 29 +96ATJ 144 +3Q462 523 +73646 203 +5A96A 550 +K84TQ 4 +7278T 406 +KQQT5 395 +54567 197 +T53TA 355 +AQA99 601 +88KQQ 968 +55J5J 727 +73TJ9 466 +99799 843 +324QQ 36 +84AAA 190 +7J366 511 +JK938 667 +KKQJQ 762 +722J4 110 +9TKT9 84 +33JJ3 458 +6K444 498 +4279T 23 +K5T28 467 +3KKKK 871 +KQAQK 492 +44AKK 865 +5638T 932 +A89AK 24 +29K92 403 +A69K6 596 +KKK84 400 +QA748 616 +55AAA 504 +9255Q 684 +56646 330 +6J6J7 222 +A59J5 370 +3AA4J 940 +K9K38 302 +2AK58 735 +68K4K 422 +95599 324 +8K88J 987 +845Q5 478 +72KQ7 263 +8TJ83 751 +96TTQ 935 +AQ6AQ 445 +QKQQA 321 +A5644 769 +QQ5QJ 801 +AA574 436 +333QQ 605 +J5982 71 +QT8A5 956 +2Q46A 982 +J3773 317 +3KK93 485 +3A76A 926 +338JJ 502 +8KAQ6 737 +KKK28 520 +644Q5 850 +2T6TT 397 +34JA7 549 +743J7 747 +34843 103 +6KKKK 204 +Q2J22 548 +JKKKK 995 +42446 704 +8732A 238 +TT9J2 109 +4758T 33 +TTTT7 914 +787J7 647 +59T59 62 +9Q989 985 +T886J 554 +543QJ 75 +77637 857 +8888T 83 +92T52 939 +9832A 620 +3TT39 81 +84353 18 +A8Q8A 824 +T4597 425 +K3635 949 +KAAA2 320 +42224 243 +AA8A3 565 +KK63K 114 +TT3TT 133 +33T77 141 +J868J 774 +422QT 369 +24T2K 344 +KK3Q3 8 +424J2 967 +8J6J6 666 +K6927 887 +36666 366 +78KT8 867 +AT66T 761 +72AT6 155 +2Q6QQ 440 +64J64 594 +A2JT8 578 +QQAJQ 383 +8Q333 963 +9A22A 503 +K86K6 55 +66899 899 +4744J 210 +72K54 860 +KQKK4 723 +6TK62 607 +9J955 652 +A45A5 766 +4J333 744 +5K555 277 +7777J 657 +7853A 147 +75QQQ 356 +T6T93 818 +8T342 643 +498A7 232 +96A2A 471 +J55KK 583 +KJ7Q6 849 +36A36 707 +23655 290 +K444K 371 +5858K 688 +KJK8J 258 +Q3699 910 +79T64 864 +KAQ44 536 +T4TJ5 239 +8KK88 589 +42AA4 127 +QQ4Q4 746 +J9868 472 +95493 170 +JK6T5 428 +KAATA 775 +TK3KT 886 +36633 858 +67767 590 +86A2Q 175 +J7J7J 659 +7J457 796 +55335 65 +9288A 664 +88899 499 +7TKTA 327 +6QJ36 701 +K7KQK 943 +QQAQ2 681 +Q9948 444 +85923 335 +82832 283 +TQ5QT 92 +TK8A3 191 +A957K 614 +8877T 623 +5JTT9 253 +2K626 248 +757Q7 817 +JJ6T5 827 +KJ796 367 +895AQ 608 +AA666 950 +TT4T2 135 +QQQKK 600 +A9KK9 925 +49AA7 972 +73TAT 60 +5K49Q 74 +AAJ6A 753 +42222 470 +J99KK 722 +A9AA9 514 +36636 581 +7T5Q9 690 +TTK7K 496 +277J4 665 +782TQ 662 +3AK57 734 +29KJ7 343 +72726 378 +67656 541 +22A29 229 +JJ5AA 336 +QTTJQ 979 +J73K6 473 +55AK9 19 +46466 610 +8AAK4 408 +27227 181 +55525 214 +444Q4 505 +65K55 506 +KJ84T 529 +82225 250 +59TKA 32 +83J53 178 +599K4 988 +55TTT 759 +59999 431 +T44A4 828 +A888T 874 +J3533 619 +9979K 981 +KK998 101 +64965 799 +9A999 934 +9A299 942 +5KKKA 862 +4A865 802 +64QQ4 837 +ATATA 98 +6TJQ7 807 +K6997 585 +57T5T 457 +JT66T 938 +JJQK9 105 +JJ278 804 +JJ5AQ 661 +Q2597 930 +AAQAQ 31 +5A974 427 +TTQQK 868 +7KT7T 730 +K4999 112 +A8KAQ 672 +6AQQ6 447 +32J32 297 +4QA2J 915 +T2Q3Q 712 +34KQT 121 +98379 617 +487QK 44 +55TAJ 909 +6686T 28 +22922 805 +T846A 556 +J5A6A 399 +55Q55 347 +8488J 593 +JKKTT 708 +8288J 768 +JKK66 1 +22999 586 +85398 334 +77KK6 782 +K34JJ 674 +39K4K 653 +QA6K3 720 +78878 715 +QA9Q4 745 +3333J 226 +3TT32 686 +44999 401 +A2J32 531 +Q65A9 905 +J6AA7 194 +8J888 163 +7JT74 624 +JKKAK 568 +239J2 919 +AA4AA 52 +222JJ 184 +546AQ 894 +K2KK9 631 +45TQ2 375 +TTTT2 146 +26Q77 989 +9866K 851 +T3332 292 +66469 758 +48J48 889 +4A4QA 185 +J6626 68 +46T4A 660 +83T52 151 +7T7T7 407 +73758 479 +63A44 291 +66QT6 875 +6645J 738 +94Q97 638 +T5KT5 411 +TJ3J3 866 +QT6TQ 842 +A448A 433 +556JJ 533 +T3TKT 161 +6JT43 265 +T5TTT 393 +K7KK4 386 +53J6A 845 +K7777 756 +63399 685 +J85AQ 87 +88585 906 +QJTQQ 270 +TKKTK 131 +3J3JQ 797 +K7Q34 836 +K4499 362 +53555 651 +9888T 435 +2J299 557 +8J999 964 +96TQ2 293 +8KTJ8 137 +KA6Q7 442 +2J6KQ 900 +446A4 294 +AJAA3 671 +Q427T 116 +9JQ99 398 +59929 392 +822J8 192 +Q92Q7 420 +KKJK6 171 +TAJ37 487 +8A2J5 10 +22TTT 220 +33623 111 +7Q7AJ 491 +A3JJ2 650 +J4J23 299 +396KA 896 +K3K3J 486 +QKKKK 20 +9A2AJ 713 +746K4 56 +96996 885 +JTK77 312 +Q8888 826 +3T4AJ 771 +97977 219 +9354K 788 +5Q5KK 455 +T3734 325 +TK26A 156 +7AAAA 924 +KJ622 183 +5QTAQ 642 +AAAAQ 488 +TTTJT 953 +Q2222 145 +4A9TJ 245 +TT3JK 588 +J5555 284 +94AQT 193 +97325 196 +74A8J 37 +24AAA 847 +22A32 381 +4KJ59 542 +T6QK4 673 +77877 922 +Q2Q66 49 +66688 792 +9T9T9 918 +J8878 552 +6A63A 221 +AA559 780 +9T47Q 300 +AKKA4 501 +33QQ4 64 +6K375 965 +T7Q43 82 +3689Q 569 +A6A3A 462 +T5Q3J 689 +49Q99 895 +KA262 490 +87497 13 +4449A 973 +92453 430 +5QA5A 149 +69666 247 +K6AJA 992 +A4444 729 +44494 298 +J5993 927 +26662 555 +4J6A5 613 +KK77K 855 +73222 315 +2A2J2 719 +K7KT7 43 +98T64 998 +23282 528 +449T7 130 +6QK24 424 +AAAA3 179 +JA42K 53 +6A6KK 211 +J55JJ 742 +J5T93 304 +TQA23 358 +8J257 240 +39393 522 +68A38 450 +QQAK8 970 +J77QT 341 +T68AA 242 +99933 310 +425KA 69 +99A9J 535 +J35JK 113 +4A37T 360 +63333 791 +78J5T 34 +46T46 883 +T8JQ3 50 +KKKK5 519 +T29J8 640 +KKK88 646 +3A32A 228 +7A77T 57 +2QQ2J 971 +7Q777 438 +5J545 21 +T4AAJ 432 +QQJAA 570 +KJ79J 853 +T3JKA 359 +676K6 724 +4TATT 931 +JKKT2 629 +J338T 469 +9939J 743 +85A93 241 +945TA 363 +5JK5A 493 +Q5JT5 815 +76378 12 +T3T53 157 +JAA24 732 +55757 200 +K727J 115 +259KK 510 +2J739 786 +288AA 598 +QJ233 100 +QQ56Q 25 +6333J 702 +86797 839 +47T77 361 +K4823 3 +6K446 54 +94J75 543 +QQQQA 980 +55J66 923 +AQT55 645 +55593 314 +J6776 379 +J23T6 102 +7K7K7 911 +JQ5A3 227 +KK66K 279 +AJJAQ 396 +JA252 39 +555KK 714 +KJ56K 637 +KJ64K 928 +6Q66Q 85 +TJTT2 273 +K634J 854 +66662 576 +6Q6J6 212 +KAAT2 696 +76663 793 +T3AQ3 632 +2J994 966 +TTTJA 63 +4QJQ4 165 +AAAJ8 331 +TT666 158 +2KKA2 453 +54444 563 +7KK88 675 +47777 832 +6JJQ9 475 +55275 876 +63489 794 +7K7Q3 208 +6J585 820 +3Q89T 524 +92AK2 6 +66JK9 655 +7J4KQ 139 +666A5 711 +4JTK9 117 +88AJA 368 +34T5T 602 +9933J 278 +97Q63 448 +A5555 892 +QJ7A2 726 +5KKJ2 917 +A5238 108 +33343 663 +K33T3 285 +6Q655 937 +38383 880 +47834 252 +QJA49 692 +A6926 547 +48Q8Q 288 +72J86 107 +5T5T9 449 +2JK25 305 +667T6 136 +7JJ88 429 +Q5KQK 394 +ATAAA 952 +66949 296 +TT222 933 +AQ4AK 948 +KQJJ7 209 +3465K 709 +74775 126 +8TJ6T 402 +82Q3J 816 +Q7855 354 +JJ3KK 9 +22223 351 +2K7TA 831 +555AA 984 +83539 168 +444T4 140 +4A8Q4 693 +JA8AK 890 +29QTQ 308 +KJKKJ 389 +A86AK 649 +J898T 14 +A6AAA 352 +2J222 176 +A4669 958 +333K8 635 +T4269 844 +J4Q54 603 +44AAA 349 +QT575 413 +AA2J2 859 +7T395 648 +K3Q68 251 +7T2T2 790 +QQQ33 446 +428A4 879 +36J2Q 434 +69955 991 +7J5A4 812 +QQ445 789 +7A69A 93 +4K979 537 +K6K73 518 +45555 79 +45A6A 833 +KAAA5 307 +48887 80 +KK2KK 38 +ATJJ5 11 +5K325 388 +42TJA 353 +66J3T 611 +A758A 728 +TJT77 644 +5JQQ2 898 +9KQT2 404 +K42A2 303 +Q6QTA 124 +58Q5J 670 +K6JTJ 409 +T3333 731 +J73JK 463 +4A288 452 +79AAJ 41 +2K7T7 15 +7AAA7 888 +44J94 286 +8938K 328 +TKKKA 633 +22JT7 577 +QQQQ7 683 +66665 89 +T72J4 955 +J66J6 877 +99433 509 +9K92J 776 +JQ7Q2 78 +A6T2Q 122 +69Q6A 153 +J5JQ5 218 +25KAJ 416 +7A47A 513 +62T26 1000 +96449 281 +KKTKK 977 +35642 921 +9K4K9 778 +J4244 993 +JJAAA 573 +7AA27 626 +A685T 376 +4JA9A 957 +T886T 267 +737J7 538 +999KK 579 +75KK7 76 +Q737Q 809 +Q3393 901 +2734Q 754 +J2T9K 216 +89859 695 +63343 35 +7JK7K 700 +8828A 765 +29AT5 615 +Q838Q 410 +A3235 622 +TKJKQ 810 +45454 224 +77737 869 +JA9T9 333 +2772K 276 +5535A 350 +TT5QT 821 +46JKJ 986 +9T8KK 125 +6JAJ7 595 +74647 464 +499A4 612 +4KT7A 22 +J3233 891 +44555 959 +8KQ8A 271 +33443 182 +37373 27 +88828 997 +Q2Q22 189 +3635A 373 +T66TT 717 +A4469 207 +2T2KT 749 +4244Q 90 +9234T 348 +33TJ3 289 +QAA63 562 +2A2A2 199 +J6JK7 929 +TT99J 234 +T3JQ2 798 +65Q66 154 +JTTJT 975 +22699 705 +Q6Q6Q 618 +99929 811 +389J6 920 +585Q5 852 +A2255 477 +TJTJJ 30 +K5AK5 772 +2QQ3Q 323 +6888J 454 +7J8K3 609 +J463J 572 +32323 223 +686J6 534 +Q25J4 47 +29996 882 +TTQ8Q 944 +42265 480 +2JQ96 287 +QQ868 517 +AK447 994 +8J3Q3 897 +42QK5 489 +A8A88 384 +3AT3A 941 +44T8T 88 +QQ8QQ 787 +488TJ 996 +6KK66 313 +2J262 764 +K6KK5 275 +K572T 893 +7T7QQ 215 +76965 773 +59575 800 +586QJ 309 +QQQQ4 721 +9A9A4 40 +8JJJJ 128 +QATA6 162 +K6TAQ 415 +95JJ8 72 +9TQ97 319 +2AK22 61 +T2TJ2 465 +T5274 195 +Q4587 266 +J97QT 441 +52384 17 +Q7J77 414 +QQQ6Q 903 +4444J 532 +QQKQQ 904 +QJ467 16 +25525 785 +ATA8A 205 +65542 261 +9QKKK 512 +48844 231 +JTJAK 99 +QJ8AT 571 +68A88 878 +5353J 94 +2Q33Q 311 +KJJ69 946 +J83A8 634 +QQT6Q 884 +KK74J 374 +77474 781 +38888 527 +29457 329 +52452 73 +2K776 256 +QJQQQ 268 +J24K6 913 +42K88 861 +29QQQ 733 +4J546 806 +K2K98 841 +Q4644 697 +44K94 834 +QAAQT 830 +J666T 750 +3T335 437 +9594T 694 +8QQQ3 682 +88887 269 +J3KKQ 641 +99993 551 +2K437 699 +75775 710 +5963J 870 +TTKT5 582 +2Q82A 439 +KJ4Q9 301 +Q3558 152 +32333 999 +T77TT 599 +3T6JT 627 +2J3T5 560 +25442 86 +8888K 257 +5QJ45 96 +QQ7AA 658 +88JJ8 863 +98948 202 +2QJ3J 803 +J6488 66 +59559 160 +JJKK7 484 +7J223 254 +68889 364 +555J9 822 +KKAAA 525 +K7557 5 +3Q33A 814 +2384J 587 +KK8Q2 777 +494K2 426 +2TJ22 507 +QQQ2Q 698 +7229T 954 +JJ757 142 +2882A 530 +KKTQT 539 +72222 621 +99A5A 736 +22887 936 +3377Q 779 +6A6J6 740 +A7AAJ 840 +44JJ4 2 +QQTQT 51 +6666A 669 +T9279 908 +K9J7Q 856 +2AAAJ 748 +J3K25 947 +TT65T 377 +KK2K6 752 +K7KKK 150 +9J6J8 120 +72AK6 656 +TT6TT 757 +QQ9TT 412 +3AA3J 365 +84477 783 +KK4K2 591 +AK79J 654 +J77J7 951 +Q7664 606 +7QQ59 59 +J2725 795 +96989 417 +7TT64 387 +47JJK 91 +228AA 201 +AJJ63 902 +A5AKJ 123 +37Q33 741 +8J358 483 +Q88QQ 508 +43A33 340 +Q9QQQ 516 +232JT 148 +666J6 159 +38363 97 +42285 322 +4Q944 233 +TT4TT 342 +K8TQA 566 +KJKK2 213 +QJQJJ 339 +5K932 559 +86888 494 +2QQJQ 70 +7A772 167 +5659T 881 +T43A6 186 +A2Q22 739 +55K95 679 +2T5QQ 262 +47797 419 +52522 357 +2J734 597 +AA3Q3 678 +3Q9A3 567 +KJAAJ 813 +K8794 495 +7JT77 198 +4KT2A 564 +55QQ5 497 +5K558 272 +T2A25 318 +K58Q2 825 +7KKJK 628 +6A6A7 676 +J7T96 706 +A4A96 625 +6KTQ7 372 +JAAJ3 916 +99699 106 +Q7Q77 468 +8Q88J 545 +2A2J8 983 +777A7 246 +329TA 546 +38388 48 +KKKQQ 316 +KKKK8 460 +33K8Q 77 +A9A29 691 +8J859 237 +A9599 540 +23J67 390 +JT43J 668 +8J8JQ 338 +JQQQ8 456 +K9KKK 129 +8KJ8K 67 +7555Q 169 +9QJQ9 459 +7A8Q9 718 +7J765 760 +94744 173 +AA35A 264 +QKQQ5 423 +A6JJ9 819 +4AA44 848 +88385 180 +A4T7Q 259 +7J757 584 +A96T3 474 +JJJJJ 42 +9K372 604 +J333Q 118 +J7A37 451 +Q4447 515 +QQ77Q 274 +73333 553 +6747J 521 +J56K2 405 +KKJJQ 575 +QT86A 592 +75A73 476 +29925 295 +A778A 823 +AAAAJ 580 +TT99T 636 +QQ3JQ 235 +A8778 244 +K6638 784 +87Q5A 574 +99499 46 +AK7Q7 172 +KKK33 443 +38J88 345 +7976K 58 +59669 558 +6659J 217 +7557J 143 +5549K 306 +J3982 639 +J249A 677 +55955 418 +QQQQT 7 +77A47 770 +66K4K 104 +Q9T5A 976 +2673Q 230 +Q75TK 26 +JKJ9K 225 +9TAAT 188 +55JQA 119 +9Q9Q9 385 +24K42 260 +T9222 873 +99989 45 +88448 544 +T9784 808 +43454 846 +TA674 174 +3T3AT 687 +38929 561 +22QQK 912 +KQJQQ 978 +23223 481 +J7772 835 +3999Q 703 +74K44 280 +4K444 138 +KJ53K 132 \ No newline at end of file diff --git a/2023/Day07/solution.cs b/2023/Day07/solution.cs new file mode 100644 index 0000000..1249c57 --- /dev/null +++ b/2023/Day07/solution.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using adventofcode; + +namespace aoc2023; + + +class solutionDay07 : ISolver +{ + public void SolvePart1() + { + Console.WriteLine($"part 1"); + + solutionBase sb = new(); + var input = sb.getInputLines(@"2023/Day07/test"); + //var input = sb.getInputLines(@"2023/Day07/input").ToArray(); + + List cards = new(); + + for (int i = 0; i < input.Count; i++) + { + var original = input[i].Split(' ')[0]; + var bid = Convert.ToInt32(input[i].Split(' ')[1]); + + //Console.WriteLine($"{original} - {bid}"); + CamelCard card = new CamelCard(original, bid); + + cards.Add(card); + } + + foreach (var item in cards) + { + Console.WriteLine(item); + } + + } + + public void SolvePart2() + { + Console.WriteLine($"part 2 under development"); + } + + class CamelCard(string original, int bid) + { + public string Original { get; } = original; + public int Bid { get; } = bid; + + public string Sorted() + { + var charArray = Original.ToCharArray(); + Array.Sort(charArray); + string sortedString = new string(charArray).ToString(); + return sortedString; + } + + public override string ToString() + { + return $"CamelCard: {Original}, Bid: {Bid}, Sorted: {Sorted}"; + } + } +} \ No newline at end of file diff --git a/2023/Day07/test b/2023/Day07/test new file mode 100644 index 0000000..bf2815e --- /dev/null +++ b/2023/Day07/test @@ -0,0 +1,5 @@ +32T3K 765 +T55J5 684 +KK677 28 +KTJJT 220 +QQQJA 483 \ No newline at end of file diff --git a/README.md b/README.md index 0fa79e6..6cbef11 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ using c# with .NET 7 - day04 :star: :star: - day05 - day06 :star: :star: +- day07 # overview 2022 - day01 :star: :star: From 0c80284edd9efa09981410f58eb093b776cc8511 Mon Sep 17 00:00:00 2001 From: deckelmouck Date: Thu, 7 Dec 2023 12:13:25 +0000 Subject: [PATCH 02/14] more prep for day07 --- 2023/Day07/solution.cs | 54 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 44 insertions(+), 10 deletions(-) diff --git a/2023/Day07/solution.cs b/2023/Day07/solution.cs index 1249c57..f7f23c3 100644 --- a/2023/Day07/solution.cs +++ b/2023/Day07/solution.cs @@ -1,12 +1,17 @@ using System; +using System.Linq; +using System.Collections; using System.Collections.Generic; using adventofcode; + namespace aoc2023; class solutionDay07 : ISolver { + string[] strength = new string[] {"A", "K", "Q", "J", "T", "9", "8", "7", "6", "5", "4", "3", "2"}; + public void SolvePart1() { Console.WriteLine($"part 1"); @@ -27,8 +32,8 @@ public void SolvePart1() cards.Add(card); } - - foreach (var item in cards) + + foreach (var item in cards.OrderBy(c => c.Handtype()).ThenBy(c => c.Bid)) { Console.WriteLine(item); } @@ -44,18 +49,47 @@ class CamelCard(string original, int bid) { public string Original { get; } = original; public int Bid { get; } = bid; - - public string Sorted() + public int Handtype() { - var charArray = Original.ToCharArray(); - Array.Sort(charArray); - string sortedString = new string(charArray).ToString(); - return sortedString; + var count = Original.Distinct().Count(); + + switch (count) + { + case 1: + //Five of a kind + return 0; + case 2: + //Four of a kind or Full House + if(Original.GroupBy(c => c).Any(group => group.Count() == 4)) + { + return 1; + } + else + { + return 2; + } + case 3: + //three of a kind or two pair + if(Original.GroupBy(c => c).Any(group => group.Count() == 3)) + { + return 3; + } + else + { + return 4; + } + case 4: + //one pair + return 5; + default: + //high card + return 6; + } } public override string ToString() { - return $"CamelCard: {Original}, Bid: {Bid}, Sorted: {Sorted}"; + return $"{Original} - {Bid} - Type: {Handtype()}"; } - } + } } \ No newline at end of file From c59f4b8f1fc57a3aad9238876b4c0d6a30e6714d Mon Sep 17 00:00:00 2001 From: deckelmouck Date: Thu, 7 Dec 2023 12:44:16 +0000 Subject: [PATCH 03/14] try to order hands --- 2023/Day07/solution.cs | 98 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 95 insertions(+), 3 deletions(-) diff --git a/2023/Day07/solution.cs b/2023/Day07/solution.cs index f7f23c3..625418f 100644 --- a/2023/Day07/solution.cs +++ b/2023/Day07/solution.cs @@ -10,7 +10,7 @@ namespace aoc2023; class solutionDay07 : ISolver { - string[] strength = new string[] {"A", "K", "Q", "J", "T", "9", "8", "7", "6", "5", "4", "3", "2"}; + //string[] strength = new string[] {"A", "K", "Q", "J", "T", "9", "8", "7", "6", "5", "4", "3", "2"}; public void SolvePart1() { @@ -33,11 +33,18 @@ public void SolvePart1() cards.Add(card); } - foreach (var item in cards.OrderBy(c => c.Handtype()).ThenBy(c => c.Bid)) + long total = 0; + long rank = 1; + + foreach (var item in cards.OrderByDescending(c => c.Handtype()).ThenByDescending(c => c.CompareHandStrenght(c.Original, c.Original))) { Console.WriteLine(item); - } + total += item.Bid * rank; + Console.WriteLine($"{item.Bid} * {rank}"); + rank++; + } + Console.WriteLine($"Total: {total}"); } public void SolvePart2() @@ -91,5 +98,90 @@ public override string ToString() { return $"{Original} - {Bid} - Type: {Handtype()}"; } + + public int CompareHandStrenght(string hand1, string hand2) + { + //string[] strength = new string[] {"A", "K", "Q", "J", "T", "9", "8", "7", "6", "5", "4", "3", "2"}; + //char[] strength = new char[] {'A', 'K', 'Q', 'J', 'T', '9', '8', '7', '6', '5', '4', '3', '2'}; + + char[] strength = new char[] {'2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K', 'A'}; + + int pos = 0; + var hand1Strength = strength.ToList().IndexOf(hand1[pos]); + var hand2Strength = strength.ToList().IndexOf(hand2[pos]); + + if(hand1Strength > hand2Strength) + { + return 1; + } + else if(hand1Strength < hand2Strength) + { + return -1; + } + else + { + pos++; + hand1Strength = strength.ToList().IndexOf(hand1[pos]); + hand2Strength = strength.ToList().IndexOf(hand2[pos]); + + if(hand1Strength > hand2Strength) + { + return 1; + } + else if(hand1Strength < hand2Strength) + { + return -1; + } + else + { + pos++; + hand1Strength = strength.ToList().IndexOf(hand1[pos]); + hand2Strength = strength.ToList().IndexOf(hand2[pos]); + + if(hand1Strength > hand2Strength) + { + return 1; + } + else if(hand1Strength < hand2Strength) + { + return -1; + } + else + { + pos++; + hand1Strength = strength.ToList().IndexOf(hand1[pos]); + hand2Strength = strength.ToList().IndexOf(hand2[pos]); + + if(hand1Strength > hand2Strength) + { + return 1; + } + else if(hand1Strength < hand2Strength) + { + return -1; + } + else + { + pos++; + hand1Strength = strength.ToList().IndexOf(hand1[pos]); + hand2Strength = strength.ToList().IndexOf(hand2[pos]); + + if(hand1Strength > hand2Strength) + { + return 1; + } + else if(hand1Strength < hand2Strength) + { + return -1; + } + else + { + return 0; + } + } + } + } + } + } } } \ No newline at end of file From 24eb674ec46aaaa5b83847c7d6d3beb87bc75fc2 Mon Sep 17 00:00:00 2001 From: deckelmouck Date: Thu, 7 Dec 2023 14:40:41 +0000 Subject: [PATCH 04/14] solve 2023 day07 part 1 --- 2023/Day07/solution.cs | 90 +++--------------------------------------- 1 file changed, 6 insertions(+), 84 deletions(-) diff --git a/2023/Day07/solution.cs b/2023/Day07/solution.cs index 625418f..30d7345 100644 --- a/2023/Day07/solution.cs +++ b/2023/Day07/solution.cs @@ -17,8 +17,8 @@ public void SolvePart1() Console.WriteLine($"part 1"); solutionBase sb = new(); - var input = sb.getInputLines(@"2023/Day07/test"); - //var input = sb.getInputLines(@"2023/Day07/input").ToArray(); + //var input = sb.getInputLines(@"2023/Day07/test"); + var input = sb.getInputLines(@"2023/Day07/input"); List cards = new(); @@ -36,7 +36,7 @@ public void SolvePart1() long total = 0; long rank = 1; - foreach (var item in cards.OrderByDescending(c => c.Handtype()).ThenByDescending(c => c.CompareHandStrenght(c.Original, c.Original))) + foreach (var item in cards.OrderByDescending(c => c.Handtype()).ThenBy(c => c.Strength(0)).ThenBy(c => c.Strength(1)).ThenBy(c => c.Strength(2)).ThenBy(c => c.Strength(3)).ThenBy(c => c.Strength(4))) { Console.WriteLine(item); total += item.Bid * rank; @@ -50,6 +50,7 @@ public void SolvePart1() public void SolvePart2() { Console.WriteLine($"part 2 under development"); + } class CamelCard(string original, int bid) @@ -99,89 +100,10 @@ public override string ToString() return $"{Original} - {Bid} - Type: {Handtype()}"; } - public int CompareHandStrenght(string hand1, string hand2) + public int Strength(int pos) { - //string[] strength = new string[] {"A", "K", "Q", "J", "T", "9", "8", "7", "6", "5", "4", "3", "2"}; - //char[] strength = new char[] {'A', 'K', 'Q', 'J', 'T', '9', '8', '7', '6', '5', '4', '3', '2'}; - char[] strength = new char[] {'2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K', 'A'}; - - int pos = 0; - var hand1Strength = strength.ToList().IndexOf(hand1[pos]); - var hand2Strength = strength.ToList().IndexOf(hand2[pos]); - - if(hand1Strength > hand2Strength) - { - return 1; - } - else if(hand1Strength < hand2Strength) - { - return -1; - } - else - { - pos++; - hand1Strength = strength.ToList().IndexOf(hand1[pos]); - hand2Strength = strength.ToList().IndexOf(hand2[pos]); - - if(hand1Strength > hand2Strength) - { - return 1; - } - else if(hand1Strength < hand2Strength) - { - return -1; - } - else - { - pos++; - hand1Strength = strength.ToList().IndexOf(hand1[pos]); - hand2Strength = strength.ToList().IndexOf(hand2[pos]); - - if(hand1Strength > hand2Strength) - { - return 1; - } - else if(hand1Strength < hand2Strength) - { - return -1; - } - else - { - pos++; - hand1Strength = strength.ToList().IndexOf(hand1[pos]); - hand2Strength = strength.ToList().IndexOf(hand2[pos]); - - if(hand1Strength > hand2Strength) - { - return 1; - } - else if(hand1Strength < hand2Strength) - { - return -1; - } - else - { - pos++; - hand1Strength = strength.ToList().IndexOf(hand1[pos]); - hand2Strength = strength.ToList().IndexOf(hand2[pos]); - - if(hand1Strength > hand2Strength) - { - return 1; - } - else if(hand1Strength < hand2Strength) - { - return -1; - } - else - { - return 0; - } - } - } - } - } + return strength.ToList().IndexOf(Original[pos]); } } } \ No newline at end of file From d283b86a3de9d2febfc0dfde03cac9f12beafb31 Mon Sep 17 00:00:00 2001 From: deckelmouck Date: Thu, 7 Dec 2023 19:24:54 +0100 Subject: [PATCH 05/14] testing stuff --- 2023/Day07/output | 1000 ++++++++++++++++++++++++++++++++++++++++ 2023/Day07/solution.cs | 19 +- 2 files changed, 1013 insertions(+), 6 deletions(-) create mode 100644 2023/Day07/output diff --git a/2023/Day07/output b/2023/Day07/output new file mode 100644 index 0000000..4d16c35 --- /dev/null +++ b/2023/Day07/output @@ -0,0 +1,1000 @@ +2384J - 587 - Type: 6 - 1 +23J67 - 390 - Type: 6 - 2 +25KAJ - 416 - Type: 6 - 3 +2673Q - 230 - Type: 6 - 4 +2734Q - 754 - Type: 6 - 5 +29457 - 329 - Type: 6 - 6 +29KJ7 - 343 - Type: 6 - 7 +29AT5 - 615 - Type: 6 - 8 +2J3T5 - 560 - Type: 6 - 9 +2J6KQ - 900 - Type: 6 - 10 +2J734 - 597 - Type: 6 - 11 +2J739 - 786 - Type: 6 - 12 +2JQ96 - 287 - Type: 6 - 13 +2Q46A - 982 - Type: 6 - 14 +2K437 - 699 - Type: 6 - 15 +2K7TA - 831 - Type: 6 - 16 +2A36T - 974 - Type: 6 - 17 +2AK58 - 735 - Type: 6 - 18 +329TA - 546 - Type: 6 - 19 +3465K - 709 - Type: 6 - 20 +34JA7 - 549 - Type: 6 - 21 +34KQT - 121 - Type: 6 - 22 +35642 - 921 - Type: 6 - 23 +3689Q - 569 - Type: 6 - 24 +36J2Q - 434 - Type: 6 - 25 +389J6 - 920 - Type: 6 - 26 +38QAT - 166 - Type: 6 - 27 +396KA - 896 - Type: 6 - 28 +3T4AJ - 771 - Type: 6 - 29 +3Q462 - 523 - Type: 6 - 30 +3Q89T - 524 - Type: 6 - 31 +3AK57 - 734 - Type: 6 - 32 +425KA - 69 - Type: 6 - 33 +4279T - 23 - Type: 6 - 34 +42TJA - 353 - Type: 6 - 35 +42QK5 - 489 - Type: 6 - 36 +45TQ2 - 375 - Type: 6 - 37 +467K3 - 95 - Type: 6 - 38 +4758T - 33 - Type: 6 - 39 +487QK - 44 - Type: 6 - 40 +498A7 - 232 - Type: 6 - 41 +4J6A5 - 613 - Type: 6 - 42 +4JTK9 - 117 - Type: 6 - 43 +4QA2J - 915 - Type: 6 - 44 +4K769 - 829 - Type: 6 - 45 +4KT2A - 564 - Type: 6 - 46 +4KT7A - 22 - Type: 6 - 47 +4KJ59 - 542 - Type: 6 - 48 +4A37T - 360 - Type: 6 - 49 +4A865 - 802 - Type: 6 - 50 +4A9TJ - 245 - Type: 6 - 51 +52384 - 17 - Type: 6 - 52 +53J6A - 845 - Type: 6 - 53 +543QJ - 75 - Type: 6 - 54 +546AQ - 894 - Type: 6 - 55 +5638T - 932 - Type: 6 - 56 +586QJ - 309 - Type: 6 - 57 +5963J - 870 - Type: 6 - 58 +59TKA - 32 - Type: 6 - 59 +5K49Q - 74 - Type: 6 - 60 +5K932 - 559 - Type: 6 - 61 +5A974 - 427 - Type: 6 - 62 +63489 - 794 - Type: 6 - 63 +6TJQ7 - 807 - Type: 6 - 64 +6JT43 - 265 - Type: 6 - 65 +6QK24 - 424 - Type: 6 - 66 +6K375 - 965 - Type: 6 - 67 +6KTQ7 - 372 - Type: 6 - 68 +72J86 - 107 - Type: 6 - 69 +72K54 - 860 - Type: 6 - 70 +72AT6 - 155 - Type: 6 - 71 +72AK6 - 656 - Type: 6 - 72 +73TJ9 - 466 - Type: 6 - 73 +74A8J - 37 - Type: 6 - 74 +782TQ - 662 - Type: 6 - 75 +7853A - 147 - Type: 6 - 76 +78J5T - 34 - Type: 6 - 77 +795JT - 382 - Type: 6 - 78 +79T64 - 864 - Type: 6 - 79 +7T395 - 648 - Type: 6 - 80 +7T5Q9 - 690 - Type: 6 - 81 +7J4KQ - 139 - Type: 6 - 82 +7J5A4 - 812 - Type: 6 - 83 +7J8K3 - 609 - Type: 6 - 84 +7A8Q9 - 718 - Type: 6 - 85 +82Q3J - 816 - Type: 6 - 86 +83T52 - 151 - Type: 6 - 87 +85923 - 335 - Type: 6 - 88 +85A93 - 241 - Type: 6 - 89 +86A2Q - 175 - Type: 6 - 90 +8732A - 238 - Type: 6 - 91 +87Q5A - 574 - Type: 6 - 92 +895AQ - 608 - Type: 6 - 93 +8T342 - 643 - Type: 6 - 94 +8J257 - 240 - Type: 6 - 95 +8QAK3 - 134 - Type: 6 - 96 +8KAQ6 - 737 - Type: 6 - 97 +8A2J5 - 10 - Type: 6 - 98 +9234T - 348 - Type: 6 - 99 +92453 - 430 - Type: 6 - 100 +9354K - 788 - Type: 6 - 101 +93785 - 500 - Type: 6 - 102 +945TA - 363 - Type: 6 - 103 +94J75 - 543 - Type: 6 - 104 +94AQT - 193 - Type: 6 - 105 +96TQ2 - 293 - Type: 6 - 106 +96ATJ - 144 - Type: 6 - 107 +97325 - 196 - Type: 6 - 108 +97Q63 - 448 - Type: 6 - 109 +9832A - 620 - Type: 6 - 110 +98T64 - 998 - Type: 6 - 111 +9T47Q - 300 - Type: 6 - 112 +9K372 - 604 - Type: 6 - 113 +9KQT2 - 404 - Type: 6 - 114 +T29J8 - 640 - Type: 6 - 115 +T3JQ2 - 798 - Type: 6 - 116 +T3JKA - 359 - Type: 6 - 117 +T4269 - 844 - Type: 6 - 118 +T43A6 - 186 - Type: 6 - 119 +T4597 - 425 - Type: 6 - 120 +T5274 - 195 - Type: 6 - 121 +T5Q3J - 689 - Type: 6 - 122 +T6QK4 - 673 - Type: 6 - 123 +T72J4 - 955 - Type: 6 - 124 +T7Q43 - 82 - Type: 6 - 125 +T846A - 556 - Type: 6 - 126 +T8JQ3 - 50 - Type: 6 - 127 +T9784 - 808 - Type: 6 - 128 +TQA23 - 358 - Type: 6 - 129 +TK26A - 156 - Type: 6 - 130 +TK8A3 - 191 - Type: 6 - 131 +TA674 - 174 - Type: 6 - 132 +TAJ37 - 487 - Type: 6 - 133 +J23T6 - 102 - Type: 6 - 134 +J249A - 677 - Type: 6 - 135 +J24K6 - 913 - Type: 6 - 136 +J2T9K - 216 - Type: 6 - 137 +J3982 - 639 - Type: 6 - 138 +J3K25 - 947 - Type: 6 - 139 +J56K2 - 405 - Type: 6 - 140 +J5982 - 71 - Type: 6 - 141 +J5T93 - 304 - Type: 6 - 142 +J73K6 - 473 - Type: 6 - 143 +J7T96 - 706 - Type: 6 - 144 +J85AQ - 87 - Type: 6 - 145 +J97QT - 441 - Type: 6 - 146 +JTKQ4 - 969 - Type: 6 - 147 +JQ5A3 - 227 - Type: 6 - 148 +JK6T5 - 428 - Type: 6 - 149 +JK938 - 667 - Type: 6 - 150 +JA42K - 53 - Type: 6 - 151 +Q2597 - 930 - Type: 6 - 152 +Q25J4 - 47 - Type: 6 - 153 +Q427T - 116 - Type: 6 - 154 +Q4587 - 266 - Type: 6 - 155 +Q65A9 - 905 - Type: 6 - 156 +Q75TK - 26 - Type: 6 - 157 +Q9T5A - 976 - Type: 6 - 158 +QT86A - 592 - Type: 6 - 159 +QT8A5 - 956 - Type: 6 - 160 +QJ467 - 16 - Type: 6 - 161 +QJ78K - 282 - Type: 6 - 162 +QJ7A2 - 726 - Type: 6 - 163 +QJ8AT - 571 - Type: 6 - 164 +QJA49 - 692 - Type: 6 - 165 +QA6K3 - 720 - Type: 6 - 166 +QA748 - 616 - Type: 6 - 167 +K3Q68 - 251 - Type: 6 - 168 +K4823 - 3 - Type: 6 - 169 +K572T - 893 - Type: 6 - 170 +K58Q2 - 825 - Type: 6 - 171 +K5T28 - 467 - Type: 6 - 172 +K634J - 854 - Type: 6 - 173 +K6927 - 887 - Type: 6 - 174 +K6TAQ - 415 - Type: 6 - 175 +K7Q34 - 836 - Type: 6 - 176 +K84TQ - 4 - Type: 6 - 177 +K8794 - 495 - Type: 6 - 178 +K8TQA - 566 - Type: 6 - 179 +K9J7Q - 856 - Type: 6 - 180 +KJ4Q9 - 301 - Type: 6 - 181 +KJ796 - 367 - Type: 6 - 182 +KJ7Q6 - 849 - Type: 6 - 183 +KJ84T - 529 - Type: 6 - 184 +KA6Q7 - 442 - Type: 6 - 185 +A2JT8 - 578 - Type: 6 - 186 +A4T7Q - 259 - Type: 6 - 187 +A5238 - 108 - Type: 6 - 188 +A685T - 376 - Type: 6 - 189 +A6T2Q - 122 - Type: 6 - 190 +A957K - 614 - Type: 6 - 191 +A96T3 - 474 - Type: 6 - 192 +AK79J - 654 - Type: 6 - 193 +22JT7 - 577 - Type: 5 - 194 +232JT - 148 - Type: 5 - 195 +23655 - 290 - Type: 5 - 196 +239J2 - 919 - Type: 5 - 197 +24T2K - 344 - Type: 5 - 198 +259KK - 510 - Type: 5 - 199 +26Q77 - 989 - Type: 5 - 200 +277J4 - 665 - Type: 5 - 201 +29QTQ - 308 - Type: 5 - 202 +2T5QQ - 262 - Type: 5 - 203 +2J994 - 966 - Type: 5 - 204 +2JK25 - 305 - Type: 5 - 205 +2Q82A - 439 - Type: 5 - 206 +2QJ3J - 803 - Type: 5 - 207 +2K776 - 256 - Type: 5 - 208 +2K7T7 - 15 - Type: 5 - 209 +2A2J8 - 983 - Type: 5 - 210 +324QQ - 36 - Type: 5 - 211 +33K8Q - 77 - Type: 5 - 212 +34T5T - 602 - Type: 5 - 213 +3635A - 373 - Type: 5 - 214 +38929 - 561 - Type: 5 - 215 +39K4K - 653 - Type: 5 - 216 +3T6JT - 627 - Type: 5 - 217 +3J39Q - 326 - Type: 5 - 218 +3Q9A3 - 567 - Type: 5 - 219 +3A76A - 926 - Type: 5 - 220 +3AA4J - 940 - Type: 5 - 221 +42265 - 480 - Type: 5 - 222 +42285 - 322 - Type: 5 - 223 +422QT - 369 - Type: 5 - 224 +428A4 - 879 - Type: 5 - 225 +42K88 - 861 - Type: 5 - 226 +449T7 - 130 - Type: 5 - 227 +45A6A - 833 - Type: 5 - 228 +46T4A - 660 - Type: 5 - 229 +46JKJ - 986 - Type: 5 - 230 +47834 - 252 - Type: 5 - 231 +47JJK - 91 - Type: 5 - 232 +488TJ - 996 - Type: 5 - 233 +494K2 - 426 - Type: 5 - 234 +49AA7 - 972 - Type: 5 - 235 +4J546 - 806 - Type: 5 - 236 +4JA9A - 957 - Type: 5 - 237 +4K979 - 537 - Type: 5 - 238 +4A288 - 452 - Type: 5 - 239 +4A8Q4 - 693 - Type: 5 - 240 +54567 - 197 - Type: 5 - 241 +5549K - 306 - Type: 5 - 242 +55TAJ - 909 - Type: 5 - 243 +55JQA - 119 - Type: 5 - 244 +55K69 - 29 - Type: 5 - 245 +55AK9 - 19 - Type: 5 - 246 +5659T - 881 - Type: 5 - 247 +58Q5J - 670 - Type: 5 - 248 +599K4 - 988 - Type: 5 - 249 +5J787 - 482 - Type: 5 - 250 +5JTT9 - 253 - Type: 5 - 251 +5JQQ2 - 898 - Type: 5 - 252 +5JK5A - 493 - Type: 5 - 253 +5Q4A4 - 872 - Type: 5 - 254 +5QTAQ - 642 - Type: 5 - 255 +5QJ45 - 96 - Type: 5 - 256 +5K325 - 388 - Type: 5 - 257 +5K8KQ - 380 - Type: 5 - 258 +5KKJ2 - 917 - Type: 5 - 259 +5A96A - 550 - Type: 5 - 260 +63A44 - 291 - Type: 5 - 261 +644Q5 - 850 - Type: 5 - 262 +64965 - 799 - Type: 5 - 263 +65542 - 261 - Type: 5 - 264 +6645J - 738 - Type: 5 - 265 +6659J - 217 - Type: 5 - 266 +66J3T - 611 - Type: 5 - 267 +66JK9 - 655 - Type: 5 - 268 +6747J - 521 - Type: 5 - 269 +68K4K - 422 - Type: 5 - 270 +68A38 - 450 - Type: 5 - 271 +69Q6A - 153 - Type: 5 - 272 +6TK62 - 607 - Type: 5 - 273 +6J585 - 820 - Type: 5 - 274 +6JJQ9 - 475 - Type: 5 - 275 +6JAJ7 - 595 - Type: 5 - 276 +6QJ36 - 701 - Type: 5 - 277 +7229T - 954 - Type: 5 - 278 +722J4 - 110 - Type: 5 - 279 +7278T - 406 - Type: 5 - 280 +72KQ7 - 263 - Type: 5 - 281 +73646 - 203 - Type: 5 - 282 +73758 - 479 - Type: 5 - 283 +73TAT - 60 - Type: 5 - 284 +743J7 - 747 - Type: 5 - 285 +746K4 - 56 - Type: 5 - 286 +75A73 - 476 - Type: 5 - 287 +76378 - 12 - Type: 5 - 288 +76965 - 773 - Type: 5 - 289 +78KT8 - 867 - Type: 5 - 290 +7976K - 58 - Type: 5 - 291 +79AAJ - 41 - Type: 5 - 292 +7TT64 - 387 - Type: 5 - 293 +7TKTA - 327 - Type: 5 - 294 +7J223 - 254 - Type: 5 - 295 +7J366 - 511 - Type: 5 - 296 +7J457 - 796 - Type: 5 - 297 +7J765 - 760 - Type: 5 - 298 +7JT74 - 624 - Type: 5 - 299 +7Q7AJ - 491 - Type: 5 - 300 +7QQ59 - 59 - Type: 5 - 301 +7K7Q3 - 208 - Type: 5 - 302 +7A69A - 93 - Type: 5 - 303 +83539 - 168 - Type: 5 - 304 +83J53 - 178 - Type: 5 - 305 +84353 - 18 - Type: 5 - 306 +845Q5 - 478 - Type: 5 - 307 +85398 - 334 - Type: 5 - 308 +86797 - 839 - Type: 5 - 309 +87497 - 13 - Type: 5 - 310 +8938K - 328 - Type: 5 - 311 +8TJ6T - 402 - Type: 5 - 312 +8TJ83 - 751 - Type: 5 - 313 +8J358 - 483 - Type: 5 - 314 +8J3Q3 - 897 - Type: 5 - 315 +8J859 - 237 - Type: 5 - 316 +8KTJ8 - 137 - Type: 5 - 317 +8KQ8A - 271 - Type: 5 - 318 +8AAK4 - 408 - Type: 5 - 319 +9255Q - 684 - Type: 5 - 320 +9288A - 664 - Type: 5 - 321 +92T52 - 939 - Type: 5 - 322 +92AK2 - 6 - Type: 5 - 323 +94Q97 - 638 - Type: 5 - 324 +95493 - 170 - Type: 5 - 325 +9594T - 694 - Type: 5 - 326 +95JJ8 - 72 - Type: 5 - 327 +96TTQ - 935 - Type: 5 - 328 +96A2A - 471 - Type: 5 - 329 +98379 - 617 - Type: 5 - 330 +9866K - 851 - Type: 5 - 331 +9T8KK - 125 - Type: 5 - 332 +9TQ97 - 319 - Type: 5 - 333 +9J6J8 - 120 - Type: 5 - 334 +9K92J - 776 - Type: 5 - 335 +9A2AJ - 713 - Type: 5 - 336 +T2Q3Q - 712 - Type: 5 - 337 +T2A25 - 318 - Type: 5 - 338 +T3734 - 325 - Type: 5 - 339 +T3AQ3 - 632 - Type: 5 - 340 +T4TJ5 - 239 - Type: 5 - 341 +T4AAJ - 432 - Type: 5 - 342 +T53TA - 355 - Type: 5 - 343 +T68AA - 242 - Type: 5 - 344 +T6T93 - 818 - Type: 5 - 345 +T886J - 554 - Type: 5 - 346 +T9279 - 908 - Type: 5 - 347 +TT3JK - 588 - Type: 5 - 348 +TT6K2 - 630 - Type: 5 - 349 +TT9J2 - 109 - Type: 5 - 350 +TJ2QQ - 255 - Type: 5 - 351 +TKJKQ - 810 - Type: 5 - 352 +J2725 - 795 - Type: 5 - 353 +J338T - 469 - Type: 5 - 354 +J35JK - 113 - Type: 5 - 355 +J3KKQ - 641 - Type: 5 - 356 +J4338 - 337 - Type: 5 - 357 +J463J - 572 - Type: 5 - 358 +J4J23 - 299 - Type: 5 - 359 +J4Q54 - 603 - Type: 5 - 360 +J5993 - 927 - Type: 5 - 361 +J5A6A - 399 - Type: 5 - 362 +J6488 - 66 - Type: 5 - 363 +J6JK7 - 929 - Type: 5 - 364 +J6AA7 - 194 - Type: 5 - 365 +J73JK - 463 - Type: 5 - 366 +J77QT - 341 - Type: 5 - 367 +J7A37 - 451 - Type: 5 - 368 +J83A8 - 634 - Type: 5 - 369 +J898T - 14 - Type: 5 - 370 +J9868 - 472 - Type: 5 - 371 +JT43J - 668 - Type: 5 - 372 +JTJAK - 99 - Type: 5 - 373 +JTK77 - 312 - Type: 5 - 374 +JJ278 - 804 - Type: 5 - 375 +JJ5AQ - 661 - Type: 5 - 376 +JJ6T5 - 827 - Type: 5 - 377 +JJQK9 - 105 - Type: 5 - 378 +JQ7Q2 - 78 - Type: 5 - 379 +JK5QK - 838 - Type: 5 - 380 +JKKT2 - 629 - Type: 5 - 381 +JA252 - 39 - Type: 5 - 382 +JA8AK - 890 - Type: 5 - 383 +JA9T9 - 333 - Type: 5 - 384 +JAA24 - 732 - Type: 5 - 385 +JAA4Q - 680 - Type: 5 - 386 +Q3558 - 152 - Type: 5 - 387 +Q3699 - 910 - Type: 5 - 388 +Q5JT5 - 815 - Type: 5 - 389 +Q6QTA - 124 - Type: 5 - 390 +Q7664 - 606 - Type: 5 - 391 +Q7855 - 354 - Type: 5 - 392 +Q7944 - 755 - Type: 5 - 393 +Q92Q7 - 420 - Type: 5 - 394 +Q9948 - 444 - Type: 5 - 395 +QT575 - 413 - Type: 5 - 396 +QJ233 - 100 - Type: 5 - 397 +QQAK8 - 970 - Type: 5 - 398 +QA9Q4 - 745 - Type: 5 - 399 +QATA6 - 162 - Type: 5 - 400 +QAA63 - 562 - Type: 5 - 401 +K29KQ - 177 - Type: 5 - 402 +K2K98 - 841 - Type: 5 - 403 +K34JJ - 674 - Type: 5 - 404 +K3635 - 949 - Type: 5 - 405 +K42A2 - 303 - Type: 5 - 406 +K6638 - 784 - Type: 5 - 407 +K6997 - 585 - Type: 5 - 408 +K6JTJ - 409 - Type: 5 - 409 +K6K73 - 518 - Type: 5 - 410 +K6AJA - 992 - Type: 5 - 411 +K727J - 115 - Type: 5 - 412 +K9K38 - 302 - Type: 5 - 413 +KJ53K - 132 - Type: 5 - 414 +KJ56K - 637 - Type: 5 - 415 +KJ622 - 183 - Type: 5 - 416 +KJ64K - 928 - Type: 5 - 417 +KJ79J - 853 - Type: 5 - 418 +KJJ69 - 946 - Type: 5 - 419 +KQJJ7 - 209 - Type: 5 - 420 +KQQT5 - 395 - Type: 5 - 421 +KK74J - 374 - Type: 5 - 422 +KK8Q2 - 777 - Type: 5 - 423 +KA262 - 490 - Type: 5 - 424 +KAQ44 - 536 - Type: 5 - 425 +KAAT2 - 696 - Type: 5 - 426 +A2J32 - 531 - Type: 5 - 427 +A3235 - 622 - Type: 5 - 428 +A3JJ2 - 650 - Type: 5 - 429 +A4469 - 207 - Type: 5 - 430 +A4669 - 958 - Type: 5 - 431 +A4A96 - 625 - Type: 5 - 432 +A5644 - 769 - Type: 5 - 433 +A59J5 - 370 - Type: 5 - 434 +A5AKJ - 123 - Type: 5 - 435 +A6926 - 547 - Type: 5 - 436 +A69K6 - 596 - Type: 5 - 437 +A6JJ9 - 819 - Type: 5 - 438 +A758A - 728 - Type: 5 - 439 +A86AK - 649 - Type: 5 - 440 +A89AK - 24 - Type: 5 - 441 +A8KAQ - 672 - Type: 5 - 442 +ATJJ5 - 11 - Type: 5 - 443 +AJJ63 - 902 - Type: 5 - 444 +AQ4AK - 948 - Type: 5 - 445 +AQT55 - 645 - Type: 5 - 446 +AK447 - 994 - Type: 5 - 447 +AK7Q7 - 172 - Type: 5 - 448 +AA574 - 436 - Type: 5 - 449 +22699 - 705 - Type: 4 - 450 +22887 - 936 - Type: 4 - 451 +228AA - 201 - Type: 4 - 452 +22QQK - 912 - Type: 4 - 453 +24K42 - 260 - Type: 4 - 454 +25442 - 86 - Type: 4 - 455 +2772K - 276 - Type: 4 - 456 +2882A - 530 - Type: 4 - 457 +288AA - 598 - Type: 4 - 458 +29925 - 295 - Type: 4 - 459 +29K92 - 403 - Type: 4 - 460 +2T2KT - 749 - Type: 4 - 461 +2J299 - 557 - Type: 4 - 462 +2Q33Q - 311 - Type: 4 - 463 +2QQ2J - 971 - Type: 4 - 464 +2K626 - 248 - Type: 4 - 465 +2KKA2 - 453 - Type: 4 - 466 +32J32 - 297 - Type: 4 - 467 +3377Q - 779 - Type: 4 - 468 +338JJ - 502 - Type: 4 - 469 +33T77 - 141 - Type: 4 - 470 +33QQ4 - 64 - Type: 4 - 471 +34843 - 103 - Type: 4 - 472 +36A36 - 707 - Type: 4 - 473 +3T3AT - 687 - Type: 4 - 474 +3TT32 - 686 - Type: 4 - 475 +3TT39 - 81 - Type: 4 - 476 +3J3JQ - 797 - Type: 4 - 477 +3KK93 - 485 - Type: 4 - 478 +3A32A - 228 - Type: 4 - 479 +3AT3A - 941 - Type: 4 - 480 +3AA3J - 365 - Type: 4 - 481 +424J2 - 967 - Type: 4 - 482 +42AA4 - 127 - Type: 4 - 483 +44T8T - 88 - Type: 4 - 484 +44AKK - 865 - Type: 4 - 485 +46T46 - 883 - Type: 4 - 486 +48J48 - 889 - Type: 4 - 487 +48Q8Q - 288 - Type: 4 - 488 +499A4 - 612 - Type: 4 - 489 +4QJQ4 - 165 - Type: 4 - 490 +4A4QA - 185 - Type: 4 - 491 +52452 - 73 - Type: 4 - 492 +5353J - 94 - Type: 4 - 493 +53A3A - 945 - Type: 4 - 494 +55446 - 907 - Type: 4 - 495 +556JJ - 533 - Type: 4 - 496 +55J66 - 923 - Type: 4 - 497 +57T5T - 457 - Type: 4 - 498 +5858K - 688 - Type: 4 - 499 +59669 - 558 - Type: 4 - 500 +59T59 - 62 - Type: 4 - 501 +5T5T9 - 449 - Type: 4 - 502 +5Q5KK - 455 - Type: 4 - 503 +5QA5A - 149 - Type: 4 - 504 +62T26 - 1000 - Type: 4 - 505 +63399 - 685 - Type: 4 - 506 +64J64 - 594 - Type: 4 - 507 +64QQ4 - 837 - Type: 4 - 508 +66899 - 899 - Type: 4 - 509 +66949 - 296 - Type: 4 - 510 +66K4K - 104 - Type: 4 - 511 +688KK - 249 - Type: 4 - 512 +69955 - 991 - Type: 4 - 513 +6J6J7 - 222 - Type: 4 - 514 +6Q655 - 937 - Type: 4 - 515 +6K446 - 54 - Type: 4 - 516 +6A63A - 221 - Type: 4 - 517 +6A6KK - 211 - Type: 4 - 518 +6A6A7 - 676 - Type: 4 - 519 +6AQQ6 - 447 - Type: 4 - 520 +72726 - 378 - Type: 4 - 521 +74647 - 464 - Type: 4 - 522 +7557J - 143 - Type: 4 - 523 +75KK7 - 76 - Type: 4 - 524 +77KK6 - 782 - Type: 4 - 525 +7T2T2 - 790 - Type: 4 - 526 +7T7QQ - 215 - Type: 4 - 527 +7JJ88 - 429 - Type: 4 - 528 +7JK7K - 700 - Type: 4 - 529 +7QQJ7 - 164 - Type: 4 - 530 +7KT7T - 730 - Type: 4 - 531 +7KK88 - 675 - Type: 4 - 532 +7A47A - 513 - Type: 4 - 533 +7AA27 - 626 - Type: 4 - 534 +822J8 - 192 - Type: 4 - 535 +82832 - 283 - Type: 4 - 536 +84477 - 783 - Type: 4 - 537 +8877T - 623 - Type: 4 - 538 +88KQQ - 968 - Type: 4 - 539 +88AJA - 368 - Type: 4 - 540 +89859 - 695 - Type: 4 - 541 +8J6J6 - 666 - Type: 4 - 542 +8J8JQ - 338 - Type: 4 - 543 +8KJ8K - 67 - Type: 4 - 544 +96449 - 281 - Type: 4 - 545 +98948 - 202 - Type: 4 - 546 +9933J - 278 - Type: 4 - 547 +99433 - 509 - Type: 4 - 548 +99A5A - 736 - Type: 4 - 549 +9TKT9 - 84 - Type: 4 - 550 +9TAAT - 188 - Type: 4 - 551 +9J955 - 652 - Type: 4 - 552 +9QJQ9 - 459 - Type: 4 - 553 +9K4K9 - 778 - Type: 4 - 554 +9A22A - 503 - Type: 4 - 555 +9A9A4 - 40 - Type: 4 - 556 +T2TJ2 - 465 - Type: 4 - 557 +T3T53 - 157 - Type: 4 - 558 +T5KT5 - 411 - Type: 4 - 559 +T886T - 267 - Type: 4 - 560 +TT99J - 234 - Type: 4 - 561 +TTQ8Q - 944 - Type: 4 - 562 +TTQQK - 868 - Type: 4 - 563 +TTK7K - 496 - Type: 4 - 564 +TJ3J3 - 866 - Type: 4 - 565 +TJT77 - 644 - Type: 4 - 566 +TQ5QT - 92 - Type: 4 - 567 +TK3KT - 886 - Type: 4 - 568 +J3773 - 317 - Type: 4 - 569 +J55KK - 583 - Type: 4 - 570 +J5JQ5 - 218 - Type: 4 - 571 +J6776 - 379 - Type: 4 - 572 +J868J - 774 - Type: 4 - 573 +J8J89 - 236 - Type: 4 - 574 +J99KK - 722 - Type: 4 - 575 +JT66T - 938 - Type: 4 - 576 +JJ3KK - 9 - Type: 4 - 577 +JJ5AA - 336 - Type: 4 - 578 +JJ757 - 142 - Type: 4 - 579 +JJKK7 - 484 - Type: 4 - 580 +JKJ9K - 225 - Type: 4 - 581 +JKK66 - 1 - Type: 4 - 582 +JKKTT - 708 - Type: 4 - 583 +JAAJ3 - 916 - Type: 4 - 584 +Q2Q66 - 49 - Type: 4 - 585 +Q399Q - 391 - Type: 4 - 586 +Q5KQK - 394 - Type: 4 - 587 +Q737Q - 809 - Type: 4 - 588 +Q838Q - 410 - Type: 4 - 589 +QT6TQ - 842 - Type: 4 - 590 +QTTJQ - 979 - Type: 4 - 591 +QQ445 - 789 - Type: 4 - 592 +QQ7AA - 658 - Type: 4 - 593 +QQ868 - 517 - Type: 4 - 594 +QQ9TT - 412 - Type: 4 - 595 +QQJAA - 570 - Type: 4 - 596 +QAAQT - 830 - Type: 4 - 597 +K3K3J - 486 - Type: 4 - 598 +K4499 - 362 - Type: 4 - 599 +K5AK5 - 772 - Type: 4 - 600 +K7557 - 5 - Type: 4 - 601 +K7KT7 - 43 - Type: 4 - 602 +K86K6 - 55 - Type: 4 - 603 +KJK8J - 258 - Type: 4 - 604 +KJAAJ - 813 - Type: 4 - 605 +KQAQK - 492 - Type: 4 - 606 +KK3Q3 - 8 - Type: 4 - 607 +KK998 - 101 - Type: 4 - 608 +KKTQT - 539 - Type: 4 - 609 +KKJJQ - 575 - Type: 4 - 610 +KKQJQ - 762 - Type: 4 - 611 +A2255 - 477 - Type: 4 - 612 +A448A - 433 - Type: 4 - 613 +A45A5 - 766 - Type: 4 - 614 +A778A - 823 - Type: 4 - 615 +A8778 - 244 - Type: 4 - 616 +A8Q8A - 824 - Type: 4 - 617 +A9KK9 - 925 - Type: 4 - 618 +A9A29 - 691 - Type: 4 - 619 +AT66T - 761 - Type: 4 - 620 +AJJAQ - 396 - Type: 4 - 621 +AQ6AQ - 445 - Type: 4 - 622 +AQA99 - 601 - Type: 4 - 623 +AKKA4 - 501 - Type: 4 - 624 +AA2J2 - 859 - Type: 4 - 625 +AA3Q3 - 678 - Type: 4 - 626 +AA559 - 780 - Type: 4 - 627 +22A29 - 229 - Type: 3 - 628 +22A32 - 381 - Type: 3 - 629 +23282 - 528 - Type: 3 - 630 +24AAA - 847 - Type: 3 - 631 +29996 - 882 - Type: 3 - 632 +29QQQ - 733 - Type: 3 - 633 +2T6TT - 397 - Type: 3 - 634 +2TJ22 - 507 - Type: 3 - 635 +2J262 - 764 - Type: 3 - 636 +2Q6QQ - 440 - Type: 3 - 637 +2QQ3Q - 323 - Type: 3 - 638 +2QQJQ - 70 - Type: 3 - 639 +2A2J2 - 719 - Type: 3 - 640 +2AK22 - 61 - Type: 3 - 641 +2AAAJ - 748 - Type: 3 - 642 +333K8 - 635 - Type: 3 - 643 +33623 - 111 - Type: 3 - 644 +33TJ3 - 289 - Type: 3 - 645 +37Q33 - 741 - Type: 3 - 646 +38363 - 97 - Type: 3 - 647 +38J88 - 345 - Type: 3 - 648 +3999Q - 703 - Type: 3 - 649 +3T335 - 437 - Type: 3 - 650 +3Q33A - 814 - Type: 3 - 651 +42446 - 704 - Type: 3 - 652 +4244Q - 90 - Type: 3 - 653 +43454 - 846 - Type: 3 - 654 +43A33 - 340 - Type: 3 - 655 +4449A - 973 - Type: 3 - 656 +446A4 - 294 - Type: 3 - 657 +44J94 - 286 - Type: 3 - 658 +44K94 - 834 - Type: 3 - 659 +4744J - 210 - Type: 3 - 660 +47797 - 419 - Type: 3 - 661 +47T77 - 361 - Type: 3 - 662 +48887 - 80 - Type: 3 - 663 +49Q99 - 895 - Type: 3 - 664 +4TATT - 931 - Type: 3 - 665 +4J333 - 744 - Type: 3 - 666 +4Q944 - 233 - Type: 3 - 667 +55275 - 876 - Type: 3 - 668 +5535A - 350 - Type: 3 - 669 +55593 - 314 - Type: 3 - 670 +555J9 - 822 - Type: 3 - 671 +55K95 - 679 - Type: 3 - 672 +56646 - 330 - Type: 3 - 673 +585Q5 - 852 - Type: 3 - 674 +59575 - 800 - Type: 3 - 675 +59929 - 392 - Type: 3 - 676 +5J545 - 21 - Type: 3 - 677 +5K558 - 272 - Type: 3 - 678 +5KKKA - 862 - Type: 3 - 679 +5A558 - 767 - Type: 3 - 680 +6333J - 702 - Type: 3 - 681 +63343 - 35 - Type: 3 - 682 +65Q66 - 154 - Type: 3 - 683 +65K55 - 506 - Type: 3 - 684 +66469 - 758 - Type: 3 - 685 +666A5 - 711 - Type: 3 - 686 +667T6 - 136 - Type: 3 - 687 +6686T - 28 - Type: 3 - 688 +66QT6 - 875 - Type: 3 - 689 +67656 - 541 - Type: 3 - 690 +676K6 - 724 - Type: 3 - 691 +686J6 - 534 - Type: 3 - 692 +68889 - 364 - Type: 3 - 693 +6888J - 454 - Type: 3 - 694 +68A88 - 878 - Type: 3 - 695 +6Q6J6 - 212 - Type: 3 - 696 +6K444 - 498 - Type: 3 - 697 +6A6J6 - 740 - Type: 3 - 698 +73222 - 315 - Type: 3 - 699 +737J7 - 538 - Type: 3 - 700 +74775 - 126 - Type: 3 - 701 +74K44 - 280 - Type: 3 - 702 +7555Q - 169 - Type: 3 - 703 +757Q7 - 817 - Type: 3 - 704 +75QQQ - 356 - Type: 3 - 705 +76663 - 793 - Type: 3 - 706 +77637 - 857 - Type: 3 - 707 +77A47 - 770 - Type: 3 - 708 +787J7 - 647 - Type: 3 - 709 +7J757 - 584 - Type: 3 - 710 +7JT77 - 198 - Type: 3 - 711 +7KKJK - 628 - Type: 3 - 712 +7A772 - 167 - Type: 3 - 713 +7A77T - 57 - Type: 3 - 714 +82225 - 250 - Type: 3 - 715 +8288J - 768 - Type: 3 - 716 +8488J - 593 - Type: 3 - 717 +84AAA - 190 - Type: 3 - 718 +8828A - 765 - Type: 3 - 719 +88385 - 180 - Type: 3 - 720 +8J999 - 964 - Type: 3 - 721 +8Q333 - 963 - Type: 3 - 722 +8Q88J - 545 - Type: 3 - 723 +8QQQ3 - 682 - Type: 3 - 724 +8K88J - 987 - Type: 3 - 725 +94744 - 173 - Type: 3 - 726 +96989 - 417 - Type: 3 - 727 +9888T - 435 - Type: 3 - 728 +9939J - 743 - Type: 3 - 729 +9979K - 981 - Type: 3 - 730 +99A9J - 535 - Type: 3 - 731 +9JQ99 - 398 - Type: 3 - 732 +9Q989 - 985 - Type: 3 - 733 +9QKKK - 512 - Type: 3 - 734 +9A299 - 942 - Type: 3 - 735 +T3332 - 292 - Type: 3 - 736 +T3TKT - 161 - Type: 3 - 737 +T44A4 - 828 - Type: 3 - 738 +T9222 - 873 - Type: 3 - 739 +TT4T2 - 135 - Type: 3 - 740 +TT5QT - 821 - Type: 3 - 741 +TT65T - 377 - Type: 3 - 742 +TTTJA - 63 - Type: 3 - 743 +TTKT5 - 582 - Type: 3 - 744 +TJTT2 - 273 - Type: 3 - 745 +TKKKA - 633 - Type: 3 - 746 +J3233 - 891 - Type: 3 - 747 +J333Q - 118 - Type: 3 - 748 +J3533 - 619 - Type: 3 - 749 +J4244 - 993 - Type: 3 - 750 +J6626 - 68 - Type: 3 - 751 +J666T - 750 - Type: 3 - 752 +J7772 - 835 - Type: 3 - 753 +J8878 - 552 - Type: 3 - 754 +JQQQ8 - 456 - Type: 3 - 755 +JKKAK - 568 - Type: 3 - 756 +Q2J22 - 548 - Type: 3 - 757 +Q3393 - 901 - Type: 3 - 758 +Q4447 - 515 - Type: 3 - 759 +Q4644 - 697 - Type: 3 - 760 +Q7J77 - 414 - Type: 3 - 761 +Q7Q8Q - 990 - Type: 3 - 762 +QJTQQ - 270 - Type: 3 - 763 +QQ3JQ - 235 - Type: 3 - 764 +QQ56Q - 25 - Type: 3 - 765 +QQ5QJ - 801 - Type: 3 - 766 +QQT6Q - 884 - Type: 3 - 767 +QQAJQ - 383 - Type: 3 - 768 +QQAQ2 - 681 - Type: 3 - 769 +QK3KK - 187 - Type: 3 - 770 +QKQQ5 - 423 - Type: 3 - 771 +QKQQA - 321 - Type: 3 - 772 +K2KK9 - 631 - Type: 3 - 773 +K33T3 - 285 - Type: 3 - 774 +K4999 - 112 - Type: 3 - 775 +K4J44 - 763 - Type: 3 - 776 +K6KK5 - 275 - Type: 3 - 777 +K7KQK - 943 - Type: 3 - 778 +K7KK4 - 386 - Type: 3 - 779 +KJKK2 - 213 - Type: 3 - 780 +KQJQQ - 978 - Type: 3 - 781 +KQKK4 - 723 - Type: 3 - 782 +KK2K6 - 752 - Type: 3 - 783 +KK4K2 - 591 - Type: 3 - 784 +KK63K - 114 - Type: 3 - 785 +KKJK6 - 171 - Type: 3 - 786 +KKK28 - 520 - Type: 3 - 787 +KKK84 - 400 - Type: 3 - 788 +KAATA - 775 - Type: 3 - 789 +KAAA2 - 320 - Type: 3 - 790 +KAAA5 - 307 - Type: 3 - 791 +A2Q22 - 739 - Type: 3 - 792 +A6A3A - 462 - Type: 3 - 793 +A7AAJ - 840 - Type: 3 - 794 +A888T - 874 - Type: 3 - 795 +A9599 - 540 - Type: 3 - 796 +ATA8A - 205 - Type: 3 - 797 +AJAA3 - 671 - Type: 3 - 798 +AA35A - 264 - Type: 3 - 799 +AA8A3 - 565 - Type: 3 - 800 +AAJ6A - 753 - Type: 3 - 801 +AAAJ8 - 331 - Type: 3 - 802 +222JJ - 184 - Type: 2 - 803 +22999 - 586 - Type: 2 - 804 +22TTT - 220 - Type: 2 - 805 +23223 - 481 - Type: 2 - 806 +25525 - 785 - Type: 2 - 807 +26662 - 555 - Type: 2 - 808 +27227 - 181 - Type: 2 - 809 +2A2A2 - 199 - Type: 2 - 810 +32323 - 223 - Type: 2 - 811 +333QQ - 605 - Type: 2 - 812 +33443 - 182 - Type: 2 - 813 +33JJ3 - 458 - Type: 2 - 814 +34344 - 332 - Type: 2 - 815 +36633 - 858 - Type: 2 - 816 +36636 - 581 - Type: 2 - 817 +37373 - 27 - Type: 2 - 818 +37773 - 960 - Type: 2 - 819 +38383 - 880 - Type: 2 - 820 +38388 - 48 - Type: 2 - 821 +39393 - 522 - Type: 2 - 822 +42224 - 243 - Type: 2 - 823 +44555 - 959 - Type: 2 - 824 +44664 - 725 - Type: 2 - 825 +44999 - 401 - Type: 2 - 826 +44JJ4 - 2 - Type: 2 - 827 +44AAA - 349 - Type: 2 - 828 +45454 - 224 - Type: 2 - 829 +46466 - 610 - Type: 2 - 830 +48844 - 231 - Type: 2 - 831 +4AA44 - 848 - Type: 2 - 832 +52522 - 357 - Type: 2 - 833 +55335 - 65 - Type: 2 - 834 +555KK - 714 - Type: 2 - 835 +555AA - 984 - Type: 2 - 836 +55757 - 200 - Type: 2 - 837 +55TTT - 759 - Type: 2 - 838 +55J5J - 727 - Type: 2 - 839 +55QQ5 - 497 - Type: 2 - 840 +55AAA - 504 - Type: 2 - 841 +59559 - 160 - Type: 2 - 842 +66688 - 792 - Type: 2 - 843 +67767 - 590 - Type: 2 - 844 +6Q66Q - 85 - Type: 2 - 845 +6KK66 - 313 - Type: 2 - 846 +75775 - 710 - Type: 2 - 847 +77474 - 781 - Type: 2 - 848 +78878 - 715 - Type: 2 - 849 +7T7T7 - 407 - Type: 2 - 850 +7K7K7 - 911 - Type: 2 - 851 +7AAA7 - 888 - Type: 2 - 852 +88448 - 544 - Type: 2 - 853 +88585 - 906 - Type: 2 - 854 +88899 - 499 - Type: 2 - 855 +88JJ8 - 863 - Type: 2 - 856 +8KK88 - 589 - Type: 2 - 857 +95599 - 324 - Type: 2 - 858 +96996 - 885 - Type: 2 - 859 +97977 - 219 - Type: 2 - 860 +99666 - 961 - Type: 2 - 861 +99933 - 310 - Type: 2 - 862 +999KK - 579 - Type: 2 - 863 +99JJ9 - 962 - Type: 2 - 864 +9T9T9 - 918 - Type: 2 - 865 +9Q9Q9 - 385 - Type: 2 - 866 +T66TT - 717 - Type: 2 - 867 +T77TT - 599 - Type: 2 - 868 +TT222 - 933 - Type: 2 - 869 +TT666 - 158 - Type: 2 - 870 +TT99T - 636 - Type: 2 - 871 +TJTJJ - 30 - Type: 2 - 872 +TKKTK - 131 - Type: 2 - 873 +J55JJ - 742 - Type: 2 - 874 +J66J6 - 877 - Type: 2 - 875 +J77J7 - 951 - Type: 2 - 876 +J7J7J - 659 - Type: 2 - 877 +JTTJT - 975 - Type: 2 - 878 +JJAAA - 573 - Type: 2 - 879 +Q2Q22 - 189 - Type: 2 - 880 +Q6Q6Q - 618 - Type: 2 - 881 +Q7Q77 - 468 - Type: 2 - 882 +Q88QQ - 508 - Type: 2 - 883 +QJQJJ - 339 - Type: 2 - 884 +QQ4Q4 - 746 - Type: 2 - 885 +QQ77Q - 274 - Type: 2 - 886 +QQTQT - 51 - Type: 2 - 887 +QQJJQ - 346 - Type: 2 - 888 +QQQ33 - 446 - Type: 2 - 889 +QQQKK - 600 - Type: 2 - 890 +K444K - 371 - Type: 2 - 891 +KJKKJ - 389 - Type: 2 - 892 +KK66K - 279 - Type: 2 - 893 +KK77K - 855 - Type: 2 - 894 +KKK33 - 443 - Type: 2 - 895 +KKK88 - 646 - Type: 2 - 896 +KKKQQ - 316 - Type: 2 - 897 +KKAAA - 525 - Type: 2 - 898 +A8A88 - 384 - Type: 2 - 899 +A9AA9 - 514 - Type: 2 - 900 +ATATA - 98 - Type: 2 - 901 +AA666 - 950 - Type: 2 - 902 +AAQAQ - 31 - Type: 2 - 903 +22223 - 351 - Type: 1 - 904 +22922 - 805 - Type: 1 - 905 +2J222 - 176 - Type: 1 - 906 +32333 - 999 - Type: 1 - 907 +3333J - 226 - Type: 1 - 908 +33343 - 663 - Type: 1 - 909 +35333 - 526 - Type: 1 - 910 +36666 - 366 - Type: 1 - 911 +38888 - 527 - Type: 1 - 912 +3KKKK - 871 - Type: 1 - 913 +42222 - 470 - Type: 1 - 914 +4444J - 532 - Type: 1 - 915 +44494 - 298 - Type: 1 - 916 +444T4 - 140 - Type: 1 - 917 +444Q4 - 505 - Type: 1 - 918 +45555 - 79 - Type: 1 - 919 +47777 - 832 - Type: 1 - 920 +4K444 - 138 - Type: 1 - 921 +53555 - 651 - Type: 1 - 922 +54444 - 563 - Type: 1 - 923 +55525 - 214 - Type: 1 - 924 +55955 - 418 - Type: 1 - 925 +55Q55 - 347 - Type: 1 - 926 +59999 - 431 - Type: 1 - 927 +5K555 - 277 - Type: 1 - 928 +63333 - 791 - Type: 1 - 929 +66662 - 576 - Type: 1 - 930 +66665 - 89 - Type: 1 - 931 +6666A - 669 - Type: 1 - 932 +666J6 - 159 - Type: 1 - 933 +69666 - 247 - Type: 1 - 934 +6KKKK - 204 - Type: 1 - 935 +72222 - 621 - Type: 1 - 936 +73333 - 553 - Type: 1 - 937 +77737 - 869 - Type: 1 - 938 +77757 - 461 - Type: 1 - 939 +7777J - 657 - Type: 1 - 940 +777A7 - 246 - Type: 1 - 941 +77877 - 922 - Type: 1 - 942 +7Q777 - 438 - Type: 1 - 943 +7AAAA - 924 - Type: 1 - 944 +86888 - 494 - Type: 1 - 945 +88828 - 997 - Type: 1 - 946 +88887 - 269 - Type: 1 - 947 +8888T - 83 - Type: 1 - 948 +8888K - 257 - Type: 1 - 949 +8J888 - 163 - Type: 1 - 950 +8JJJJ - 128 - Type: 1 - 951 +99499 - 46 - Type: 1 - 952 +99699 - 106 - Type: 1 - 953 +99799 - 843 - Type: 1 - 954 +99929 - 811 - Type: 1 - 955 +99989 - 45 - Type: 1 - 956 +99993 - 551 - Type: 1 - 957 +99J99 - 206 - Type: 1 - 958 +9A999 - 934 - Type: 1 - 959 +T3333 - 731 - Type: 1 - 960 +T5555 - 716 - Type: 1 - 961 +T5TTT - 393 - Type: 1 - 962 +TT3TT - 133 - Type: 1 - 963 +TT4TT - 342 - Type: 1 - 964 +TT6TT - 757 - Type: 1 - 965 +TTTT2 - 146 - Type: 1 - 966 +TTTT7 - 914 - Type: 1 - 967 +TTTJT - 953 - Type: 1 - 968 +J5555 - 284 - Type: 1 - 969 +JKKKK - 995 - Type: 1 - 970 +Q2222 - 145 - Type: 1 - 971 +Q8888 - 826 - Type: 1 - 972 +Q9QQQ - 516 - Type: 1 - 973 +QJQQQ - 268 - Type: 1 - 974 +QQ8QQ - 787 - Type: 1 - 975 +QQQ2Q - 698 - Type: 1 - 976 +QQQ6Q - 903 - Type: 1 - 977 +QQQQ4 - 721 - Type: 1 - 978 +QQQQ7 - 683 - Type: 1 - 979 +QQQQT - 7 - Type: 1 - 980 +QQQQA - 980 - Type: 1 - 981 +QQKQQ - 904 - Type: 1 - 982 +QKKKK - 20 - Type: 1 - 983 +K7777 - 756 - Type: 1 - 984 +K7KKK - 150 - Type: 1 - 985 +K9KKK - 129 - Type: 1 - 986 +KK2KK - 38 - Type: 1 - 987 +KKTKK - 977 - Type: 1 - 988 +KKKK5 - 519 - Type: 1 - 989 +KKKK8 - 460 - Type: 1 - 990 +A4444 - 729 - Type: 1 - 991 +A5555 - 892 - Type: 1 - 992 +A5AAA - 421 - Type: 1 - 993 +A6AAA - 352 - Type: 1 - 994 +ATAAA - 952 - Type: 1 - 995 +AA4AA - 52 - Type: 1 - 996 +AAAA3 - 179 - Type: 1 - 997 +AAAAJ - 580 - Type: 1 - 998 +AAAAQ - 488 - Type: 1 - 999 +JJJJJ - 42 - Type: 0 - 1000 diff --git a/2023/Day07/solution.cs b/2023/Day07/solution.cs index 30d7345..c41751b 100644 --- a/2023/Day07/solution.cs +++ b/2023/Day07/solution.cs @@ -3,6 +3,7 @@ using System.Collections; using System.Collections.Generic; using adventofcode; +using System.IO; namespace aoc2023; @@ -36,15 +37,21 @@ public void SolvePart1() long total = 0; long rank = 1; - foreach (var item in cards.OrderByDescending(c => c.Handtype()).ThenBy(c => c.Strength(0)).ThenBy(c => c.Strength(1)).ThenBy(c => c.Strength(2)).ThenBy(c => c.Strength(3)).ThenBy(c => c.Strength(4))) + StreamWriter sw = new("2023/Day07/output"); + using(sw) { - Console.WriteLine(item); - total += item.Bid * rank; - Console.WriteLine($"{item.Bid} * {rank}"); + foreach (var item in cards.OrderByDescending(c => c.Handtype()).ThenBy(c => c.Strength(0)).ThenBy(c => c.Strength(1)).ThenBy(c => c.Strength(2)).ThenBy(c => c.Strength(3)).ThenBy(c => c.Strength(4))) + { + Console.WriteLine(item); + total += item.Bid * rank; + Console.WriteLine($"{item.Bid} * {rank}"); + + sw.WriteLine($"{item} - {rank}"); - rank++; + rank++; + } + Console.WriteLine($"Total: {total}"); } - Console.WriteLine($"Total: {total}"); } public void SolvePart2() From 2874814401ccb9906d797432f1f6ce69aae2001d Mon Sep 17 00:00:00 2001 From: deckelmouck Date: Thu, 7 Dec 2023 21:42:33 +0100 Subject: [PATCH 06/14] trytosolveday5again --- 2023/Day05/solution.cs | 116 +++++++++++++---------------------------- 2023/Day05/test | 2 +- 2 files changed, 38 insertions(+), 80 deletions(-) diff --git a/2023/Day05/solution.cs b/2023/Day05/solution.cs index 82a8013..da164e8 100644 --- a/2023/Day05/solution.cs +++ b/2023/Day05/solution.cs @@ -12,101 +12,47 @@ public void SolvePart1() Console.WriteLine("part 1"); solutionBase sb = new(); - var input = sb.getInputLines(@"2023/Day05/testone").ToArray(); + var input = sb.getInputLines(@"2023/Day05/test").ToArray(); //var input = sb.getInputLines(@"2023/Day05/input").ToArray(); var firstLine = input[0].Split(' ', StringSplitOptions.RemoveEmptyEntries); var seeds = firstLine.Where(seed => seed.Any(char.IsDigit)); - foreach(var seed in seeds) - { - Console.WriteLine(seed); - } - - //input.Remove(input[0]); + Dictionary seedlist = new(); - // List maps = new(); - - // foreach (var line in input) - // { - // if(line.Length > 0 && !line.Contains(':')) - // { - // maps.Add(line); - // } - // } - - //inital map - int[] test = new int[100]; - for (int i = 0; i < test.Length; i++) + foreach(var seed in seeds) { - test[i] = i; - } + Console.WriteLine($"seed: {seed} will be calculated"); + var s = Convert.ToInt64(seed); - int[] testmap = new int[100]; - - for (int a = 2; a < input.Length; a++) - { - //Console.WriteLine(input[a].Length); - if(input[a].Contains(':')) - { - Console.WriteLine(input[a]); - Array.Copy(test, testmap, test.Length); - } - else if (input[a].Length == 0) + for (int i = 2; i < input.Length; i++) { - Console.WriteLine(input[a]); - //Array.Copy(testmap, test, test.Length); - - for (int i = 0; i < 100; i++) + if(!input[i].Contains(':') && input[i] != "") { - //Console.WriteLine($"{i}: test {test[i]} - testmap {testmap[i]}"); - test[i] = testmap[i]; - testmap[i] = 1; - //Console.WriteLine($"{i}: test {test[i]} - testmap {testmap[i]}"); - //Console.WriteLine($"------------------"); - } - } - else - { - Console.WriteLine(input[a]); - - var item = input[a]; - var destinationRangeStart = Convert.ToInt64(item.Split(' ')[0]); - var sourceRange = Convert.ToInt64(item.Split(' ')[1]); - var rangeLength = Convert.ToInt64(item.Split(' ')[2]); + var inputLine = input[i].Split(' ', StringSplitOptions.RemoveEmptyEntries); - for (int i = 0; i < rangeLength; i++) - { - testmap[sourceRange + i] = test[destinationRangeStart + i]; + var destination = Convert.ToInt64(inputLine[0]); + var source = Convert.ToInt64(inputLine[1]); + var range = Convert.ToInt64(inputLine[2]); + + if(SeedInRange(s, source, range)) + { + s = destination + (s - source); + } + + Console.WriteLine($"destination: {destination} source: {source} range: {range}"); } + Console.WriteLine($"seed: {seed} - {s}"); } - } - - //foreach (var item in maps) - // for(int m = 0; m < maps.Count; m++) - // { - // var item = maps[m]; - // var destinationRangeStart = Convert.ToInt64(item.Split(' ')[0]); - // var sourceRange = Convert.ToInt64(item.Split(' ')[1]); - // var rangeLength = Convert.ToInt64(item.Split(' ')[2]); - // for (int i = 0; i < rangeLength; i++) - // { - // testmap[sourceRange + i] = test[destinationRangeStart + i]; - // } - // } + seedlist.Add(Convert.ToInt64(seed), s); - //Console.WriteLine(seeds); - // for (int i = 0; i < 100; i++) - // { - // Console.WriteLine($"test{i}: {testmap[i]}"); - // } - Console.WriteLine($"testmap"); - Console.WriteLine($"79: {testmap[79]}"); - Console.WriteLine($"14: {testmap[14]}"); - Console.WriteLine($"55: {testmap[55]}"); - Console.WriteLine($"13: {testmap[13]}"); + } + foreach (var seed in seedlist) + { + Console.WriteLine($"seed: {seed.Key} - {seed.Value}"); + } Console.WriteLine($"still not the right result"); } @@ -115,4 +61,16 @@ public void SolvePart2() { Console.WriteLine("under developement"); } + + public bool SeedInRange(Int64 seed, Int64 source, Int64 range) + { + if(seed >= source && seed < (source + range)) + { + return true; + } + else + { + return false; + } + } } \ No newline at end of file diff --git a/2023/Day05/test b/2023/Day05/test index f756727..bd902a4 100644 --- a/2023/Day05/test +++ b/2023/Day05/test @@ -30,4 +30,4 @@ temperature-to-humidity map: humidity-to-location map: 60 56 37 -56 93 4 +56 93 4 \ No newline at end of file From d54f5f75213203098922ff67e04cf8f07e771674 Mon Sep 17 00:00:00 2001 From: deckelmouck Date: Thu, 7 Dec 2023 22:39:55 +0100 Subject: [PATCH 07/14] got it --- 2023/Day05/solution.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/2023/Day05/solution.cs b/2023/Day05/solution.cs index da164e8..799a152 100644 --- a/2023/Day05/solution.cs +++ b/2023/Day05/solution.cs @@ -12,8 +12,8 @@ public void SolvePart1() Console.WriteLine("part 1"); solutionBase sb = new(); - var input = sb.getInputLines(@"2023/Day05/test").ToArray(); - //var input = sb.getInputLines(@"2023/Day05/input").ToArray(); + //var input = sb.getInputLines(@"2023/Day05/test").ToArray(); + var input = sb.getInputLines(@"2023/Day05/input").ToArray(); var firstLine = input[0].Split(' ', StringSplitOptions.RemoveEmptyEntries); @@ -24,10 +24,13 @@ public void SolvePart1() { Console.WriteLine($"seed: {seed} will be calculated"); var s = Convert.ToInt64(seed); + var mapped = false; for (int i = 2; i < input.Length; i++) { - if(!input[i].Contains(':') && input[i] != "") + if(input[i] == "") mapped = false; + + if(!input[i].Contains(':') && input[i] != "" && !mapped) { var inputLine = input[i].Split(' ', StringSplitOptions.RemoveEmptyEntries); @@ -38,6 +41,7 @@ public void SolvePart1() if(SeedInRange(s, source, range)) { s = destination + (s - source); + mapped = true; } Console.WriteLine($"destination: {destination} source: {source} range: {range}"); @@ -53,6 +57,8 @@ public void SolvePart1() { Console.WriteLine($"seed: {seed.Key} - {seed.Value}"); } + + Console.WriteLine($"min is: {seedlist.Min(s => s.Value)}"); Console.WriteLine($"still not the right result"); } From 1429230a5fdf5413d9b2c9e2f488558579a2aca4 Mon Sep 17 00:00:00 2001 From: deckelmouck Date: Thu, 7 Dec 2023 22:44:59 +0100 Subject: [PATCH 08/14] fixed typo --- 2023/Day05/solution.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2023/Day05/solution.cs b/2023/Day05/solution.cs index 799a152..191fc8d 100644 --- a/2023/Day05/solution.cs +++ b/2023/Day05/solution.cs @@ -60,7 +60,7 @@ public void SolvePart1() Console.WriteLine($"min is: {seedlist.Min(s => s.Value)}"); - Console.WriteLine($"still not the right result"); + Console.WriteLine($"this should be right: 910845529"); } public void SolvePart2() From cb2b736458cde36219c17ac87af29b8f8125cd6a Mon Sep 17 00:00:00 2001 From: deckelmouck Date: Fri, 8 Dec 2023 17:52:23 +0100 Subject: [PATCH 09/14] solved day08 part1 --- 2023/Day08/description | 30 ++ 2023/Day08/input | 796 +++++++++++++++++++++++++++++++++++++++++ 2023/Day08/solution.cs | 78 ++++ 2023/Day08/testone | 9 + 2023/Day08/testwo | 5 + README.md | 4 +- 6 files changed, 920 insertions(+), 2 deletions(-) create mode 100644 2023/Day08/description create mode 100644 2023/Day08/input create mode 100644 2023/Day08/solution.cs create mode 100644 2023/Day08/testone create mode 100644 2023/Day08/testwo diff --git a/2023/Day08/description b/2023/Day08/description new file mode 100644 index 0000000..045864c --- /dev/null +++ b/2023/Day08/description @@ -0,0 +1,30 @@ +--- Day 8: Haunted Wasteland --- +You're still riding a camel across Desert Island when you spot a sandstorm quickly approaching. When you turn to warn the Elf, she disappears before your eyes! To be fair, she had just finished warning you about ghosts a few minutes ago. + +One of the camel's pouches is labeled "maps" - sure enough, it's full of documents (your puzzle input) about how to navigate the desert. At least, you're pretty sure that's what they are; one of the documents contains a list of left/right instructions, and the rest of the documents seem to describe some kind of network of labeled nodes. + +It seems like you're meant to use the left/right instructions to navigate the network. Perhaps if you have the camel follow the same instructions, you can escape the haunted wasteland! + +After examining the maps for a bit, two nodes stick out: AAA and ZZZ. You feel like AAA is where you are now, and you have to follow the left/right instructions until you reach ZZZ. + +This format defines each node of the network individually. For example: + +RL + +AAA = (BBB, CCC) +BBB = (DDD, EEE) +CCC = (ZZZ, GGG) +DDD = (DDD, DDD) +EEE = (EEE, EEE) +GGG = (GGG, GGG) +ZZZ = (ZZZ, ZZZ) +Starting with AAA, you need to look up the next element based on the next left/right instruction in your input. In this example, start with AAA and go right (R) by choosing the right element of AAA, CCC. Then, L means to choose the left element of CCC, ZZZ. By following the left/right instructions, you reach ZZZ in 2 steps. + +Of course, you might not find ZZZ right away. If you run out of left/right instructions, repeat the whole sequence of instructions as necessary: RL really means RLRLRLRLRLRLRLRL... and so on. For example, here is a situation that takes 6 steps to reach ZZZ: + +LLR + +AAA = (BBB, BBB) +BBB = (AAA, ZZZ) +ZZZ = (ZZZ, ZZZ) +Starting at AAA, follow the left/right instructions. How many steps are required to reach ZZZ? \ No newline at end of file diff --git a/2023/Day08/input b/2023/Day08/input new file mode 100644 index 0000000..2a0e5e0 --- /dev/null +++ b/2023/Day08/input @@ -0,0 +1,796 @@ +LLRLRRLLRLRRLLRLRRLRRRLRLRLRRRLLRLRRRLRLRRRLRLRLLLRRLRLRLLRLRRLRRRLRRRLLRRLRLRRRLRRLRRRLRLLRRLRRRLRRRLRRLRLRRLLLRLRLLRRRLRRLLRLRLRRLLRLRRLLRLRRLRRLLRRRLRLRLRRRLLRRRLRRLRRRLRRRLRLRRRLRRLLLRRRLRLLLRRRLRLLRLLRRRLLRRLRRRLRRRLRLLRLRLRRRLLRRLRRRLRRLRLLRRRLRRLRRRLRRRLRRRLRLRRRLRRRLRLRRRR + +XGS = (FDM, XCS) +PJD = (XJN, PCV) +FLJ = (VRH, NBF) +RXS = (DNN, DHH) +DQD = (NTV, CRQ) +HGJ = (QJF, JTK) +JDL = (QHC, TKN) +VMX = (DVX, KDB) +SPX = (FMD, MQS) +DSQ = (BNF, PDJ) +XJQ = (QST, MFT) +BGX = (MSH, JQQ) +CMT = (FSP, SCN) +BVV = (LPL, LPL) +MBR = (BHB, RMB) +VVP = (QTP, TJC) +BFC = (SMR, SMR) +DTN = (CMN, NVG) +BVN = (BKM, KPN) +BCR = (MHM, MPT) +NDK = (NHG, RVN) +FRR = (NKL, KKN) +XDP = (GBQ, VGF) +KCS = (CXN, GGR) +HLG = (FMQ, NXV) +MTP = (KFV, QCH) +VFH = (GPQ, RFK) +HSG = (JKV, KNK) +THL = (CPG, BBF) +FJP = (CVM, BVF) +TGR = (LNL, JGD) +JJD = (QLT, QMC) +DQK = (NDK, NFS) +KFN = (PJK, XSJ) +QLN = (NKV, MGT) +GJR = (HBJ, HLG) +JXD = (NFK, KMD) +CGM = (QHF, PJR) +FPM = (DHB, VBS) +NMK = (MVX, MFM) +SJQ = (VBD, GKP) +XVX = (KCS, TNV) +FNC = (BCR, LQB) +KLA = (XKM, DNG) +CHD = (TPM, BHH) +RMV = (PBC, QPM) +BXH = (QDC, LKX) +VQK = (HRJ, LBX) +VNR = (SDB, JQL) +TQS = (JPX, NLL) +RPK = (KTX, XKP) +AAA = (XMG, HJX) +NQS = (TGB, RDK) +JKK = (SFX, VDH) +DKM = (RXJ, DXF) +VGF = (MXT, LKT) +KQN = (KTG, NCT) +MXV = (HFT, QJM) +CKP = (FMC, JPT) +HGP = (JMV, DXV) +VRC = (NVR, NHK) +DPR = (VBV, FLJ) +VBL = (PXB, BVN) +GSG = (KSL, VSX) +FNK = (VPD, NKN) +LVB = (SQB, SQB) +PRF = (HNP, TDG) +TGV = (NVR, NHK) +DXV = (QNK, PKL) +KMP = (KVB, VMR) +BTR = (LKF, PJD) +QHC = (DFT, DTJ) +RXM = (LRG, NPH) +KTX = (RFR, QRT) +JHR = (BRV, QRB) +JDH = (BFX, DTN) +JLQ = (TTV, GKH) +CMQ = (HQL, PJP) +DJF = (JTK, QJF) +KVB = (MXL, PTK) +DMD = (HXP, ZZZ) +XJV = (CRV, JLM) +JXR = (JMQ, LQM) +DFT = (DRN, JQM) +JSC = (XFX, XFX) +CKB = (VVK, XBK) +RFJ = (CKP, QMH) +HRP = (LQT, CJV) +HXJ = (CKB, FCT) +DMX = (CRV, JLM) +XBK = (LVB, FXN) +JVP = (SKF, LCK) +JLV = (VPT, DMK) +SXK = (TNR, MTF) +DTJ = (JQM, DRN) +KLN = (FDX, NPN) +SKG = (BTR, HXG) +RFR = (XCT, FHN) +FKB = (JJL, CGM) +HNP = (DKR, JLQ) +HKC = (FDM, XCS) +QQN = (MTP, DCG) +QRX = (RPJ, PQM) +SMD = (BBD, DSQ) +SFJ = (JMR, JMR) +CJZ = (QMH, CKP) +PGB = (SDJ, LQF) +CMS = (XSG, TFG) +JMV = (PKL, QNK) +GHH = (RHT, RXS) +NLN = (XJX, MVC) +RCG = (DCG, MTP) +XHF = (SSF, CBS) +PNC = (GPB, MJJ) +RXC = (XHF, LDN) +XVM = (NKR, KQG) +MTF = (FKN, FKV) +FGM = (JPJ, DFG) +MTG = (RRX, FFL) +HCC = (RFS, PBH) +TJL = (RPJ, PQM) +RDK = (RLT, MMJ) +CSD = (MDQ, HSG) +KVP = (VRC, TGV) +QJM = (LSF, DQK) +TTV = (RCC, LXJ) +TJC = (RDG, LFV) +BFS = (FFL, RRX) +BRV = (NRJ, HCN) +HXP = (XMG, HJX) +NJK = (MJT, GBX) +DGV = (NDH, DPB) +RGD = (KBH, XDP) +CRV = (QBD, QLJ) +RPS = (LPH, PRR) +PLF = (BHH, TPM) +SJF = (LFB, NMD) +HLQ = (XJX, MVC) +SJR = (XKM, DNG) +TQP = (BTG, QJG) +MTJ = (JPJ, DFG) +SQB = (RFJ, RFJ) +KPN = (VTC, LDH) +BDZ = (CQP, HRP) +QFC = (XJQ, PMR) +XMV = (HTS, RXT) +MQS = (FXV, VCL) +TLQ = (XMV, TSC) +TCQ = (CXH, RCV) +KNK = (CBD, VQK) +GHD = (DBJ, VPK) +TKP = (TXK, MPJ) +CCC = (NKL, KKN) +QFN = (TJD, JDJ) +DVJ = (GQM, QKJ) +TNC = (PVV, PMJ) +HJX = (DQD, JDR) +NFF = (JMR, GTZ) +JSB = (SLS, HSC) +NVR = (CTV, PNS) +FNV = (XLK, FNC) +JVR = (TGB, RDK) +TXM = (SNN, DMZ) +CNF = (KLN, BDB) +QRG = (PDS, MHP) +QVV = (JJD, RLL) +XML = (VMR, KVB) +TLB = (NTD, VKD) +SDJ = (CNQ, FNV) +TKN = (DTJ, DFT) +HFK = (LPF, XPH) +LJP = (SFJ, SFJ) +SMX = (RQV, DDH) +JBL = (XML, KMP) +NDA = (PBF, FHP) +LRP = (XKP, KTX) +JCK = (BGC, CNF) +XCF = (SPJ, CVR) +VNV = (CMQ, JPQ) +BPJ = (XVP, DXQ) +MVC = (QFC, DLV) +QRK = (SDJ, LQF) +BFX = (CMN, NVG) +JMQ = (MFC, RXD) +JPQ = (PJP, HQL) +FCN = (NPH, LRG) +RXQ = (FMG, GJF) +DVX = (GSS, CFM) +CSH = (VQF, PTV) +STM = (CFH, BMQ) +NVF = (CSH, VHC) +CKG = (VSX, KSL) +BLG = (QHJ, DLB) +RCB = (VVX, XCF) +MGX = (HGT, HGP) +NVG = (KMC, VSM) +JLM = (QBD, QLJ) +NKR = (HCD, RQC) +QKJ = (VXK, TRR) +XSJ = (TCQ, PCL) +HQP = (HSJ, DGV) +NPQ = (RBR, FNB) +DDH = (PTQ, KQN) +KTG = (DHL, KSX) +MHP = (FCX, VCB) +LBA = (CKP, QMH) +GBX = (DLC, JRX) +TKX = (RNJ, PPC) +FHK = (KCV, NBK) +CJV = (RCG, QQN) +PPC = (JDH, SBM) +KKN = (KVP, HBC) +HBT = (XDM, PGN) +CNC = (FVV, TCX) +MXL = (BMP, BPJ) +XVP = (TRL, HVN) +XLX = (JSK, KNX) +FCT = (VVK, XBK) +CFH = (VRX, XMK) +TNV = (CXN, GGR) +JHK = (VQR, LDL) +JPJ = (JBL, NBC) +TNR = (FKV, FKN) +RXJ = (SKG, BFK) +QDV = (RHT, RXS) +QQQ = (XHH, JVP) +HGS = (MFV, DKC) +NBK = (LNV, QLN) +LDL = (CRJ, PRF) +JRL = (KJS, PVK) +FXR = (HCS, CMT) +NVX = (GJR, GTQ) +CFM = (SMT, SXK) +TFG = (SPN, TLF) +PPF = (KJN, NXJ) +VPV = (HQP, KRB) +MGT = (TJL, QRX) +LGB = (KBH, XDP) +BNS = (CTP, CBL) +KSX = (BFS, MTG) +GDD = (NBP, STP) +CJQ = (VHM, JNQ) +GQC = (NTD, VKD) +FMC = (SKX, LRF) +PTQ = (KTG, NCT) +KNG = (BRV, QRB) +KQG = (RQC, HCD) +NSG = (HXJ, LBP) +QPM = (KPK, XVX) +CXH = (LGS, LQR) +LCF = (GBS, MHB) +VBD = (MBR, NBJ) +SDB = (SVM, JJM) +DCR = (FVK, KGG) +BDJ = (XRG, CQL) +JMR = (VRM, NFN) +XFR = (LQM, JMQ) +MBP = (CBL, CTP) +GVD = (CLB, FMF) +MFH = (PPC, RNJ) +PTK = (BMP, BPJ) +LGJ = (PXP, HJK) +GKP = (MBR, NBJ) +HXG = (LKF, PJD) +NBC = (XML, KMP) +SJG = (LPF, XPH) +BKM = (VTC, LDH) +DKC = (NQS, JVR) +JSJ = (TQP, RLR) +PMR = (QST, MFT) +BRM = (PRR, LPH) +KRL = (BGX, XNX) +TCX = (GQC, TLB) +QLJ = (FPS, JFN) +HCD = (FXR, PJJ) +TBN = (DSJ, VPV) +FFL = (NBB, FKB) +GRN = (HCC, NJF) +LQB = (MHM, MPT) +SFX = (LGB, RGD) +HJB = (VNR, KFT) +HRJ = (GLC, CHR) +MJT = (DLC, JRX) +FHN = (HHG, RMV) +VTJ = (BFC, JTL) +CQP = (CJV, LQT) +VCB = (NGR, JRL) +VNN = (JKK, SCK) +XNT = (RXQ, LJS) +SCN = (TNC, LGP) +FMF = (TKP, NNT) +VSM = (HNF, RLF) +CNQ = (FNC, XLK) +MPT = (TLQ, SBG) +DSJ = (KRB, HQP) +CXV = (QRK, PGB) +LBX = (GLC, CHR) +VBV = (NBF, VRH) +TJQ = (LCH, HTJ) +CPG = (QVC, CJQ) +KJN = (PLB, DGH) +NCM = (VTJ, SXJ) +FXV = (NCM, SDH) +XRG = (DPR, MXD) +LCM = (PMN, VCS) +SHN = (SMK, PHG) +MXD = (FLJ, VBV) +FDJ = (LKV, BKX) +JDR = (NTV, CRQ) +XDR = (LPV, XTH) +RNJ = (JDH, SBM) +FHP = (MGQ, HJB) +PVH = (GPQ, GPQ) +MGM = (RBS, HPR) +VFQ = (RBR, FNB) +XRV = (LCH, HTJ) +DGP = (FDJ, GTJ) +HJV = (DHB, VBS) +KPK = (TNV, KCS) +CMX = (DBJ, VPK) +BHH = (VRN, SMX) +PJL = (NLS, SCL) +SPJ = (RXM, FCN) +NTV = (TSJ, BSR) +FXN = (SQB, GLR) +DTK = (VVP, TCD) +DBJ = (MFH, TKX) +DCJ = (BTP, GVD) +NMD = (DJB, MGC) +PBC = (XVX, KPK) +FRS = (KMD, NFK) +LNL = (SQC, DTK) +NGH = (XKL, HPT) +RFS = (CHD, PLF) +DMK = (JJT, FHK) +SNS = (SHN, BMD) +RLR = (BTG, QJG) +FDM = (GRN, CBK) +PLB = (CCT, JTT) +VTC = (CMS, XSC) +XKM = (QGF, TBN) +MVJ = (SLB, TXM) +PKL = (CSQ, SJQ) +SLB = (SNN, SNN) +JKV = (VQK, CBD) +BBD = (BNF, PDJ) +GSS = (SXK, SMT) +LRG = (SPB, TGR) +FDN = (JXD, FRS) +XKX = (HXC, PGT) +PDJ = (FRR, CCC) +HXM = (VNN, VJG) +QMC = (CXV, TLH) +GLG = (GGV, VBL) +RXT = (LCF, GBT) +TGL = (NXJ, KJN) +JPT = (SKX, LRF) +NLL = (SPX, DDQ) +BHB = (RGP, FQL) +XKN = (HBT, XXG) +RLT = (JLB, BDJ) +SHF = (HGP, HGT) +HKV = (DLB, QHJ) +SVM = (XDR, BLN) +PMN = (QTL, QRG) +CXN = (JLV, FMT) +GQV = (PJK, XSJ) +HMM = (MGX, SHF) +VSC = (PDH, XVM) +LCK = (NSG, JPR) +JQL = (JJM, SVM) +FRQ = (SVG, DCR) +TDG = (JLQ, DKR) +SMT = (TNR, MTF) +GBT = (GBS, MHB) +QMH = (JPT, FMC) +DXJ = (CMQ, JPQ) +JJM = (XDR, BLN) +DDQ = (FMD, MQS) +NDH = (VVQ, DCM) +LSF = (NFS, NDK) +VGM = (STS, XNT) +PJR = (GXF, JDL) +XFC = (XVM, PDH) +LBP = (CKB, FCT) +KFT = (SDB, JQL) +TTT = (QLS, GCV) +LPH = (SJF, BPT) +JGS = (XKL, HPT) +VDH = (LGB, RGD) +VHC = (VQF, PTV) +NKN = (GDD, XDC) +RND = (VGM, PSD) +QVC = (VHM, JNQ) +JJL = (QHF, PJR) +QRB = (NRJ, HCN) +MJJ = (FQT, RXC) +NNA = (HRP, CQP) +PBF = (MGQ, HJB) +VRT = (DSS, FDN) +DCM = (CLV, JCK) +QLS = (SJR, SJR) +RMT = (XHH, JVP) +DMR = (MLF, MVJ) +QJG = (NLN, HLQ) +DLV = (XJQ, PMR) +LKF = (XJN, PCV) +VQR = (PRF, CRJ) +SXJ = (BFC, JTL) +MDQ = (KNK, JKV) +QVD = (BVF, CVM) +TGG = (LPL, BDZ) +HDJ = (HGB, HSH) +HTT = (LHQ, HGS) +SKX = (HXM, JMF) +FCX = (NGR, JRL) +HSJ = (NDH, DPB) +BFK = (HXG, BTR) +XSG = (SPN, TLF) +NCD = (MFM, MVX) +PHG = (BKS, SMD) +XMK = (QVD, FJP) +FXL = (PGT, HXC) +KBH = (VGF, GBQ) +CBG = (QDC, LKX) +LDN = (SSF, CBS) +SVG = (FVK, KGG) +BVF = (GHH, QDV) +SPB = (LNL, JGD) +LQR = (QXX, LCM) +KHV = (JSK, KNX) +LFV = (XFJ, XKN) +QHG = (JJD, RLL) +HGB = (LRP, RPK) +NRJ = (DXJ, VNV) +LKT = (PNC, LJX) +MSH = (CDN, DMS) +MLF = (SLB, SLB) +MMJ = (JLB, BDJ) +VRM = (HSR, HTT) +MHM = (TLQ, SBG) +LRF = (HXM, JMF) +VHM = (PVH, VFH) +FQL = (XRV, TJQ) +MPJ = (LFS, CFJ) +LMF = (CNC, KCC) +JTK = (XJR, DGP) +HFT = (DQK, LSF) +RQV = (PTQ, KQN) +LDT = (BMQ, CFH) +RGP = (TJQ, XRV) +SDH = (VTJ, SXJ) +LKV = (JVB, TFD) +KDD = (XFX, XGV) +CVM = (GHH, QDV) +PLS = (DVX, KDB) +VCL = (NCM, SDH) +SCK = (SFX, VDH) +LJX = (MJJ, GPB) +JTT = (LMF, SVS) +PHV = (KRL, SVD) +PDS = (VCB, FCX) +VPD = (XDC, GDD) +VRJ = (HXP, HXP) +LPV = (HKC, XGS) +BDB = (FDX, NPN) +DXF = (BFK, SKG) +FMG = (JGS, NGH) +NXV = (LJP, SBT) +PQM = (QVV, QHG) +SNN = (PBF, FHP) +LGP = (PMJ, PVV) +FKV = (CBG, BXH) +VJG = (JKK, SCK) +JPR = (HXJ, LBP) +TPM = (SMX, VRN) +KXT = (VQR, LDL) +NPN = (FRQ, SRD) +TRL = (DCJ, BLS) +CBK = (NJF, HCC) +KMD = (GQV, KFN) +GQM = (TRR, VXK) +QST = (RMT, QQQ) +XDM = (KXT, JHK) +TLH = (QRK, PGB) +VRH = (BNS, MBP) +VVK = (LVB, LVB) +HVN = (BLS, DCJ) +TLJ = (HSG, MDQ) +QLQ = (STM, LDT) +LKX = (DBT, XTS) +VXK = (DKM, KKV) +XKL = (NPQ, VFQ) +LDP = (BPH, RCB) +VRN = (RQV, DDH) +LJS = (FMG, GJF) +FMT = (DMK, VPT) +BPT = (LFB, NMD) +RLL = (QMC, QLT) +JNQ = (PVH, VFH) +HJK = (JSC, KDD) +QHF = (JDL, GXF) +DGH = (JTT, CCT) +PVV = (RND, XCQ) +XFX = (VRJ, VRJ) +NRN = (GQM, QKJ) +VPK = (TKX, MFH) +GLC = (PPF, TGL) +JJT = (KCV, NBK) +FVK = (XQS, PJL) +VRD = (RCB, BPH) +GPQ = (BVV, BVV) +XCT = (HHG, RMV) +VMR = (PTK, MXL) +NTD = (XJV, DMX) +CBS = (GHD, CMX) +SNZ = (DNG, XKM) +QTP = (LFV, RDG) +DMZ = (FHP, PBF) +LQT = (RCG, QQN) +FPS = (RBX, DMR) +LGS = (LCM, QXX) +ZZZ = (HJX, XMG) +RCV = (LQR, LGS) +PBH = (CHD, PLF) +JPX = (DDQ, SPX) +DNN = (MXV, DVB) +QRT = (XCT, FHN) +HHG = (PBC, QPM) +SBM = (BFX, DTN) +JVB = (VSC, XFC) +QNK = (CSQ, SJQ) +BPM = (KNG, JHR) +HBC = (TGV, VRC) +MGQ = (VNR, KFT) +BTP = (CLB, FMF) +SVD = (BGX, XNX) +RHT = (DHH, DNN) +KJS = (FRN, JSB) +BLS = (GVD, BTP) +TJD = (JXR, XFR) +RMS = (HJV, FPM) +MFV = (JVR, NQS) +DXQ = (HVN, TRL) +HSC = (BRM, RPS) +CCP = (GGV, VBL) +GTB = (QKQ, PHV) +RBX = (MLF, MLF) +MDN = (GBX, MJT) +HXC = (KPF, DJL) +HSR = (HGS, LHQ) +BMD = (PHG, SMK) +GTZ = (NFN, VRM) +LDH = (CMS, XSC) +NXJ = (PLB, DGH) +FGR = (GJR, GTQ) +KKV = (RXJ, DXF) +XCQ = (PSD, VGM) +JQQ = (DMS, CDN) +XCS = (GRN, CBK) +JQM = (FNK, DKQ) +DNG = (QGF, TBN) +GBQ = (MXT, LKT) +QLT = (TLH, CXV) +HTL = (NLL, JPX) +DLB = (VRF, THL) +GTQ = (HBJ, HLG) +NBB = (CGM, JJL) +GPB = (FQT, RXC) +QBD = (FPS, JFN) +NHG = (NRN, DVJ) +TRR = (KKV, DKM) +DJB = (XKX, FXL) +CBD = (HRJ, LBX) +CFJ = (BPM, RPN) +TXK = (CFJ, LFS) +TCD = (QTP, TJC) +XTS = (GLG, CCP) +PGN = (KXT, JHK) +BMP = (XVP, DXQ) +CQL = (MXD, DPR) +HGT = (DXV, JMV) +JDJ = (XFR, JXR) +KRB = (HSJ, DGV) +BSR = (VRT, GTK) +RMB = (RGP, FQL) +BKS = (BBD, DSQ) +LQM = (RXD, MFC) +RQC = (FXR, PJJ) +TSC = (RXT, HTS) +XPH = (HGJ, DJF) +NPH = (TGR, SPB) +SCL = (HDJ, PQL) +XHH = (LCK, SKF) +CBL = (MTJ, FGM) +VQF = (QLQ, XLH) +LPL = (HRP, CQP) +VKD = (DMX, XJV) +XJX = (DLV, QFC) +KCC = (TCX, FVV) +GJK = (RMS, RFL) +JTL = (SMR, TTT) +XMG = (JDR, DQD) +PQL = (HSH, HGB) +LCH = (GJK, DMM) +PMJ = (RND, XCQ) +FRN = (SLS, HSC) +CHR = (PPF, TGL) +DFG = (NBC, JBL) +PJJ = (HCS, CMT) +CRJ = (HNP, TDG) +RLF = (JSJ, GMJ) +GKH = (LXJ, RCC) +RNT = (TJD, JDJ) +CLV = (CNF, BGC) +DRN = (FNK, DKQ) +RDG = (XKN, XFJ) +BNF = (CCC, FRR) +HQH = (HPR, RBS) +QJF = (DGP, XJR) +NJF = (PBH, RFS) +FKN = (CBG, BXH) +FSP = (LGP, TNC) +RXD = (SJG, HFK) +PCL = (RCV, CXH) +CLB = (NNT, TKP) +XNX = (JQQ, MSH) +VVQ = (JCK, CLV) +DHH = (DVB, MXV) +MXT = (LJX, PNC) +MFC = (SJG, HFK) +QKQ = (SVD, KRL) +CVR = (FCN, RXM) +RFK = (BVV, TGG) +NBP = (HQH, MGM) +QXX = (VCS, PMN) +PVK = (FRN, JSB) +HCN = (DXJ, VNV) +XLK = (LQB, BCR) +HPR = (HMM, CNT) +VDF = (PHV, QKQ) +KNX = (LGJ, CMC) +PXB = (KPN, BKM) +HNF = (GMJ, JSJ) +DKR = (GKH, TTV) +NGR = (KJS, PVK) +QDC = (XTS, DBT) +LPF = (DJF, HGJ) +LXJ = (FGR, NVX) +NBJ = (RMB, BHB) +QGF = (DSJ, VPV) +KSL = (QFN, RNT) +DHL = (BFS, MTG) +STP = (MGM, HQH) +FMQ = (LJP, LJP) +TGB = (RLT, MMJ) +TLF = (NCD, NMK) +NLS = (PQL, HDJ) +HRG = (SHN, BMD) +DMM = (RMS, RFL) +VPT = (JJT, FHK) +SKF = (JPR, NSG) +NFN = (HTT, HSR) +KGG = (PJL, XQS) +DHB = (CSD, TLJ) +QVA = (VRM, NFN) +SSF = (GHD, CMX) +LFB = (DJB, MGC) +GMJ = (TQP, RLR) +HTS = (GBT, LCF) +FQT = (LDN, XHF) +TFD = (VSC, XFC) +CMC = (PXP, HJK) +VBS = (CSD, TLJ) +DLC = (KHV, XLX) +NKV = (TJL, QRX) +KFV = (GSG, CKG) +GGV = (BVN, PXB) +DKQ = (NKN, VPD) +SLS = (RPS, BRM) +PJP = (VDF, GTB) +BTG = (NLN, HLQ) +VCS = (QTL, QRG) +CSQ = (GKP, VBD) +CCT = (LMF, SVS) +NNT = (TXK, MPJ) +XTH = (XGS, HKC) +SMK = (BKS, SMD) +HCS = (SCN, FSP) +HPT = (NPQ, VFQ) +KPF = (NVF, CDF) +PDH = (KQG, NKR) +PCV = (NJK, MDN) +XXG = (PGN, XDM) +MGC = (FXL, XKX) +QTL = (PDS, MHP) +JLB = (CQL, XRG) +RVN = (DVJ, NRN) +CTP = (FGM, MTJ) +RCC = (FGR, NVX) +CDF = (VHC, CSH) +NKL = (HBC, KVP) +PTV = (XLH, QLQ) +BBF = (QVC, CJQ) +TSJ = (VRT, GTK) +GCV = (SJR, SNZ) +NBF = (MBP, BNS) +PSD = (XNT, STS) +XLH = (LDT, STM) +NFK = (GQV, KFN) +VVX = (CVR, SPJ) +PNS = (VMX, PLS) +RBR = (HRG, SNS) +SBT = (SFJ, NFF) +DBT = (CCP, GLG) +RPN = (KNG, JHR) +XFJ = (HBT, XXG) +JSK = (LGJ, CMC) +CNT = (SHF, MGX) +HBJ = (FMQ, NXV) +VRX = (FJP, QVD) +RBS = (CNT, HMM) +STS = (RXQ, LJS) +DVB = (QJM, HFT) +JRX = (XLX, KHV) +RPJ = (QHG, QVV) +KDB = (GSS, CFM) +LHQ = (MFV, DKC) +RRX = (FKB, NBB) +HTJ = (GJK, DMM) +CDN = (VRD, LDP) +NFS = (RVN, NHG) +XJR = (GTJ, FDJ) +NCT = (DHL, KSX) +NHK = (CTV, PNS) +BGC = (KLN, BDB) +XJN = (MDN, NJK) +MFT = (RMT, QQQ) +RFL = (HJV, FPM) +XQS = (NLS, SCL) +BPH = (XCF, VVX) +SBG = (TSC, XMV) +LNV = (MGT, NKV) +QCH = (CKG, GSG) +JMF = (VNN, VJG) +LQF = (FNV, CNQ) +MVX = (HKV, BLG) +SQC = (VVP, TCD) +PGT = (DJL, KPF) +MFM = (BLG, HKV) +FMD = (VCL, FXV) +VRF = (BBF, CPG) +GTJ = (LKV, BKX) +XGV = (VRJ, DMD) +CTV = (PLS, VMX) +GLR = (RFJ, CJZ) +PXP = (JSC, KDD) +SRD = (SVG, DCR) +GGR = (FMT, JLV) +HSH = (RPK, LRP) +GXF = (QHC, TKN) +GBS = (TQS, HTL) +MHB = (HTL, TQS) +GTK = (DSS, FDN) +DJL = (CDF, NVF) +DPB = (VVQ, DCM) +DCG = (KFV, QCH) +FDX = (SRD, FRQ) +XKP = (QRT, RFR) +FVV = (GQC, TLB) +DMS = (VRD, LDP) +SVS = (KCC, CNC) +PRR = (SJF, BPT) +LFS = (RPN, BPM) +BLN = (XTH, LPV) +SPN = (NMK, NCD) +CMN = (KMC, VSM) +QHJ = (THL, VRF) +JGD = (DTK, SQC) +KCV = (QLN, LNV) +CRQ = (TSJ, BSR) +JFN = (RBX, DMR) +GJF = (NGH, JGS) +VSX = (RNT, QFN) +HQL = (VDF, GTB) +KMC = (HNF, RLF) +XSC = (TFG, XSG) +XDC = (STP, NBP) +PJK = (TCQ, PCL) +DSS = (JXD, FRS) +SMR = (QLS, QLS) +BMQ = (VRX, XMK) +FNB = (SNS, HRG) +BKX = (TFD, JVB) \ No newline at end of file diff --git a/2023/Day08/solution.cs b/2023/Day08/solution.cs new file mode 100644 index 0000000..f94a72c --- /dev/null +++ b/2023/Day08/solution.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using adventofcode; + +namespace aoc2023; + +class solutionDay08 : ISolver +{ + public void SolvePart1() + { + Console.WriteLine($"this is part 1"); + + solutionBase sb = new(); + //var input = sb.getInputLines(@"2023/Day08/testwo").ToArray(); + var input = sb.getInputLines(@"2023/Day08/input").ToArray(); + + Console.WriteLine(input.Length); + Console.WriteLine(input[0].Length); + + char[] directions = new char[input[0].Length]; + directions = input[0].ToArray(); + + Dictionary nodes = new(); + + for (int i = 2; i < input.Length; i++) + { + var item = input[i]; + Console.WriteLine($"this is '{item}'"); + + var nodeName = item.Split('=', StringSplitOptions.TrimEntries)[0]; + var nodeValue = item.Split('=', StringSplitOptions.TrimEntries)[1].Replace("(", "").Replace(")", "");; + + var leftpart = nodeValue.Split(',', StringSplitOptions.TrimEntries)[0]; + var rightpart = nodeValue.Split(',', StringSplitOptions.TrimEntries)[1]; + + Node node = new(leftpart, rightpart); + + nodes.Add(nodeName, node); + } + + string lookupelement = "AAA"; + string target = "ZZZ"; + int count = 0; + + while (lookupelement != target) + { + int i = count % input[0].Length; + + Console.WriteLine($"step {count} - i {i}"); + + if(directions[i] == 'L') + { + lookupelement = nodes[lookupelement].LKey; + } + else if(directions[i] == 'R') + { + lookupelement = nodes[lookupelement].RKey; + } + + count++; + } + + Console.WriteLine($"found {lookupelement} after {count} steps"); + + } + + public void SolvePart2() + { + Console.WriteLine($"under development"); + } + + class Node(string lKey, string rKey) + { + public string LKey { get; } = lKey; + public string RKey { get; } = rKey; + } +} \ No newline at end of file diff --git a/2023/Day08/testone b/2023/Day08/testone new file mode 100644 index 0000000..59e2d47 --- /dev/null +++ b/2023/Day08/testone @@ -0,0 +1,9 @@ +RL + +AAA = (BBB, CCC) +BBB = (DDD, EEE) +CCC = (ZZZ, GGG) +DDD = (DDD, DDD) +EEE = (EEE, EEE) +GGG = (GGG, GGG) +ZZZ = (ZZZ, ZZZ) \ No newline at end of file diff --git a/2023/Day08/testwo b/2023/Day08/testwo new file mode 100644 index 0000000..34ffa8a --- /dev/null +++ b/2023/Day08/testwo @@ -0,0 +1,5 @@ +LLR + +AAA = (BBB, BBB) +BBB = (AAA, ZZZ) +ZZZ = (ZZZ, ZZZ) \ No newline at end of file diff --git a/README.md b/README.md index 6cbef11..e41d389 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,9 @@ using c# with .NET 7 - day02 :star: :star: - day03 :star: - day04 :star: :star: -- day05 +- day05 :star: - day06 :star: :star: -- day07 +- day07 :star: # overview 2022 - day01 :star: :star: From 44efe94c18e2e82f639f87f4608b603be572acf8 Mon Sep 17 00:00:00 2001 From: deckelmouck Date: Fri, 8 Dec 2023 19:06:20 +0100 Subject: [PATCH 10/14] solved day08 part2 --- 2023/Day08/solution.cs | 158 ++++++++++++++++++++++++++++++++- 2023/Day08/testghosts | 10 +++ 2023/Day08/{testwo => testtwo} | 0 3 files changed, 166 insertions(+), 2 deletions(-) create mode 100644 2023/Day08/testghosts rename 2023/Day08/{testwo => testtwo} (100%) diff --git a/2023/Day08/solution.cs b/2023/Day08/solution.cs index f94a72c..a4fd3d4 100644 --- a/2023/Day08/solution.cs +++ b/2023/Day08/solution.cs @@ -12,7 +12,7 @@ public void SolvePart1() Console.WriteLine($"this is part 1"); solutionBase sb = new(); - //var input = sb.getInputLines(@"2023/Day08/testwo").ToArray(); + //var input = sb.getInputLines(@"2023/Day08/testtwo").ToArray(); var input = sb.getInputLines(@"2023/Day08/input").ToArray(); Console.WriteLine(input.Length); @@ -67,7 +67,159 @@ public void SolvePart1() public void SolvePart2() { - Console.WriteLine($"under development"); + Console.WriteLine($"part two"); + + solutionBase sb = new(); + //var input = sb.getInputLines(@"2023/Day08/testghosts").ToArray(); + var input = sb.getInputLines(@"2023/Day08/input").ToArray(); + + Console.WriteLine(input.Length); + Console.WriteLine(input[0].Length); + + char[] directions = new char[input[0].Length]; + directions = input[0].ToArray(); + + Dictionary nodes = new(); + + for (int i = 2; i < input.Length; i++) + { + var item = input[i]; + //Console.WriteLine($"this is '{item}'"); + + var nodeName = item.Split('=', StringSplitOptions.TrimEntries)[0]; + var nodeValue = item.Split('=', StringSplitOptions.TrimEntries)[1].Replace("(", "").Replace(")", "");; + + var leftpart = nodeValue.Split(',', StringSplitOptions.TrimEntries)[0]; + var rightpart = nodeValue.Split(',', StringSplitOptions.TrimEntries)[1]; + + Node node = new(leftpart, rightpart); + + nodes.Add(nodeName, node); + } + + foreach (var item in nodes) + { + Console.WriteLine($"{item.Key} - {item.Value.LKey} - {item.Value.RKey}"); + } + + List lookupelements = nodes.Where(x => x.Key.EndsWith("A")).Select(x => x.Key).ToList(); + + Console.WriteLine($"found {lookupelements.Count} starting points"); + //int count = 0; + + foreach (var item in lookupelements) + { + Console.WriteLine($"starting point {item}"); + } + + List counts = new(); + + foreach (var item in lookupelements) + { + long steps = Steps2Z(item); + counts.Add(steps); + Console.WriteLine($"steps to Z {steps}"); + } + + // calculate the least common multiple of all counts + long lcm = CalculateLCM(counts.ToArray()); + + Console.WriteLine($"LCM of the array is: {lcm}"); + + // this is too slow.. + // while (lookupelements.Count > lookupelements.Count(x => x.EndsWith("Z"))) + // { + // int i = count % input[0].Length; + + // //Console.WriteLine($"step {count} - i {i} - direction {directions[i]}"); + + // if(directions[i] == 'L') + // { + // for (int j = 0; j < lookupelements.Count; j++) + // { + // lookupelements[j] = nodes[lookupelements[j]].LKey; + // } + // //lookupelement = nodes[lookupelement].LKey; + // } + // else if(directions[i] == 'R') + // { + // for (int j = 0; j < lookupelements.Count; j++) + // { + // lookupelements[j] = nodes[lookupelements[j]].RKey; + // } + // //lookupelement = nodes[lookupelement].RKey; + // } + + // // foreach (var item in lookupelements) + // // { + // // Console.WriteLine($"actual point {item}"); + // // } + + // count++; + // //if (count > 20) break; + // //if(count % 1000000 == 0) + // //Console.WriteLine($"step {count} - {lookupelements.Count} - {lookupelements.Count(x => x.EndsWith("Z"))}"); + // } + + //Console.WriteLine($"found {lookupelements.Count} with ending Z after {count} steps"); + + int Steps2Z(string lookupelement) + { + //string lookupelement = input; //"AAA"; + //string target = "ZZZ"; + int count = 0; + + while (!lookupelement.EndsWith("Z")) + { + int i = count % input[0].Length; + + //Console.WriteLine($"step {count} - i {i}"); + + if(directions[i] == 'L') + { + lookupelement = nodes[lookupelement].LKey; + } + else if(directions[i] == 'R') + { + lookupelement = nodes[lookupelement].RKey; + } + + count++; + } + + return count; + } + // Function to calculate the GCD using Euclidean algorithm + static long CalculateGCD(long a, long b) + { + while (b != 0) + { + long temp = b; + b = a % b; + a = temp; + } + return a; + } + + // Function to calculate the LCM of an array of integers + static long CalculateLCM(long[] numbers) + { + // Validate that the array is not empty + if (numbers.Length == 0) + { + throw new ArgumentException("Array cannot be empty."); + } + + long lcm = numbers[0]; + + for (long i = 1; i < numbers.Length; i++) + { + // LCM(lcm, numbers[i]) = (lcm * numbers[i]) / GCD(lcm, numbers[i]) + lcm = (lcm * numbers[i]) / CalculateGCD(lcm, numbers[i]); + } + + return lcm; + } } class Node(string lKey, string rKey) @@ -75,4 +227,6 @@ class Node(string lKey, string rKey) public string LKey { get; } = lKey; public string RKey { get; } = rKey; } + + } \ No newline at end of file diff --git a/2023/Day08/testghosts b/2023/Day08/testghosts new file mode 100644 index 0000000..a8e2c98 --- /dev/null +++ b/2023/Day08/testghosts @@ -0,0 +1,10 @@ +LR + +11A = (11B, XXX) +11B = (XXX, 11Z) +11Z = (11B, XXX) +22A = (22B, XXX) +22B = (22C, 22C) +22C = (22Z, 22Z) +22Z = (22B, 22B) +XXX = (XXX, XXX) \ No newline at end of file diff --git a/2023/Day08/testwo b/2023/Day08/testtwo similarity index 100% rename from 2023/Day08/testwo rename to 2023/Day08/testtwo From 186c1f744362e0ad735552972ecfa39cdb0d1c00 Mon Sep 17 00:00:00 2001 From: deckelmouck Date: Sat, 9 Dec 2023 17:49:23 +0100 Subject: [PATCH 11/14] try to solve day9 part1 --- 2023/Day09/input | 200 +++++++++++++++++++++++++++++++++++++++++ 2023/Day09/solution.cs | 105 ++++++++++++++++++++++ 2023/Day09/test | 3 + 3 files changed, 308 insertions(+) create mode 100644 2023/Day09/input create mode 100644 2023/Day09/solution.cs create mode 100644 2023/Day09/test diff --git a/2023/Day09/input b/2023/Day09/input new file mode 100644 index 0000000..9eaf107 --- /dev/null +++ b/2023/Day09/input @@ -0,0 +1,200 @@ +13 23 46 97 206 436 919 1924 3971 8016 15765 30243 56875 105604 195153 361805 677725 1289089 2494076 4898137 9713336 +-7 6 44 130 309 672 1404 2864 5712 11113 21082 39112 71386 129156 233312 422773 769075 1400300 2538072 4551386 8029995 +-4 10 38 80 136 206 290 388 500 626 766 920 1088 1270 1466 1676 1900 2138 2390 2656 2936 +6 22 45 75 118 191 327 580 1030 1788 3001 4857 7590 11485 16883 24186 33862 46450 62565 82903 108246 +6 9 3 -13 -36 -44 46 466 1757 5034 12396 27528 56549 109167 200209 351601 594880 974327 1550817 2406489 3650346 +18 32 43 49 49 49 78 219 663 1804 4416 9995 21416 44153 88445 172969 330808 618784 1131569 2022397 3532683 +24 43 71 108 154 209 273 346 428 519 619 728 846 973 1109 1254 1408 1571 1743 1924 2114 +6 15 29 51 84 131 195 279 386 519 681 875 1104 1371 1679 2031 2430 2879 3381 3939 4556 +1 1 -4 -16 -25 8 184 735 2161 5488 12747 27876 58445 118951 236991 464473 897257 1708331 3201934 5899064 10668691 +1 9 26 62 136 276 514 870 1313 1689 1629 525 -2148 -5472 -3189 25675 137017 461857 1281452 3160632 7174504 +24 41 60 75 78 57 -8 -151 -428 -927 -1780 -3177 -5382 -8751 -13752 -20987 -31216 -45383 -64644 -90397 -124314 +12 20 43 87 160 290 567 1227 2801 6357 13868 28744 56571 106105 190574 329346 550026 891050 1404849 2161661 3254074 +26 42 58 71 89 144 318 793 1947 4551 10188 22125 47034 98189 201074 402733 786688 1495856 2766622 4978083 8721479 +9 18 47 102 202 401 817 1671 3349 6520 12388 23262 43870 84366 167046 340850 711513 1501874 3168053 6615410 13586842 +8 14 26 44 79 174 436 1078 2472 5216 10220 18818 32915 55180 89298 140296 214960 322362 474518 687200 980927 +1 3 20 74 204 488 1090 2344 4898 9972 19850 38845 75167 144405 275720 522347 978623 1806489 3275240 5819188 10118814 +20 36 57 83 114 150 191 237 288 344 405 471 542 618 699 785 876 972 1073 1179 1290 +23 34 40 48 79 180 457 1140 2694 6009 12747 26005 51580 100305 192174 363299 677153 1242060 2237506 3952574 6840661 +8 15 24 42 81 153 268 437 685 1100 1991 4320 10764 28175 73069 183472 443566 1032945 2321042 5040898 10596771 +4 10 24 43 74 152 380 1009 2582 6171 13737 28637 56286 104953 186625 317809 520056 819880 1247606 1834511 2607418 +24 44 77 139 255 470 878 1684 3336 6799 14098 29352 60697 123823 248435 489943 950296 1814366 3411995 6321153 11535115 +19 31 59 117 218 374 596 894 1277 1753 2329 3011 3804 4712 5738 6884 8151 9539 11047 12673 14414 +12 33 78 169 336 633 1179 2237 4349 8562 16818 32654 62498 118130 221468 414062 776118 1464511 2787642 5349519 10319560 +6 25 52 88 142 230 367 544 692 670 390 326 2868 15311 55767 164035 420607 978910 2119697 4345211 8551659 +-5 -4 7 47 152 382 828 1619 2929 4984 8069 12535 18806 27386 38866 53931 73367 98068 129043 167423 214468 +0 8 31 73 150 317 705 1559 3271 6413 11804 20724 35592 61916 113439 224826 481282 1084644 2495329 5727341 12944138 +17 25 50 113 247 511 1011 1935 3618 6663 12155 22017 39570 70373 123434 212899 360343 597805 971728 1547985 2418193 +-1 11 52 145 321 619 1086 1777 2755 4091 5864 8161 11077 14715 19186 24609 31111 38827 47900 58481 70729 +1 12 29 57 108 216 468 1052 2323 4888 9711 18239 32550 55524 91038 144186 221525 331348 483985 692133 971216 +12 28 67 137 255 469 892 1760 3544 7173 14463 28900 56998 110548 210183 390779 709232 1254986 2163159 3628955 5919877 +18 26 37 69 159 376 839 1737 3348 6061 10430 17351 28579 48027 84656 158325 310782 625108 1258451 2494889 4827831 +17 29 63 137 288 584 1137 2127 3862 6926 12504 23012 43186 81774 153897 283957 508619 878815 1458833 2319271 3518848 +12 33 71 137 257 478 874 1552 2658 4383 6969 10715 15983 23204 32884 45610 62056 82989 109275 141885 181901 +12 28 49 76 113 182 347 738 1577 3231 6348 12176 23246 44780 87596 174181 351487 717876 1479589 3068493 6386422 +-7 -1 17 47 97 191 384 800 1723 3795 8424 18610 40612 87300 184845 385966 796054 1624768 3288496 6614938 13252176 +16 25 40 60 98 208 521 1283 2901 6037 11855 22634 43133 83390 164214 327891 659530 1331133 2695222 5486076 11249640 +5 1 -3 -7 -11 -15 -19 -23 -27 -31 -35 -39 -43 -47 -51 -55 -59 -63 -67 -71 -75 +-1 0 20 69 167 353 704 1379 2703 5306 10332 19733 36663 65987 114920 193811 317087 504372 781796 1183509 1753415 +2 3 4 19 89 297 788 1809 3805 7642 15088 29780 59043 117084 230178 444302 834916 1516804 2648886 4425710 7048281 +9 23 54 114 223 423 799 1519 2927 5754 11569 23708 49147 102203 211662 434082 877765 1744413 3398952 6482562 12089647 +17 37 61 83 106 162 346 871 2151 4919 10387 20455 37976 67084 113592 185467 293389 451401 677657 995275 1433302 +16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 +13 30 54 86 134 222 399 748 1395 2518 4356 7218 11492 17654 26277 38040 53737 74286 100738 134286 176274 +-4 8 44 123 269 513 902 1517 2514 4228 7431 13939 27982 59219 129286 285925 633337 1397010 3060897 6653815 14337180 +9 10 7 10 49 194 592 1530 3549 7659 15749 31379 61343 118803 229564 444399 862521 1674696 3239547 6213864 11767869 +14 39 81 143 232 378 681 1404 3145 7147 15848 33856 69715 139224 271888 523649 1001864 1913279 3653475 6968245 13235306 +9 23 61 135 270 529 1048 2081 4055 7635 13799 23923 39876 64125 99850 151069 222773 321071 453345 628415 856714 +23 43 70 116 214 439 946 2030 4218 8423 16243 30611 57276 108191 209139 416469 852765 1780599 3750593 7890457 16454556 +9 26 52 87 130 189 296 517 942 1635 2519 3166 2457 -1928 -14235 -41626 -95489 -193128 -359898 -631855 -1058996 +-3 -11 -12 6 65 215 557 1273 2680 5362 10515 20798 42263 88397 188021 399842 837947 1714583 3409322 6577322 12314041 +7 21 39 54 65 88 167 385 875 1831 3519 6288 10581 16946 26047 38675 55759 78377 107767 145338 192681 +16 26 42 78 166 379 875 1971 4256 8752 17132 32004 57270 98569 163813 263825 413088 630614 940942 1375274 1972758 +23 28 37 56 93 165 324 713 1673 3961 9224 21028 46997 103022 221119 463435 946235 1879594 3631143 6825792 12498133 +18 28 45 76 134 248 472 890 1614 2772 4483 6816 9730 12992 16070 17998 17210 11340 -3015 -30572 -77682 +13 31 63 116 202 341 562 919 1554 2854 5764 12333 26585 55822 112481 216682 399619 707961 1209445 1999858 3211620 +9 12 27 65 144 291 558 1064 2069 4083 8026 15510 29459 55604 106049 207437 419000 871647 1851981 3982751 8610147 +1 20 49 87 144 245 442 844 1672 3349 6664 13132 25855 51571 105380 221323 475498 1035585 2265214 4940856 10697077 +20 31 41 43 33 21 43 167 482 1055 1837 2495 2143 -1059 -10473 -31757 -73888 -150481 -281455 -495101 -830611 +24 31 34 39 72 206 598 1537 3515 7346 14369 26776 48101 83887 142511 236088 381290 599801 917980 1365117 1969438 +11 27 57 121 245 471 881 1632 3001 5458 9834 17743 32565 61514 119614 236800 469863 921581 1770135 3312813 6029069 +13 30 46 68 122 255 537 1080 2099 4042 7807 15049 28588 53036 96143 172417 313188 593395 1199071 2589143 5867173 +5 24 53 95 161 279 514 1006 2043 4217 8784 18496 39443 84916 183116 391935 826470 1709219 3460544 6860658 13338822 +14 32 60 103 163 246 395 763 1752 4272 10222 23377 51012 106855 216409 426451 821902 1555956 2904856 5370003 9872717 +23 45 92 172 303 525 918 1640 3015 5736 11310 22969 47411 97926 199712 398503 774023 1460255 2675080 4762506 8251479 +8 13 34 87 201 419 809 1511 2859 5645 11645 24625 52228 109491 225421 455418 905058 1776117 3455960 6690231 12911995 +27 39 62 123 268 576 1178 2283 4221 7523 13080 22476 38702 67666 121264 223324 420543 801679 1529818 2894601 5393968 +14 21 31 34 15 -46 -174 -399 -756 -1285 -2031 -3044 -4379 -6096 -8260 -10941 -14214 -18159 -22861 -28410 -34901 +3 10 25 46 84 190 509 1380 3520 8372 18768 40160 82803 165428 321110 606202 1113353 1989734 3461635 5866538 9693582 +0 9 35 82 158 287 535 1071 2306 5184 11734 26021 55642 113880 222530 415216 740692 1265123 2071629 3254396 4903358 +6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 +7 12 17 22 27 32 37 42 47 52 57 62 67 72 77 82 87 92 97 102 107 +-2 -1 -3 -14 -30 -30 35 260 811 1952 4055 7541 12635 18705 22775 16533 -19228 -124323 -375327 -911356 -1973816 +-5 -5 7 49 160 420 993 2210 4717 9725 19417 37596 70711 129506 231764 407081 705499 1213455 2083311 3587347 6214382 +12 29 61 121 222 371 565 787 1002 1165 1278 1574 2966 7981 22506 58808 140456 309973 640283 1251295 2333286 +12 37 74 123 184 257 342 439 548 669 802 947 1104 1273 1454 1647 1852 2069 2298 2539 2792 +16 40 91 188 358 639 1083 1759 2756 4186 6187 8926 12602 17449 23739 31785 41944 54620 70267 89392 112558 +21 33 45 52 47 22 -23 -46 127 997 3763 10966 27533 62382 130787 257744 482625 865457 1495217 2500592 4063715 +11 27 56 95 149 255 524 1218 2891 6635 14484 30041 59405 112487 204816 359948 612603 1012667 1630208 2561667 3937397 +-4 2 24 86 222 480 948 1815 3485 6773 13239 25787 49822 95600 183048 351463 678422 1315463 2553596 4941421 9496582 +2 -7 -17 -11 54 255 702 1538 2967 5353 9441 16740 30063 54121 95894 164225 267672 409073 574491 713167 703772 +17 36 65 112 195 355 697 1471 3217 7026 15015 31180 62889 123456 236632 444752 824221 1515854 2784479 5133532 9517231 +2 2 7 14 15 -3 -58 -168 -318 -344 376 3631 13862 41085 106404 252178 560806 1190354 2444946 4919463 9804667 +-3 -3 -8 -25 -68 -163 -349 -660 -1056 -1251 -373 3606 14711 40089 91426 186737 352847 629405 1076250 1787593 2919062 +11 38 92 198 404 794 1506 2771 4997 8940 16058 29279 54708 105384 209300 425892 878717 1818165 3738797 7595280 15197340 +4 22 51 91 159 315 707 1644 3706 7906 15942 30629 56703 102388 182507 324665 581418 1053878 1936935 3605539 6780609 +3 4 6 17 57 167 418 920 1831 3366 5806 9507 14909 22545 33050 47170 65771 89848 120534 159109 207009 +9 19 50 107 204 386 770 1609 3391 7016 14173 28216 56206 113507 233663 488650 1028597 2156561 4464100 9068785 18017472 +8 6 4 -5 -24 -32 57 461 1629 4398 10294 22203 45938 93846 192838 401646 846714 1794630 3794236 7948031 16417184 +5 12 24 46 95 206 446 956 2058 4501 9988 22236 48984 105591 221168 448576 880107 1671258 3075720 5495546 9551445 +20 41 76 138 261 526 1100 2303 4744 9603 19180 37882 73873 141668 266008 487407 869812 1510861 2555260 4211826 6774757 +3 6 18 59 158 353 691 1228 2029 3168 4728 6801 9488 12899 17153 22378 28711 36298 45294 55863 68178 +-6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 +18 25 38 71 154 353 801 1736 3534 6719 11936 19902 31431 47806 72110 112722 191158 357953 722542 1506357 3132916 +-4 -4 -2 2 8 16 26 38 52 68 86 106 128 152 178 206 236 268 302 338 376 +1 5 14 35 72 123 185 270 437 858 1970 4843 12061 29744 71949 169761 389261 865947 1869614 3926351 8049450 +10 14 35 85 184 371 715 1326 2366 4060 6707 10691 16492 24697 36011 51268 71442 97658 131203 173537 226304 +17 27 40 52 55 35 -24 -123 -204 -40 1036 4758 15262 41708 103078 236445 510523 1046945 2052488 3866384 7027937 +14 35 59 79 82 52 -8 -26 220 1210 3805 9364 19824 37701 65958 107673 165426 240309 330447 428901 520806 +7 34 81 148 241 379 612 1060 1983 3903 7834 15755 31611 63382 127161 254777 507343 998264 1930775 3657070 6768613 +27 54 90 137 215 373 714 1462 3114 6750 14645 31484 66804 139927 289908 595522 1215293 2467390 4988160 10043503 20131333 +-3 7 31 80 172 338 635 1176 2192 4140 7875 14931 28026 52049 96078 177612 331616 630033 1223598 2429432 4908353 +-5 -10 -7 29 147 444 1105 2468 5126 10089 19059 34931 62734 111379 196797 347340 612693 1078016 1885613 3267121 5590037 +16 21 31 56 120 278 650 1477 3201 6568 12750 23479 41183 69111 111431 173282 260758 380799 540961 749034 1012474 +7 25 67 152 315 620 1190 2282 4450 8854 17788 35515 69512 132243 243593 434111 749225 1254607 2042881 3241882 5024689 +11 36 85 178 342 623 1111 1991 3656 6945 13605 27133 54251 107430 209138 398861 744402 1359335 2428352 4240735 7227845 +8 14 21 44 125 340 799 1644 3069 5426 9551 17553 34466 71378 150931 316441 646326 1276062 2430521 4470290 7956435 +-3 -10 -20 -28 -19 44 243 743 1845 4045 8078 14916 25700 41678 64543 98429 156809 281636 589856 1376300 3325427 +19 41 73 119 186 280 402 556 799 1384 3069 7695 19208 45513 102135 220101 463635 969699 2033581 4286419 9047366 +9 14 36 89 204 442 905 1745 3171 5454 8930 14001 21134 30858 43759 60473 81677 108078 140400 179369 225696 +7 21 58 144 326 688 1382 2676 5023 9171 16382 28935 51303 92815 173441 335978 671180 1368830 2820287 5821759 11971085 +-4 -2 10 54 179 490 1191 2654 5539 11008 21109 39481 72705 132996 243637 449773 839098 1579738 2986320 5629696 10510627 +-5 -9 -15 -23 -33 -45 -59 -75 -93 -113 -135 -159 -185 -213 -243 -275 -309 -345 -383 -423 -465 +11 27 67 140 261 473 889 1762 3591 7271 14295 27016 48977 85317 143261 232702 366883 563187 844043 1237956 1780669 +-3 -5 3 45 164 432 977 2053 4189 8471 17055 34100 67463 131722 253412 479864 893977 1639171 2962687 5293055 9381682 +7 3 -1 -5 -9 -13 -17 -21 -25 -29 -33 -37 -41 -45 -49 -53 -57 -61 -65 -69 -73 +-2 6 20 46 95 183 331 565 916 1420 2118 3056 4285 5861 7845 10303 13306 16930 21256 26370 32363 +4 27 60 94 130 207 458 1210 3150 7596 16947 35457 70626 135812 255313 474469 879864 1639433 3080750 5840376 11141418 +30 40 49 57 68 109 275 817 2306 5932 14031 30970 64562 128262 244604 450863 809062 1424596 2481377 4306931 7488472 +17 38 73 138 269 531 1032 1952 3610 6617 12200 22838 43451 83581 161394 311059 596331 1135260 2144231 4014470 7441293 +19 24 27 37 69 150 339 777 1806 4236 9900 22732 50766 109764 229823 467712 930781 1824952 3553109 6917463 13530779 +15 25 45 88 176 341 638 1175 2166 4017 7462 13776 25105 44969 79013 136103 229889 380985 619947 991264 1558614 +10 26 67 154 322 624 1145 2050 3709 6973 13719 27834 56858 114544 224615 426015 780029 1380065 2366608 3955639 6505607 +0 11 38 96 213 433 816 1440 2418 3951 6446 10736 18447 32565 58264 104064 183396 316659 533862 877952 1408937 +-5 -2 6 19 37 60 88 121 159 202 250 303 361 424 492 565 643 726 814 907 1005 +7 8 10 13 17 22 28 35 43 52 62 73 85 98 112 127 143 160 178 197 217 +18 24 35 50 72 128 296 746 1820 4208 9330 20124 42597 88779 182255 368507 734433 1445718 2819290 5464722 10559977 +19 34 58 88 120 149 179 259 567 1570 4294 10744 24520 51681 101915 190079 338179 577866 953530 1526080 2377504 +12 26 59 124 230 392 667 1240 2611 5979 13985 32066 70789 149681 303251 590116 1106398 2004856 3521559 6012296 10001360 +18 36 75 148 268 448 701 1040 1478 2028 2703 3516 4480 5608 6913 8408 10106 12020 14163 16548 19188 +9 21 48 111 250 530 1056 2010 3741 6985 13383 26632 54914 115835 246209 521028 1089449 2241425 4527818 8970897 17422850 +3 5 11 22 48 116 278 619 1265 2391 4229 7076 11302 17358 25784 37217 52399 72185 97551 129602 169580 +7 4 -3 -14 -29 -48 -71 -98 -129 -164 -203 -246 -293 -344 -399 -458 -521 -588 -659 -734 -813 +10 22 58 129 242 409 672 1150 2117 4123 8173 15982 30327 55520 98029 167277 276652 444764 696988 1067335 1600696 +13 28 56 105 179 279 417 660 1227 2671 6209 14357 32257 70571 151776 323527 686257 1448906 3039526 6321693 13012007 +10 11 15 30 73 187 470 1119 2509 5367 11187 23209 48630 103358 221787 476160 1013788 2126863 4380707 8844928 17502431 +19 36 73 141 246 382 532 686 877 1225 1970 3478 6236 10939 18951 33743 64439 133418 291127 642979 1395586 +6 32 88 200 409 772 1366 2314 3874 6672 12223 23972 49209 102403 210849 424209 830870 1586548 2965002 5448180 9885105 +3 8 19 36 59 88 123 164 211 264 323 388 459 536 619 708 803 904 1011 1124 1243 +0 -3 5 37 113 274 617 1366 3002 6501 13782 28566 58048 116225 230699 456855 907515 1814172 3650322 7372038 14870974 +0 19 59 126 225 365 569 889 1426 2355 3955 6644 11019 17901 28385 43895 66244 97699 141051 199690 277685 +11 26 55 106 200 377 714 1378 2745 5635 11759 24571 50905 104115 210015 417862 820107 1586876 3024411 5671340 10453066 +13 8 13 51 164 430 993 2125 4348 8650 16835 32057 59607 108056 190913 329043 554215 914324 1481065 2361143 3712494 +19 27 31 31 27 19 7 -9 -29 -53 -81 -113 -149 -189 -233 -281 -333 -389 -449 -513 -581 +7 6 11 30 71 142 251 406 615 886 1227 1646 2151 2750 3451 4262 5191 6246 7435 8766 10247 +17 41 83 155 274 458 719 1057 1471 2022 3013 5416 11838 28713 71313 175132 421247 991316 2283386 5148637 11361490 +10 22 44 76 118 170 232 304 386 478 580 692 814 946 1088 1240 1402 1574 1756 1948 2150 +5 7 14 31 63 114 192 330 633 1361 3058 6737 14131 28020 52644 94212 161517 266667 425942 660787 998951 +10 11 18 47 129 315 684 1368 2625 5010 9718 19209 38284 75878 147990 282404 526196 957501 1703666 2968779 5074683 +3 9 15 21 27 33 39 45 51 57 63 69 75 81 87 93 99 105 111 117 123 +1 2 1 -10 -31 -41 24 316 1159 3184 7529 16159 32500 62915 120250 232087 459219 935950 1957040 4164915 8952479 +21 35 48 68 117 248 575 1320 2894 6052 12213 24160 47615 94751 191745 394246 817455 1691793 3461354 6951076 13640477 +10 31 64 115 204 366 661 1208 2266 4411 8929 18707 40223 87797 192183 417052 889342 1853707 3769186 7481203 14530338 +16 29 69 151 300 569 1067 1998 3718 6842 12496 22937 42996 83194 166045 338218 693377 1414688 2854176 5681928 11167621 +4 17 40 86 186 408 901 1986 4331 9261 19263 38750 75167 140633 254725 450201 786413 1381772 2490389 4675201 9181539 +15 31 52 90 166 310 561 967 1585 2481 3730 5416 7632 10480 14071 18525 23971 30547 38400 47686 58570 +10 29 59 104 171 280 496 1007 2292 5456 12864 29305 64113 135074 275765 549603 1077102 2089119 4030930 7764569 14957893 +8 32 74 152 309 623 1225 2333 4322 7887 14438 27021 52323 104736 214077 439448 892940 1778514 3453514 6522974 11980273 +14 25 45 74 113 173 285 510 964 1899 3925 8548 19387 44795 103243 233860 516166 1105745 2297468 4637363 9123483 +-7 -9 2 42 127 279 539 998 1881 3767 8114 18407 42520 97423 218483 477938 1021879 2144437 4435508 9070042 18361211 +2 3 1 -11 -36 -65 -67 23 318 995 2313 4633 8440 14367 23221 36011 53978 78627 111761 155517 212404 +-4 -3 8 41 127 338 813 1789 3643 6957 12625 22029 37320 61850 100812 162157 257870 405701 631462 972017 1479109 +5 4 10 38 120 316 731 1544 3055 5756 10432 18298 31178 51732 83737 132428 204905 310612 461894 674638 969004 +23 40 65 97 145 237 423 782 1451 2698 5062 9587 18208 34465 65055 123550 239469 479962 1000077 2155915 4752833 +6 11 23 41 56 51 6 -92 -234 -369 -379 -49 968 3191 7356 14466 25846 43203 68691 104981 155336 +3 14 40 99 222 471 973 1978 3961 7802 15099 28714 53761 99496 183107 337505 627435 1182642 2265502 4407205 8677732 +15 22 35 65 125 231 408 701 1191 2016 3397 5669 9317 15017 23682 36513 55055 81258 117543 166873 232829 +13 15 22 46 108 238 475 867 1471 2353 3588 5260 7462 10296 13873 18313 23745 30307 38146 47418 58288 +10 14 30 66 131 240 432 807 1586 3191 6341 12204 22828 42593 82667 173150 393155 940161 2281533 5472143 12798414 +8 17 41 86 174 362 760 1556 3084 6025 11925 24374 51469 110698 238396 508039 1066177 2204547 4507512 9156526 18558761 +7 27 55 104 214 474 1061 2317 4899 10051 20061 38980 73694 135454 241983 420293 710359 1169811 1879819 2952360 4539070 +21 31 57 123 271 581 1214 2486 4989 9793 18802 35423 65897 122057 227165 428294 822253 1608595 3194807 6398347 12822067 +5 16 46 115 260 545 1087 2106 4013 7582 14326 27342 53155 105549 213132 433634 880121 1768543 3505104 6852298 13257950 +-8 -18 -36 -63 -95 -121 -122 -71 66 328 756 1389 2259 3385 4766 6373 8140 9954 11644 12969 13605 +5 23 59 123 228 390 628 964 1423 2033 2825 3833 5094 6648 8538 10810 13513 16699 20423 24743 29720 +25 35 56 96 171 325 666 1438 3166 6937 14921 31304 63925 127127 246738 468893 876059 1617167 2966314 5440124 10034771 +29 46 68 106 176 307 563 1077 2101 4089 7857 14922 28250 53929 104915 209369 429033 899314 1915842 4119400 8885928 +7 6 8 13 32 111 374 1095 2820 6588 14353 29809 60022 118697 232793 455988 895961 1768874 3505814 6955337 13758096 +-5 9 36 74 130 239 504 1169 2737 6145 13008 25944 48992 88135 151940 252327 405479 632905 962668 1430790 2082846 +24 38 51 65 89 139 238 416 710 1164 1829 2763 4031 5705 7864 10594 13988 18146 23175 29189 36309 +8 12 25 57 127 259 476 803 1301 2176 4059 8668 20299 49050 117525 274253 619578 1353888 2864529 5877639 11715811 +8 18 41 81 141 223 341 557 1052 2245 4975 10769 22245 43786 82899 153459 283992 538500 1066173 2213033 4758245 +-6 -4 2 5 2 10 94 425 1412 4000 10308 24916 57330 126508 268886 552198 1098715 2123770 3999783 7365629 13323955 +8 5 10 38 115 294 678 1444 2869 5374 9626 16779 29024 50837 91836 173300 342697 704862 1486077 3160259 6687872 +5 -1 -1 24 119 366 897 1923 3806 7224 13521 25407 48292 92721 178645 342640 649699 1211901 2217139 3972202 6965893 +0 14 41 89 173 314 549 976 1886 4071 9452 22273 51311 113943 243619 503542 1011599 1985716 3826524 7268507 13656492 +8 16 35 63 99 154 273 574 1317 3041 6865 15156 32948 70816 150540 316231 656430 1348482 2747675 5564101 11205817 +18 26 34 42 50 58 66 74 82 90 98 106 114 122 130 138 146 154 162 170 178 +26 45 68 95 126 161 200 243 290 341 396 455 518 585 656 731 810 893 980 1071 1166 +13 31 72 145 259 423 646 937 1305 1759 2308 2961 3727 4615 5634 6793 8101 9567 11200 13009 15003 +19 30 43 64 111 222 460 924 1800 3522 7160 15210 33030 71246 149543 302358 587105 1095686 1970177 3423724 5767841 +-1 -3 -8 -26 -72 -155 -241 -171 489 2695 8307 20654 45335 91306 172310 308804 530964 884730 1446663 2362839 3948615 +0 15 52 125 264 529 1024 1911 3424 5883 9708 15433 23720 35373 51352 72787 100992 137479 183972 242421 315016 +10 17 36 94 246 603 1381 2979 6094 11881 22166 39720 68602 114579 185631 292549 449634 675505 994024 1435346 2037102 +2 5 5 2 -4 -13 -25 -40 -58 -79 -103 -130 -160 -193 -229 -268 -310 -355 -403 -454 -508 +-3 3 17 37 73 154 325 644 1205 2230 4291 8742 18461 39023 80447 159683 304029 555693 977741 1661699 2737105 +8 13 26 64 158 359 744 1434 2658 4926 9421 18808 38833 81444 170909 355931 733854 1499311 3042418 6147952 12401826 +-9 -5 8 27 42 39 21 58 378 1509 4475 11051 24144 48600 93345 177119 342852 691330 1455909 3161838 6955781 +6 4 11 39 99 201 354 566 844 1194 1621 2129 2721 3399 4164 5016 5954 6976 8079 9259 10511 +0 -8 -12 4 69 236 599 1312 2617 4909 8893 15917 28592 51831 94450 171471 307246 539478 924146 1541242 2501095 +10 10 16 32 62 110 180 276 402 562 760 1000 1286 1622 2012 2460 2970 3546 4192 4912 5710 \ No newline at end of file diff --git a/2023/Day09/solution.cs b/2023/Day09/solution.cs new file mode 100644 index 0000000..4243778 --- /dev/null +++ b/2023/Day09/solution.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using adventofcode; + +namespace aoc2023; + +class solutionDay09 : ISolver +{ + public void SolvePart1() + { + Console.WriteLine($"this is part 1"); + + solutionBase sb = new(); + //var input = sb.getInputLines(@"2023/Day09/test").ToArray(); + var input = sb.getInputLines(@"2023/Day09/input").ToArray(); + + long solution = 0; + + for (int i = 0; i < input.Length; i++) + { + var line = input[i].Split(" "); + //Console.WriteLine(line.Length); + + //hint found - next value of last values each sequence + List lastValues = new List(); + + //initial sequence length + int sequenceLength = line.Length; + + //for temporary storage of last line + long[] lastLine = new long[sequenceLength]; + + //init with starting sequence + lastLine = line.Select(x => Convert.ToInt64(x)).ToArray(); + + //save last value for later + lastValues.Add(lastLine[^1]); + + //ArrayOutput(lastLine); + + for (int l = 0; l < sequenceLength; l++) + { + long[] newline = new long[sequenceLength - 1]; + + //create new sequence + for (int j = 0; j < newline.Length; j++) + { + long left = Convert.ToInt64(lastLine[j]); + long right = Convert.ToInt64(lastLine[j + 1]); + + long newValue = right - left; + + // if(left > right) + // { + // newValue = left - right; + // } + // else + // { + // newValue = right - left; + // } + + newline[j] = newValue; + } + + //save last value for later + lastValues.Add(newline[^1]); + + //ArrayOutput(newline); + + //reduce sequence length for next iteration + sequenceLength--; + + //put new sequence in temp storage + lastLine = newline; + + //check if all values are 0 + var sum = newline.Sum(); + if(sum == 0) + { + //Console.WriteLine($"line {i} is a solution"); + break; + } + } + + Console.WriteLine($"{lastValues.Sum()}"); + solution += lastValues.Sum(); + } + Console.WriteLine($"solution is {solution}"); + } + + public void SolvePart2() + { + Console.WriteLine($"this is part 2"); + } + + public void ArrayOutput(long[] array) + { + foreach (var item in array) + { + Console.Write($"{item} "); + } + Console.WriteLine(); + } +} \ No newline at end of file diff --git a/2023/Day09/test b/2023/Day09/test new file mode 100644 index 0000000..70c5595 --- /dev/null +++ b/2023/Day09/test @@ -0,0 +1,3 @@ +0 3 6 9 12 15 +1 3 6 10 15 21 +10 13 16 21 30 45 \ No newline at end of file From 814a0094009746e685fca98901258543a2b58df1 Mon Sep 17 00:00:00 2001 From: deckelmouck Date: Sat, 9 Dec 2023 17:56:28 +0100 Subject: [PATCH 12/14] update --- 2023/Day09/solution.cs | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/2023/Day09/solution.cs b/2023/Day09/solution.cs index 4243778..fa95357 100644 --- a/2023/Day09/solution.cs +++ b/2023/Day09/solution.cs @@ -41,7 +41,10 @@ public void SolvePart1() for (int l = 0; l < sequenceLength; l++) { - long[] newline = new long[sequenceLength - 1]; + //reduce sequence length for next iteration + sequenceLength--; + + long[] newline = new long[sequenceLength]; //create new sequence for (int j = 0; j < newline.Length; j++) @@ -68,15 +71,16 @@ public void SolvePart1() //ArrayOutput(newline); - //reduce sequence length for next iteration - sequenceLength--; + //put new sequence in temp storage lastLine = newline; //check if all values are 0 - var sum = newline.Sum(); - if(sum == 0) + //var sum = newline.Sum(); + + //check if all values are 0 + if(ArrayFullOfZeros(newline)) { //Console.WriteLine($"line {i} is a solution"); break; @@ -102,4 +106,16 @@ public void ArrayOutput(long[] array) } Console.WriteLine(); } + + public bool ArrayFullOfZeros(long[] array) + { + foreach (var item in array) + { + if(item != 0) + { + return false; + } + } + return true; + } } \ No newline at end of file From b6c35527a5ee26e2139e0d49cff09670eefe89c5 Mon Sep 17 00:00:00 2001 From: deckelmouck Date: Sat, 9 Dec 2023 19:04:04 +0100 Subject: [PATCH 13/14] solved part1 --- 2023/Day09/solution.cs | 45 +++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/2023/Day09/solution.cs b/2023/Day09/solution.cs index fa95357..269e1e2 100644 --- a/2023/Day09/solution.cs +++ b/2023/Day09/solution.cs @@ -19,32 +19,35 @@ public void SolvePart1() for (int i = 0; i < input.Length; i++) { - var line = input[i].Split(" "); + var inputLine = input[i] + " 0"; + //Console.WriteLine(inputLine); + + var line = inputLine.Split(" "); //Console.WriteLine(line.Length); //hint found - next value of last values each sequence List lastValues = new List(); - + //initial sequence length - int sequenceLength = line.Length; + int sequenceLength = line.Length - 1; //for temporary storage of last line long[] lastLine = new long[sequenceLength]; //init with starting sequence lastLine = line.Select(x => Convert.ToInt64(x)).ToArray(); - + //save last value for later - lastValues.Add(lastLine[^1]); + //lastValues.Add(lastLine[^1]); - //ArrayOutput(lastLine); + ArrayOutput(lastLine); - for (int l = 0; l < sequenceLength; l++) + for (int l = 0; l <= sequenceLength; l++) { //reduce sequence length for next iteration - sequenceLength--; + //sequenceLength--; - long[] newline = new long[sequenceLength]; + long[] newline = new long[sequenceLength - l]; //create new sequence for (int j = 0; j < newline.Length; j++) @@ -54,22 +57,13 @@ public void SolvePart1() long newValue = right - left; - // if(left > right) - // { - // newValue = left - right; - // } - // else - // { - // newValue = right - left; - // } - newline[j] = newValue; } //save last value for later - lastValues.Add(newline[^1]); + //lastValues.Add(newline[^1]); - //ArrayOutput(newline); + ArrayOutput(newline); @@ -80,13 +74,18 @@ public void SolvePart1() //var sum = newline.Sum(); //check if all values are 0 - if(ArrayFullOfZeros(newline)) + // if(ArrayFullOfZeros(newline)) + // { + // //Console.WriteLine($"line {i} is a solution"); + // break; + // } + if(newline.Length == 1) { - //Console.WriteLine($"line {i} is a solution"); + lastValues.Add(newline[0] * -1); break; } } - + //lastValues.Add(lastLine[0] * -1); Console.WriteLine($"{lastValues.Sum()}"); solution += lastValues.Sum(); } From 49548c4b0f0be0957e5d9b4b8ce958e93ebb27f7 Mon Sep 17 00:00:00 2001 From: deckelmouck Date: Sat, 9 Dec 2023 19:09:54 +0100 Subject: [PATCH 14/14] solve day09 part 2 --- 2023/Day09/solution.cs | 80 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/2023/Day09/solution.cs b/2023/Day09/solution.cs index 269e1e2..0415bdc 100644 --- a/2023/Day09/solution.cs +++ b/2023/Day09/solution.cs @@ -95,6 +95,86 @@ public void SolvePart1() public void SolvePart2() { Console.WriteLine($"this is part 2"); + + solutionBase sb = new(); + //var input = sb.getInputLines(@"2023/Day09/test").ToArray(); + var input = sb.getInputLines(@"2023/Day09/input").ToArray(); + + long solution = 0; + + for (int i = 0; i < input.Length; i++) + { + var inputLine = "0 " + input[i]; + //Console.WriteLine(inputLine); + + var line = inputLine.Split(" "); + //Console.WriteLine(line.Length); + + //hint found - next value of last values each sequence + List lastValues = new List(); + + //initial sequence length + int sequenceLength = line.Length - 1; + + //for temporary storage of last line + long[] lastLine = new long[sequenceLength]; + + //init with starting sequence + lastLine = line.Select(x => Convert.ToInt64(x)).ToArray(); + + //save last value for later + //lastValues.Add(lastLine[^1]); + + ArrayOutput(lastLine); + + for (int l = 0; l <= sequenceLength; l++) + { + //reduce sequence length for next iteration + //sequenceLength--; + + long[] newline = new long[sequenceLength - l]; + + //create new sequence + for (int j = 0; j < newline.Length; j++) + { + long left = Convert.ToInt64(lastLine[j]); + long right = Convert.ToInt64(lastLine[j + 1]); + + long newValue = right - left; + + newline[j] = newValue; + } + + //save last value for later + //lastValues.Add(newline[^1]); + + ArrayOutput(newline); + + + + //put new sequence in temp storage + lastLine = newline; + + //check if all values are 0 + //var sum = newline.Sum(); + + //check if all values are 0 + // if(ArrayFullOfZeros(newline)) + // { + // //Console.WriteLine($"line {i} is a solution"); + // break; + // } + if(newline.Length == 1) + { + lastValues.Add(newline[0]); + break; + } + } + //lastValues.Add(lastLine[0] * -1); + Console.WriteLine($"{lastValues.Sum()}"); + solution += lastValues.Sum(); + } + Console.WriteLine($"solution is {solution}"); } public void ArrayOutput(long[] array)