mirror of
https://github.com/jcreek/advent-of-code.git
synced 2026-07-12 18:53:47 +00:00
chore(*): Move all C# solutions into a C# folder to make it clearer which languages are used
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/dotnet/.devcontainer/base.Dockerfile
|
||||
|
||||
# [Choice] .NET version: 6.0, 3.1, 6.0-bullseye, 3.1-bullseye, 6.0-focal, 3.1-focal
|
||||
ARG VARIANT="6.0-bullseye-slim"
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT}
|
||||
|
||||
# [Choice] Node.js version: none, lts/*, 18, 16, 14
|
||||
ARG NODE_VERSION="none"
|
||||
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
|
||||
# [Optional] Uncomment this section to install additional OS packages.
|
||||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
# && apt-get -y install --no-install-recommends <your-package-list-here>
|
||||
|
||||
# [Optional] Uncomment this line to install global node packages.
|
||||
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
|
||||
@@ -0,0 +1,74 @@
|
||||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
|
||||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/dotnet
|
||||
{
|
||||
"name": "C# (.NET)",
|
||||
"build": {
|
||||
"dockerfile": "Dockerfile",
|
||||
"args": {
|
||||
// Update 'VARIANT' to pick a .NET Core version: 3.1, 6.0
|
||||
// Append -bullseye or -focal to pin to an OS version.
|
||||
"VARIANT": "6.0-bullseye",
|
||||
// Options
|
||||
"NODE_VERSION": "none"
|
||||
}
|
||||
},
|
||||
|
||||
// Configure tool-specific properties.
|
||||
"customizations": {
|
||||
// Configure properties specific to VS Code.
|
||||
"vscode": {
|
||||
// Add the IDs of extensions you want installed when the container is created.
|
||||
"extensions": [
|
||||
"ms-dotnettools.csharp",
|
||||
"hbenl.vscode-test-explorer",
|
||||
"formulahendry.dotnet-test-explorer",
|
||||
"formulahendry.auto-rename-tag",
|
||||
"EditorConfig.EditorConfig",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"bierner.github-markdown-preview",
|
||||
"eamodio.gitlens",
|
||||
"yzhang.markdown-all-in-one",
|
||||
"bierner.markdown-emoji",
|
||||
"bierner.markdown-footnotes",
|
||||
"bierner.markdown-preview-github-styles",
|
||||
"bierner.markdown-yaml-preamble",
|
||||
"DavidAnson.vscode-markdownlint",
|
||||
"PKief.material-icon-theme",
|
||||
"christian-kohler.path-intellisense",
|
||||
"esbenp.prettier-vscode"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
// "forwardPorts": [5000, 5001],
|
||||
|
||||
// [Optional] To reuse of your local HTTPS dev cert:
|
||||
//
|
||||
// 1. Export it locally using this command:
|
||||
// * Windows PowerShell:
|
||||
// dotnet dev-certs https --trust; dotnet dev-certs https -ep "$env:USERPROFILE/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere"
|
||||
// * macOS/Linux terminal:
|
||||
// dotnet dev-certs https --trust; dotnet dev-certs https -ep "${HOME}/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere"
|
||||
//
|
||||
// 2. Uncomment these 'remoteEnv' lines:
|
||||
// "remoteEnv": {
|
||||
// "ASPNETCORE_Kestrel__Certificates__Default__Password": "SecurePwdGoesHere",
|
||||
// "ASPNETCORE_Kestrel__Certificates__Default__Path": "/home/vscode/.aspnet/https/aspnetapp.pfx",
|
||||
// },
|
||||
//
|
||||
// 3. Do one of the following depending on your scenario:
|
||||
// * When using GitHub Codespaces and/or Remote - Containers:
|
||||
// 1. Start the container
|
||||
// 2. Drag ~/.aspnet/https/aspnetapp.pfx into the root of the file explorer
|
||||
// 3. Open a terminal in VS Code and run "mkdir -p /home/vscode/.aspnet/https && mv aspnetapp.pfx /home/vscode/.aspnet/https"
|
||||
//
|
||||
// * If only using Remote - Containers with a local container, uncomment this line instead:
|
||||
// "mounts": [ "source=${env:HOME}${env:USERPROFILE}/.aspnet/https,target=/home/vscode/.aspnet/https,type=bind" ],
|
||||
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
"postCreateCommand": "dotnet restore",
|
||||
|
||||
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
||||
"remoteUser": "root"
|
||||
}
|
||||
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
// Use IntelliSense to find out which attributes exist for C# debugging
|
||||
// Use hover for the description of the existing attributes
|
||||
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
|
||||
"name": ".NET Core Launch (console)",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
// If you have changed target frameworks, make sure to update the program path.
|
||||
"program": "${workspaceFolder}/DayCreator/bin/Debug/net6.0/DayCreator.dll",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/DayCreator",
|
||||
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
|
||||
"console": "internalConsole",
|
||||
"stopAtEntry": false
|
||||
},
|
||||
{
|
||||
"name": ".NET Core Attach",
|
||||
"type": "coreclr",
|
||||
"request": "attach"
|
||||
}
|
||||
]
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"dotnet-test-explorer.testProjectPath": "**/*Tests.csproj",
|
||||
"omnisharp.enableRoslynAnalyzers": true,
|
||||
"omnisharp.enableEditorConfigSupport": true
|
||||
}
|
||||
Vendored
+41
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"build",
|
||||
"${workspaceFolder}/DayCreator/DayCreator.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "publish",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"publish",
|
||||
"${workspaceFolder}/DayCreator/DayCreator.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "watch",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"watch",
|
||||
"run",
|
||||
"--project",
|
||||
"${workspaceFolder}/DayCreator/DayCreator.csproj"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<ProduceReferenceAssemblyInOutDir>true</ProduceReferenceAssemblyInOutDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Y2015\Data\**"/>
|
||||
<Content Include="Y2015\Data\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Y2021\Data\**"/>
|
||||
<Content Include="Y2021\Data\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Y2022\Data\**"/>
|
||||
<Content Include="Y2022\Data\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Y2023\Data\**"/>
|
||||
<Content Include="Y2023\Data\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Y2024\Data\**"/>
|
||||
<Content Include="Y2024\Data\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Creek.HelpfulExtensions" Version="1.4.3"/>
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
||||
<PackageReference Include="NUnit" Version="4.2.2" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
|
||||
<PackageReference Include="NUnit.Analyzers" Version="4.4.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,2 @@
|
||||
global using NUnit.Framework;
|
||||
global using Creek.HelpfulExtensions;
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
bgvyzdsv
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,300 @@
|
||||
turn off 660,55 through 986,197
|
||||
turn off 341,304 through 638,850
|
||||
turn off 199,133 through 461,193
|
||||
toggle 322,558 through 977,958
|
||||
toggle 537,781 through 687,941
|
||||
turn on 226,196 through 599,390
|
||||
turn on 240,129 through 703,297
|
||||
turn on 317,329 through 451,798
|
||||
turn on 957,736 through 977,890
|
||||
turn on 263,530 through 559,664
|
||||
turn on 158,270 through 243,802
|
||||
toggle 223,39 through 454,511
|
||||
toggle 544,218 through 979,872
|
||||
turn on 313,306 through 363,621
|
||||
toggle 173,401 through 496,407
|
||||
toggle 333,60 through 748,159
|
||||
turn off 87,577 through 484,608
|
||||
turn on 809,648 through 826,999
|
||||
toggle 352,432 through 628,550
|
||||
turn off 197,408 through 579,569
|
||||
turn off 1,629 through 802,633
|
||||
turn off 61,44 through 567,111
|
||||
toggle 880,25 through 903,973
|
||||
turn on 347,123 through 864,746
|
||||
toggle 728,877 through 996,975
|
||||
turn on 121,895 through 349,906
|
||||
turn on 888,547 through 931,628
|
||||
toggle 398,782 through 834,882
|
||||
turn on 966,850 through 989,953
|
||||
turn off 891,543 through 914,991
|
||||
toggle 908,77 through 916,117
|
||||
turn on 576,900 through 943,934
|
||||
turn off 580,170 through 963,206
|
||||
turn on 184,638 through 192,944
|
||||
toggle 940,147 through 978,730
|
||||
turn off 854,56 through 965,591
|
||||
toggle 717,172 through 947,995
|
||||
toggle 426,987 through 705,998
|
||||
turn on 987,157 through 992,278
|
||||
toggle 995,774 through 997,784
|
||||
turn off 796,96 through 845,182
|
||||
turn off 451,87 through 711,655
|
||||
turn off 380,93 through 968,676
|
||||
turn on 263,468 through 343,534
|
||||
turn on 917,936 through 928,959
|
||||
toggle 478,7 through 573,148
|
||||
turn off 428,339 through 603,624
|
||||
turn off 400,880 through 914,953
|
||||
toggle 679,428 through 752,779
|
||||
turn off 697,981 through 709,986
|
||||
toggle 482,566 through 505,725
|
||||
turn off 956,368 through 993,516
|
||||
toggle 735,823 through 783,883
|
||||
turn off 48,487 through 892,496
|
||||
turn off 116,680 through 564,819
|
||||
turn on 633,865 through 729,930
|
||||
turn off 314,618 through 571,922
|
||||
toggle 138,166 through 936,266
|
||||
turn on 444,732 through 664,960
|
||||
turn off 109,337 through 972,497
|
||||
turn off 51,432 through 77,996
|
||||
turn off 259,297 through 366,744
|
||||
toggle 801,130 through 917,544
|
||||
toggle 767,982 through 847,996
|
||||
turn on 216,507 through 863,885
|
||||
turn off 61,441 through 465,731
|
||||
turn on 849,970 through 944,987
|
||||
toggle 845,76 through 852,951
|
||||
toggle 732,615 through 851,936
|
||||
toggle 251,128 through 454,778
|
||||
turn on 324,429 through 352,539
|
||||
toggle 52,450 through 932,863
|
||||
turn off 449,379 through 789,490
|
||||
turn on 317,319 through 936,449
|
||||
toggle 887,670 through 957,838
|
||||
toggle 671,613 through 856,664
|
||||
turn off 186,648 through 985,991
|
||||
turn off 471,689 through 731,717
|
||||
toggle 91,331 through 750,758
|
||||
toggle 201,73 through 956,524
|
||||
toggle 82,614 through 520,686
|
||||
toggle 84,287 through 467,734
|
||||
turn off 132,367 through 208,838
|
||||
toggle 558,684 through 663,920
|
||||
turn on 237,952 through 265,997
|
||||
turn on 694,713 through 714,754
|
||||
turn on 632,523 through 862,827
|
||||
turn on 918,780 through 948,916
|
||||
turn on 349,586 through 663,976
|
||||
toggle 231,29 through 257,589
|
||||
toggle 886,428 through 902,993
|
||||
turn on 106,353 through 236,374
|
||||
turn on 734,577 through 759,684
|
||||
turn off 347,843 through 696,912
|
||||
turn on 286,699 through 964,883
|
||||
turn on 605,875 through 960,987
|
||||
turn off 328,286 through 869,461
|
||||
turn off 472,569 through 980,848
|
||||
toggle 673,573 through 702,884
|
||||
turn off 398,284 through 738,332
|
||||
turn on 158,50 through 284,411
|
||||
turn off 390,284 through 585,663
|
||||
turn on 156,579 through 646,581
|
||||
turn on 875,493 through 989,980
|
||||
toggle 486,391 through 924,539
|
||||
turn on 236,722 through 272,964
|
||||
toggle 228,282 through 470,581
|
||||
toggle 584,389 through 750,761
|
||||
turn off 899,516 through 900,925
|
||||
turn on 105,229 through 822,846
|
||||
turn off 253,77 through 371,877
|
||||
turn on 826,987 through 906,992
|
||||
turn off 13,152 through 615,931
|
||||
turn on 835,320 through 942,399
|
||||
turn on 463,504 through 536,720
|
||||
toggle 746,942 through 786,998
|
||||
turn off 867,333 through 965,403
|
||||
turn on 591,477 through 743,692
|
||||
turn off 403,437 through 508,908
|
||||
turn on 26,723 through 368,814
|
||||
turn on 409,485 through 799,809
|
||||
turn on 115,630 through 704,705
|
||||
turn off 228,183 through 317,220
|
||||
toggle 300,649 through 382,842
|
||||
turn off 495,365 through 745,562
|
||||
turn on 698,346 through 744,873
|
||||
turn on 822,932 through 951,934
|
||||
toggle 805,30 through 925,421
|
||||
toggle 441,152 through 653,274
|
||||
toggle 160,81 through 257,587
|
||||
turn off 350,781 through 532,917
|
||||
toggle 40,583 through 348,636
|
||||
turn on 280,306 through 483,395
|
||||
toggle 392,936 through 880,955
|
||||
toggle 496,591 through 851,934
|
||||
turn off 780,887 through 946,994
|
||||
turn off 205,735 through 281,863
|
||||
toggle 100,876 through 937,915
|
||||
turn on 392,393 through 702,878
|
||||
turn on 956,374 through 976,636
|
||||
toggle 478,262 through 894,775
|
||||
turn off 279,65 through 451,677
|
||||
turn on 397,541 through 809,847
|
||||
turn on 444,291 through 451,586
|
||||
toggle 721,408 through 861,598
|
||||
turn on 275,365 through 609,382
|
||||
turn on 736,24 through 839,72
|
||||
turn off 86,492 through 582,712
|
||||
turn on 676,676 through 709,703
|
||||
turn off 105,710 through 374,817
|
||||
toggle 328,748 through 845,757
|
||||
toggle 335,79 through 394,326
|
||||
toggle 193,157 through 633,885
|
||||
turn on 227,48 through 769,743
|
||||
toggle 148,333 through 614,568
|
||||
toggle 22,30 through 436,263
|
||||
toggle 547,447 through 688,969
|
||||
toggle 576,621 through 987,740
|
||||
turn on 711,334 through 799,515
|
||||
turn on 541,448 through 654,951
|
||||
toggle 792,199 through 798,990
|
||||
turn on 89,956 through 609,960
|
||||
toggle 724,433 through 929,630
|
||||
toggle 144,895 through 201,916
|
||||
toggle 226,730 through 632,871
|
||||
turn off 760,819 through 828,974
|
||||
toggle 887,180 through 940,310
|
||||
toggle 222,327 through 805,590
|
||||
turn off 630,824 through 885,963
|
||||
turn on 940,740 through 954,946
|
||||
turn on 193,373 through 779,515
|
||||
toggle 304,955 through 469,975
|
||||
turn off 405,480 through 546,960
|
||||
turn on 662,123 through 690,669
|
||||
turn off 615,238 through 750,714
|
||||
turn on 423,220 through 930,353
|
||||
turn on 329,769 through 358,970
|
||||
toggle 590,151 through 704,722
|
||||
turn off 884,539 through 894,671
|
||||
toggle 449,241 through 984,549
|
||||
toggle 449,260 through 496,464
|
||||
turn off 306,448 through 602,924
|
||||
turn on 286,805 through 555,901
|
||||
toggle 722,177 through 922,298
|
||||
toggle 491,554 through 723,753
|
||||
turn on 80,849 through 174,996
|
||||
turn off 296,561 through 530,856
|
||||
toggle 653,10 through 972,284
|
||||
toggle 529,236 through 672,614
|
||||
toggle 791,598 through 989,695
|
||||
turn on 19,45 through 575,757
|
||||
toggle 111,55 through 880,871
|
||||
turn off 197,897 through 943,982
|
||||
turn on 912,336 through 977,605
|
||||
toggle 101,221 through 537,450
|
||||
turn on 101,104 through 969,447
|
||||
toggle 71,527 through 587,717
|
||||
toggle 336,445 through 593,889
|
||||
toggle 214,179 through 575,699
|
||||
turn on 86,313 through 96,674
|
||||
toggle 566,427 through 906,888
|
||||
turn off 641,597 through 850,845
|
||||
turn on 606,524 through 883,704
|
||||
turn on 835,775 through 867,887
|
||||
toggle 547,301 through 897,515
|
||||
toggle 289,930 through 413,979
|
||||
turn on 361,122 through 457,226
|
||||
turn on 162,187 through 374,746
|
||||
turn on 348,461 through 454,675
|
||||
turn off 966,532 through 985,537
|
||||
turn on 172,354 through 630,606
|
||||
turn off 501,880 through 680,993
|
||||
turn off 8,70 through 566,592
|
||||
toggle 433,73 through 690,651
|
||||
toggle 840,798 through 902,971
|
||||
toggle 822,204 through 893,760
|
||||
turn off 453,496 through 649,795
|
||||
turn off 969,549 through 990,942
|
||||
turn off 789,28 through 930,267
|
||||
toggle 880,98 through 932,434
|
||||
toggle 568,674 through 669,753
|
||||
turn on 686,228 through 903,271
|
||||
turn on 263,995 through 478,999
|
||||
toggle 534,675 through 687,955
|
||||
turn off 342,434 through 592,986
|
||||
toggle 404,768 through 677,867
|
||||
toggle 126,723 through 978,987
|
||||
toggle 749,675 through 978,959
|
||||
turn off 445,330 through 446,885
|
||||
turn off 463,205 through 924,815
|
||||
turn off 417,430 through 915,472
|
||||
turn on 544,990 through 912,999
|
||||
turn off 201,255 through 834,789
|
||||
turn off 261,142 through 537,862
|
||||
turn off 562,934 through 832,984
|
||||
turn off 459,978 through 691,980
|
||||
turn off 73,911 through 971,972
|
||||
turn on 560,448 through 723,810
|
||||
turn on 204,630 through 217,854
|
||||
turn off 91,259 through 611,607
|
||||
turn on 877,32 through 978,815
|
||||
turn off 950,438 through 974,746
|
||||
toggle 426,30 through 609,917
|
||||
toggle 696,37 through 859,201
|
||||
toggle 242,417 through 682,572
|
||||
turn off 388,401 through 979,528
|
||||
turn off 79,345 through 848,685
|
||||
turn off 98,91 through 800,434
|
||||
toggle 650,700 through 972,843
|
||||
turn off 530,450 through 538,926
|
||||
turn on 428,559 through 962,909
|
||||
turn on 78,138 through 92,940
|
||||
toggle 194,117 through 867,157
|
||||
toggle 785,355 through 860,617
|
||||
turn off 379,441 through 935,708
|
||||
turn off 605,133 through 644,911
|
||||
toggle 10,963 through 484,975
|
||||
turn off 359,988 through 525,991
|
||||
turn off 509,138 through 787,411
|
||||
toggle 556,467 through 562,773
|
||||
turn on 119,486 through 246,900
|
||||
turn on 445,561 through 794,673
|
||||
turn off 598,681 through 978,921
|
||||
turn off 974,230 through 995,641
|
||||
turn off 760,75 through 800,275
|
||||
toggle 441,215 through 528,680
|
||||
turn off 701,636 through 928,877
|
||||
turn on 165,753 through 202,780
|
||||
toggle 501,412 through 998,516
|
||||
toggle 161,105 through 657,395
|
||||
turn on 113,340 through 472,972
|
||||
toggle 384,994 through 663,999
|
||||
turn on 969,994 through 983,997
|
||||
turn on 519,600 through 750,615
|
||||
turn off 363,899 through 948,935
|
||||
turn on 271,845 through 454,882
|
||||
turn off 376,528 through 779,640
|
||||
toggle 767,98 through 854,853
|
||||
toggle 107,322 through 378,688
|
||||
turn off 235,899 through 818,932
|
||||
turn on 445,611 through 532,705
|
||||
toggle 629,387 through 814,577
|
||||
toggle 112,414 through 387,421
|
||||
toggle 319,184 through 382,203
|
||||
turn on 627,796 through 973,940
|
||||
toggle 602,45 through 763,151
|
||||
turn off 441,375 through 974,545
|
||||
toggle 871,952 through 989,998
|
||||
turn on 717,272 through 850,817
|
||||
toggle 475,711 through 921,882
|
||||
toggle 66,191 through 757,481
|
||||
turn off 50,197 through 733,656
|
||||
toggle 83,575 through 915,728
|
||||
turn on 777,812 through 837,912
|
||||
turn on 20,984 through 571,994
|
||||
turn off 446,432 through 458,648
|
||||
turn on 715,871 through 722,890
|
||||
toggle 424,675 through 740,862
|
||||
toggle 580,592 through 671,900
|
||||
toggle 296,687 through 906,775
|
||||
@@ -0,0 +1,82 @@
|
||||
using System.Reflection;
|
||||
|
||||
namespace AOC.Tests.Y2015
|
||||
{
|
||||
[TestFixture, Parallelizable(ParallelScope.All)]
|
||||
public class Day01
|
||||
{
|
||||
protected string GetThisClassName() { return this.GetType().Name; }
|
||||
private string realData;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
realData = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, "Y2015", "Data", $"{GetThisClassName()}.dat"))[0];
|
||||
}
|
||||
|
||||
[TestCase("(())", 0)] // Example data
|
||||
[TestCase("()()", 0)] // Example data
|
||||
[TestCase("(((", 3)] // Example data
|
||||
[TestCase("(()(()(", 3)] // Example data
|
||||
[TestCase("))(((((", 3)] // Example data
|
||||
[TestCase("())", -1)] // Example data
|
||||
[TestCase("))(", -1)] // Example data
|
||||
[TestCase(")))", -3)] // Example data
|
||||
[TestCase(")())())", -3)] // Example data
|
||||
[TestCase(null, 232)] // The actual answer
|
||||
public void Part1(string? input, int? expected)
|
||||
{
|
||||
var lines = input != null ? input : realData;
|
||||
|
||||
int floorsUp = lines.Count(x => x == '(');
|
||||
int floorsDown = lines.Count(x => x == ')');
|
||||
|
||||
var result = floorsUp - floorsDown;
|
||||
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(result, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 1: {result}");
|
||||
}
|
||||
|
||||
[TestCase(")", 1)] // Example data
|
||||
[TestCase("()())", 5)]
|
||||
[TestCase(null, 1783)] // The actual answer
|
||||
public void Part2(string? input, int? expected)
|
||||
{
|
||||
var lines = input != null ? input : realData;
|
||||
|
||||
var currentFloor = 0;
|
||||
int? result = null;
|
||||
|
||||
foreach (var (instruction, index) in lines.WithIndex())
|
||||
{
|
||||
if (instruction is '(')
|
||||
{
|
||||
currentFloor += 1;
|
||||
}
|
||||
else if (instruction is ')')
|
||||
{
|
||||
currentFloor -= 1;
|
||||
}
|
||||
|
||||
if (currentFloor is -1)
|
||||
{
|
||||
// Zero-indexed, so need to increment
|
||||
result = index + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(result, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 2: {result}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace AOC.Tests.Y2015
|
||||
{
|
||||
[TestFixture, Parallelizable(ParallelScope.All)]
|
||||
public class Day02
|
||||
{
|
||||
protected string GetThisClassName() { return this.GetType().Name; }
|
||||
private string[] realData;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
realData = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, "Y2015", "Data", $"{GetThisClassName()}.dat"));
|
||||
}
|
||||
|
||||
[TestCase("2x3x4", 58)]
|
||||
[TestCase("1x1x10", 43)]
|
||||
[TestCase(null, 1606483)] // The actual answer
|
||||
public void Part1(string? input, int? expected)
|
||||
{
|
||||
string[] lines = input != null ? new[] { input } : realData;
|
||||
|
||||
int totalWrappingPaper = 0;
|
||||
|
||||
foreach (var present in lines)
|
||||
{
|
||||
string[] dimensions = present.Split('x');
|
||||
int length = Int32.Parse(dimensions[0]);
|
||||
int width = Int32.Parse(dimensions[1]);
|
||||
int height = Int32.Parse(dimensions[2]);
|
||||
|
||||
int sideAArea = length * width;
|
||||
int sideBArea = width * height;
|
||||
int sideCArea = height * length;
|
||||
|
||||
int smallestSideArea = new List<int>() { sideAArea, sideBArea, sideCArea }.Min();
|
||||
|
||||
int totalPaperForPresent = (2 * sideAArea) + (2 * sideBArea) + (2 * sideCArea) + smallestSideArea;
|
||||
|
||||
totalWrappingPaper += totalPaperForPresent;
|
||||
}
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(totalWrappingPaper, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 1: {totalWrappingPaper}");
|
||||
}
|
||||
|
||||
[TestCase("2x3x4", 34)]
|
||||
[TestCase("1x1x10", 14)]
|
||||
[TestCase(null, 3842356)] // The actual answer
|
||||
public void Part2(string? input, int? expected)
|
||||
{
|
||||
string[] lines = input != null ? new[] { input } : realData;
|
||||
|
||||
var totalRibbon = 0;
|
||||
|
||||
foreach (var present in lines)
|
||||
{
|
||||
string[] dimensions = present.Split('x');
|
||||
int[] dimensionsInts = Array.ConvertAll(dimensions, s => int.Parse(s));
|
||||
|
||||
int length = dimensionsInts[0];
|
||||
int width = dimensionsInts[1];
|
||||
int height = dimensionsInts[2];
|
||||
|
||||
Array.Sort(dimensionsInts);
|
||||
|
||||
var smallestPerimeter = (2 * dimensionsInts[0]) + (2 * dimensionsInts[1]);
|
||||
var cubicFeetVolume = length * width * height;
|
||||
|
||||
var totalRibbonForPresent = smallestPerimeter + cubicFeetVolume;
|
||||
|
||||
totalRibbon += totalRibbonForPresent;
|
||||
}
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(totalRibbon, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 2: {totalRibbon}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Metadata.Ecma335;
|
||||
|
||||
namespace AOC.Tests.Y2015
|
||||
{
|
||||
[TestFixture, Parallelizable(ParallelScope.All)]
|
||||
public class Day03
|
||||
{
|
||||
protected string GetThisClassName() { return this.GetType().Name; }
|
||||
private string realData;
|
||||
private class House
|
||||
{
|
||||
public int VisitedCount { get; set; }
|
||||
public int X { get; set; }
|
||||
public int Y { get; set; }
|
||||
};
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
realData = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, "Y2015", "Data", $"{GetThisClassName()}.dat"))[0];
|
||||
}
|
||||
|
||||
private void DeliverPresentToHouse(int x, int y, ref List<House> houses)
|
||||
{
|
||||
if (houses.FindIndex(h => h.X == x && h.Y ==y) > -1)
|
||||
{
|
||||
foreach (House house in houses.Where(h => h.X == x && h.Y == y))
|
||||
{
|
||||
house.VisitedCount += 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
House house = new House()
|
||||
{
|
||||
VisitedCount = 1,
|
||||
X = x,
|
||||
Y = y,
|
||||
};
|
||||
houses.Add(house);
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase(">", 2)]
|
||||
[TestCase("^>v<", 4)]
|
||||
[TestCase("^v^v^v^v^v", 2)]
|
||||
[TestCase(null, 2565)] // The actual answer
|
||||
public void Part1(string? input, int? expected)
|
||||
{
|
||||
string lines = input != null ? input : realData;
|
||||
int currentX = 0;
|
||||
int currentY = 0;
|
||||
|
||||
List<House> houses = new List<House>();
|
||||
|
||||
House firstHouse = new House()
|
||||
{
|
||||
VisitedCount = 1,
|
||||
X = currentX,
|
||||
Y = currentY,
|
||||
};
|
||||
houses.Add(firstHouse);
|
||||
|
||||
foreach (char movement in lines)
|
||||
{
|
||||
switch (movement)
|
||||
{
|
||||
case '^':
|
||||
// North
|
||||
currentY += 1;
|
||||
break;
|
||||
case 'v':
|
||||
// South
|
||||
currentY -= 1;
|
||||
break;
|
||||
case '<':
|
||||
// East
|
||||
currentX += 1;
|
||||
break;
|
||||
case '>':
|
||||
// West
|
||||
currentX -= 1;
|
||||
break;
|
||||
}
|
||||
|
||||
DeliverPresentToHouse(currentX, currentY, ref houses);
|
||||
}
|
||||
|
||||
int numberOfHousesVisited = houses.Count;
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(numberOfHousesVisited, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 1: {numberOfHousesVisited}");
|
||||
}
|
||||
|
||||
[TestCase("^v", 3)]
|
||||
[TestCase("^>v<", 3)]
|
||||
[TestCase("^v^v^v^v^v", 11)]
|
||||
[TestCase(null, 2639)] // The actual answer
|
||||
public void Part2(string? input, int? expected)
|
||||
{
|
||||
string lines = input != null ? input : realData;
|
||||
int currentX = 0;
|
||||
int currentY = 0;
|
||||
int roboSantacurrentX = 0;
|
||||
int roboSantacurrentY = 0;
|
||||
|
||||
List<House> houses = new List<House>();
|
||||
|
||||
House firstHouse = new House()
|
||||
{
|
||||
VisitedCount = 2, // Visited by both Santa and Robo-Santa
|
||||
X = currentX,
|
||||
Y = currentY,
|
||||
};
|
||||
houses.Add(firstHouse);
|
||||
|
||||
bool isSanta = true;
|
||||
|
||||
foreach (char movement in lines)
|
||||
{
|
||||
switch (movement)
|
||||
{
|
||||
case '^':
|
||||
// North
|
||||
if (isSanta)
|
||||
{
|
||||
currentY += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
roboSantacurrentY += 1;
|
||||
}
|
||||
break;
|
||||
case 'v':
|
||||
// South
|
||||
if (isSanta)
|
||||
{
|
||||
currentY -= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
roboSantacurrentY -= 1;
|
||||
}
|
||||
break;
|
||||
case '<':
|
||||
// East
|
||||
if (isSanta)
|
||||
{
|
||||
currentX += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
roboSantacurrentX += 1;
|
||||
}
|
||||
break;
|
||||
case '>':
|
||||
// West
|
||||
if (isSanta)
|
||||
{
|
||||
currentX -= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
roboSantacurrentX -= 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (isSanta)
|
||||
{
|
||||
DeliverPresentToHouse(currentX, currentY, ref houses);
|
||||
isSanta = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
DeliverPresentToHouse(roboSantacurrentX, roboSantacurrentY, ref houses);
|
||||
isSanta = true;
|
||||
}
|
||||
}
|
||||
|
||||
int numberOfHousesVisited = houses.Count;
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(numberOfHousesVisited, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 2: {numberOfHousesVisited}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace AOC.Tests.Y2015
|
||||
{
|
||||
[TestFixture, Parallelizable(ParallelScope.All)]
|
||||
public class Day04
|
||||
{
|
||||
protected string GetThisClassName() { return this.GetType().Name; }
|
||||
private string realData;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
realData = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, "Y2015", "Data", $"{GetThisClassName()}.dat"))[0];
|
||||
}
|
||||
|
||||
private int CreateMD5Hash(string input, string startingString)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
MD5 md5 = MD5.Create();
|
||||
|
||||
while (true)
|
||||
{
|
||||
byte[] inputBytes = new UTF8Encoding().GetBytes($"{input}{result}");
|
||||
byte[] hashBytes = md5.ComputeHash(inputBytes);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (var t in hashBytes)
|
||||
{
|
||||
sb.Append(t.ToString("X2"));
|
||||
}
|
||||
|
||||
if (sb.ToString().StartsWith(startingString))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
result += 1;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
[TestCase("abcdef", 609043)]
|
||||
[TestCase("pqrstuv", 1048970)]
|
||||
[TestCase(null, 254575)] // The actual answer
|
||||
public void Part1(string? input, int? expected)
|
||||
{
|
||||
string lines = input != null ? input : realData;
|
||||
|
||||
var i = CreateMD5Hash(lines, "00000");
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(i, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 1: {i}");
|
||||
}
|
||||
|
||||
[TestCase(null, 1038736)] // The actual answer
|
||||
public void Part2(string? input, int? expected)
|
||||
{
|
||||
string lines = input != null ? input : realData;
|
||||
|
||||
var i = CreateMD5Hash(lines, "000000");
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(i, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 2: {i}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
using Creek.HelpfulExtensions;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace AOC.Tests.Y2015
|
||||
{
|
||||
[TestFixture, Parallelizable(ParallelScope.All)]
|
||||
public class Day05
|
||||
{
|
||||
protected string GetThisClassName() { return this.GetType().Name; }
|
||||
private string[] realData;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
realData = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, "Y2015", "Data", $"{GetThisClassName()}.dat"));
|
||||
}
|
||||
|
||||
private static bool HasRepeatedCharacters(string input)
|
||||
{
|
||||
bool hasRepeatedCharacters = false;
|
||||
|
||||
if (input.Length >= 2)
|
||||
{
|
||||
for (int index = 0; index < input.Length - 1; index++)
|
||||
{
|
||||
if (input[index] == input[index + 1])
|
||||
{
|
||||
hasRepeatedCharacters = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return hasRepeatedCharacters;
|
||||
}
|
||||
|
||||
private static bool IsNice(string checkString)
|
||||
{
|
||||
// Count non-unique vowels
|
||||
Regex rx = new("[aeiou]");
|
||||
int vowelCount = rx.Matches(checkString).Count;
|
||||
|
||||
// Check for at least one letter appearing twice in a row
|
||||
bool hasRepeatedCharacters = HasRepeatedCharacters(checkString);
|
||||
|
||||
// Check it does not contain the strings ab, cd, pq, or xy
|
||||
bool containsForbiddenStrings = checkString.Contains("ab")
|
||||
|| checkString.Contains("cd")
|
||||
|| checkString.Contains("pq")
|
||||
|| checkString.Contains("xy");
|
||||
|
||||
return vowelCount >= 3 && hasRepeatedCharacters && !containsForbiddenStrings;
|
||||
}
|
||||
|
||||
private class Pair
|
||||
{
|
||||
public int LeftIndex { get; set; }
|
||||
public int RightIndex { get; set; }
|
||||
public string? Text { get; set; }
|
||||
}
|
||||
|
||||
private static bool TwiceWithoutOverlap(string checkString)
|
||||
{
|
||||
// It contains a pair of any two letters that appears at least twice in the string without overlapping,
|
||||
// like xyxy (xy) or aabcdefgaa (aa), but not like aaa (aa, but it overlaps).
|
||||
|
||||
// Split the string into 'pairs'
|
||||
List<Pair> pairs = new();
|
||||
for (int i = 0; i < checkString.Length - 1; i++)
|
||||
{
|
||||
Pair pair = new()
|
||||
{
|
||||
LeftIndex = i,
|
||||
RightIndex = i + 1,
|
||||
Text = $"{checkString[i]}{checkString[i + 1]}",
|
||||
};
|
||||
|
||||
pairs.Add(pair);
|
||||
}
|
||||
|
||||
List<Pair> possibleNonOverlappingPairs = new();
|
||||
// Check if any of those pairs occurs more than once
|
||||
foreach (Pair pair in pairs)
|
||||
{
|
||||
int count = Regex.Matches(checkString, pair.Text).Count;
|
||||
|
||||
if (count > 1)
|
||||
{
|
||||
possibleNonOverlappingPairs.Add(pair);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if any do not overlap, if they don't then return true
|
||||
foreach (Pair pair in possibleNonOverlappingPairs)
|
||||
{
|
||||
if (possibleNonOverlappingPairs.Any(p =>
|
||||
p.Text == pair.Text
|
||||
&& (p.LeftIndex != pair.RightIndex || p.RightIndex != pair.LeftIndex)
|
||||
))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool CheckRepeatedCharacters(string checkString)
|
||||
{
|
||||
// It contains at least one letter which repeats with exactly one letter between them, like xyx, abcdefeghi (efe), or even aaa.
|
||||
for (int i = 0; i < checkString.Length; i++)
|
||||
{
|
||||
if ((i + 2) < checkString.Length)
|
||||
{
|
||||
if (checkString[i] == checkString[i + 2] && checkString[i] != checkString[i + 1])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool IsNiceV2(string checkString)
|
||||
{
|
||||
// It contains a pair of any two letters that appears at least twice in the string without overlapping, like xyxy (xy) or aabcdefgaa (aa), but not like aaa (aa, but it overlaps).
|
||||
bool twiceWithoutOverlapping = TwiceWithoutOverlap(checkString);
|
||||
|
||||
// It contains at least one letter which repeats with exactly one letter between them, like xyx, abcdefeghi (efe), or even aaa.
|
||||
bool hasRepeatedCharacters = CheckRepeatedCharacters(checkString);
|
||||
|
||||
return twiceWithoutOverlapping && hasRepeatedCharacters;
|
||||
}
|
||||
|
||||
[TestCase("ugknbfddgicrmopn", 1)]
|
||||
[TestCase("aaa", 1)]
|
||||
[TestCase("jchzalrnumimnmhp", 0)]
|
||||
[TestCase("haegwjzuvuyypxyu", 0)]
|
||||
[TestCase("dvszwmarrgswjxmb", 0)]
|
||||
[TestCase(null, 258)] // The actual answer
|
||||
public void Part1(string? input, int? expected)
|
||||
{
|
||||
string[] lines = input != null ? new[] { input } : realData;
|
||||
|
||||
int niceCount = 0;
|
||||
|
||||
foreach (string line in lines)
|
||||
{
|
||||
if (IsNice(line))
|
||||
{
|
||||
niceCount += 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(niceCount, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 1: {niceCount}");
|
||||
}
|
||||
|
||||
[TestCase("qjhvhtzxzqqjkmpb", 1)]
|
||||
[TestCase("xxyxx", 1)]
|
||||
[TestCase("uurcxstgmygtbstg", 0)]
|
||||
[TestCase("ieodomkazucvgmuy", 0)]
|
||||
[TestCase(null, 53)] // The actual answer
|
||||
public void Part2(string? input, int? expected)
|
||||
{
|
||||
string[] lines = input != null ? new[] { input } : realData;
|
||||
|
||||
int niceCount = 0;
|
||||
|
||||
foreach (string line in lines)
|
||||
{
|
||||
if (IsNiceV2(line))
|
||||
{
|
||||
niceCount += 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(niceCount, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 2: {niceCount}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace AOC.Tests.Y2015
|
||||
{
|
||||
[TestFixture, Parallelizable(ParallelScope.All)]
|
||||
public class Day06
|
||||
{
|
||||
protected string GetThisClassName() { return this.GetType().Name; }
|
||||
private string[] realData;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
realData = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, "Y2015", "Data", $"{GetThisClassName()}.dat"));
|
||||
}
|
||||
|
||||
private enum Instructions
|
||||
{
|
||||
Toggle = 7,
|
||||
TurnOn = 8,
|
||||
TurnOff = 9,
|
||||
}
|
||||
|
||||
private void OperateLights(string instruction, ref bool[,] lights)
|
||||
{
|
||||
Instructions currentInstruction = instruction switch
|
||||
{
|
||||
string s when s.StartsWith("toggle") => Instructions.Toggle,
|
||||
string s when s.StartsWith("turn on") => Instructions.TurnOn,
|
||||
string s when s.StartsWith("turn off") => Instructions.TurnOff,
|
||||
_ => throw new InvalidDataException($"Bad instruction -> {instruction}"),
|
||||
};
|
||||
|
||||
// e.g. turn on 0,0 through 999,999
|
||||
string[] instructionParts = instruction.Substring((int)currentInstruction).Split(' ');
|
||||
|
||||
int startX = int.Parse(instructionParts[0].Substring(0, instructionParts[0].IndexOf(",")));
|
||||
int startY = int.Parse(instructionParts[0].Substring(instructionParts[0].IndexOf(",") + 1));
|
||||
int endX = int.Parse(instructionParts[2].Substring(0, instructionParts[2].IndexOf(",")));
|
||||
int endY = int.Parse(instructionParts[2].Substring(instructionParts[2].IndexOf(",") + 1));
|
||||
|
||||
for (int i = startX; i <= endX; i++)
|
||||
{
|
||||
for (int j = startY; j <= endY; j++)
|
||||
{
|
||||
lights[i, j] = currentInstruction switch
|
||||
{
|
||||
Instructions.Toggle => !lights[i, j],
|
||||
Instructions.TurnOn => true,
|
||||
Instructions.TurnOff => false,
|
||||
_ => throw new NotImplementedException(),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OperateScalingLights(string instruction, ref int[,] lights)
|
||||
{
|
||||
Instructions currentInstruction = instruction switch
|
||||
{
|
||||
string s when s.StartsWith("toggle") => Instructions.Toggle,
|
||||
string s when s.StartsWith("turn on") => Instructions.TurnOn,
|
||||
string s when s.StartsWith("turn off") => Instructions.TurnOff,
|
||||
_ => throw new InvalidDataException($"Bad instruction -> {instruction}"),
|
||||
};
|
||||
|
||||
// e.g. turn on 0,0 through 999,999
|
||||
string[] instructionParts = instruction.Substring((int)currentInstruction).Split(' ');
|
||||
|
||||
int startX = int.Parse(instructionParts[0].Substring(0, instructionParts[0].IndexOf(",")));
|
||||
int startY = int.Parse(instructionParts[0].Substring(instructionParts[0].IndexOf(",") + 1));
|
||||
int endX = int.Parse(instructionParts[2].Substring(0, instructionParts[2].IndexOf(",")));
|
||||
int endY = int.Parse(instructionParts[2].Substring(instructionParts[2].IndexOf(",") + 1));
|
||||
|
||||
for (int i = startX; i <= endX; i++)
|
||||
{
|
||||
for (int j = startY; j <= endY; j++)
|
||||
{
|
||||
lights[i, j] = currentInstruction switch
|
||||
{
|
||||
Instructions.Toggle => lights[i, j] += 2,
|
||||
Instructions.TurnOn => lights[i, j] += 1,
|
||||
Instructions.TurnOff => lights[i, j] > 0 ? lights[i, j] -= 1 : lights[i, j] = 0,
|
||||
_ => throw new NotImplementedException(),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase("turn on 0,0 through 999,999", 1000000)]
|
||||
[TestCase("toggle 0,0 through 999,0", 1000)]
|
||||
[TestCase("turn on 0,0 through 999,999/nturn off 499,499 through 500,500", 999996)]
|
||||
[TestCase(null, 400410)] // The actual answer
|
||||
public void Part1(string? input, int? expected)
|
||||
{
|
||||
string[] lines = input != null ? input.Split("/n") : realData;
|
||||
|
||||
bool[,] lights = new bool[1000, 1000];
|
||||
|
||||
foreach (string line in lines)
|
||||
{
|
||||
OperateLights(line, ref lights);
|
||||
}
|
||||
|
||||
IEnumerable<bool> lightsOn = from bool light in lights
|
||||
where light
|
||||
select light;
|
||||
|
||||
int lightsOnCount = lightsOn.Count();
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(lightsOnCount, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 1: {lightsOnCount}");
|
||||
}
|
||||
|
||||
[TestCase("turn on 0,0 through 0,0", 1)]
|
||||
[TestCase("toggle 0,0 through 999,999", 2000000)]
|
||||
[TestCase(null, 15343601)] // The actual answer
|
||||
public void Part2(string? input, int? expected)
|
||||
{
|
||||
string[] lines = input != null ? input.Split("/n") : realData;
|
||||
|
||||
int[,] lights = new int[1000, 1000];
|
||||
|
||||
foreach (string line in lines)
|
||||
{
|
||||
OperateScalingLights(line, ref lights);
|
||||
}
|
||||
|
||||
int totalBrightness = lights.Cast<int>().Sum();
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(totalBrightness, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 2: {totalBrightness}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
--- Day 1: Not Quite Lisp ---
|
||||
Santa was hoping for a white Christmas, but his weather machine's "snow" function is powered by stars, and he's fresh out! To save Christmas, he needs you to collect fifty stars by December 25th.
|
||||
|
||||
Collect stars by helping Santa solve puzzles. Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants one star. Good luck!
|
||||
|
||||
Here's an easy puzzle to warm you up.
|
||||
|
||||
Santa is trying to deliver presents in a large apartment building, but he can't find the right floor - the directions he got are a little confusing. He starts on the ground floor (floor 0) and then follows the instructions one character at a time.
|
||||
|
||||
An opening parenthesis, (, means he should go up one floor, and a closing parenthesis, ), means he should go down one floor.
|
||||
|
||||
The apartment building is very tall, and the basement is very deep; he will never find the top or bottom floors.
|
||||
|
||||
For example:
|
||||
|
||||
(()) and ()() both result in floor 0.
|
||||
((( and (()(()( both result in floor 3.
|
||||
))((((( also results in floor 3.
|
||||
()) and ))( both result in floor -1 (the first basement level).
|
||||
))) and )())()) both result in floor -3.
|
||||
To what floor do the instructions take Santa?
|
||||
|
||||
--- Part Two ---
|
||||
Now, given the same instructions, find the position of the first character that causes him to enter the basement (floor -1). The first character in the instructions has position 1, the second character has position 2, and so on.
|
||||
|
||||
For example:
|
||||
|
||||
) causes him to enter the basement at character position 1.
|
||||
()()) causes him to enter the basement at character position 5.
|
||||
What is the position of the character that causes Santa to first enter the basement?
|
||||
@@ -0,0 +1,21 @@
|
||||
--- Day 2: I Was Told There Would Be No Math ---
|
||||
The elves are running low on wrapping paper, and so they need to submit an order for more. They have a list of the dimensions (length l, width w, and height h) of each present, and only want to order exactly as much as they need.
|
||||
|
||||
Fortunately, every present is a box (a perfect right rectangular prism), which makes calculating the required wrapping paper for each gift a little easier: find the surface area of the box, which is 2*l*w + 2*w*h + 2*h*l. The elves also need a little extra paper for each present: the area of the smallest side.
|
||||
|
||||
For example:
|
||||
|
||||
A present with dimensions 2x3x4 requires 2*6 + 2*12 + 2*8 = 52 square feet of wrapping paper plus 6 square feet of slack, for a total of 58 square feet.
|
||||
A present with dimensions 1x1x10 requires 2*1 + 2*10 + 2*10 = 42 square feet of wrapping paper plus 1 square foot of slack, for a total of 43 square feet.
|
||||
All numbers in the elves' list are in feet. How many total square feet of wrapping paper should they order?
|
||||
|
||||
--- Part Two ---
|
||||
The elves are also running low on ribbon. Ribbon is all the same width, so they only have to worry about the length they need to order, which they would again like to be exact.
|
||||
|
||||
The ribbon required to wrap a present is the shortest distance around its sides, or the smallest perimeter of any one face. Each present also requires a bow made out of ribbon as well; the feet of ribbon required for the perfect bow is equal to the cubic feet of volume of the present. Don't ask how they tie the bow, though; they'll never tell.
|
||||
|
||||
For example:
|
||||
|
||||
A present with dimensions 2x3x4 requires 2+2+3+3 = 10 feet of ribbon to wrap the present plus 2*3*4 = 24 feet of ribbon for the bow, for a total of 34 feet.
|
||||
A present with dimensions 1x1x10 requires 1+1+1+1 = 4 feet of ribbon to wrap the present plus 1*1*10 = 10 feet of ribbon for the bow, for a total of 14 feet.
|
||||
How many total feet of ribbon should they order?
|
||||
@@ -0,0 +1,25 @@
|
||||
--- Day 3: Perfectly Spherical Houses in a Vacuum ---
|
||||
Santa is delivering presents to an infinite two-dimensional grid of houses.
|
||||
|
||||
He begins by delivering a present to the house at his starting location, and then an elf at the North Pole calls him via radio and tells him where to move next. Moves are always exactly one house to the north (^), south (v), east (>), or west (<). After each move, he delivers another present to the house at his new location.
|
||||
|
||||
However, the elf back at the north pole has had a little too much eggnog, and so his directions are a little off, and Santa ends up visiting some houses more than once. How many houses receive at least one present?
|
||||
|
||||
For example:
|
||||
|
||||
> delivers presents to 2 houses: one at the starting location, and one to the east.
|
||||
^>v< delivers presents to 4 houses in a square, including twice to the house at his starting/ending location.
|
||||
^v^v^v^v^v delivers a bunch of presents to some very lucky children at only 2 houses.
|
||||
|
||||
--- Part Two ---
|
||||
The next year, to speed up the process, Santa creates a robot version of himself, Robo-Santa, to deliver presents with him.
|
||||
|
||||
Santa and Robo-Santa start at the same location (delivering two presents to the same starting house), then take turns moving based on instructions from the elf, who is eggnoggedly reading from the same script as the previous year.
|
||||
|
||||
This year, how many houses receive at least one present?
|
||||
|
||||
For example:
|
||||
|
||||
^v delivers presents to 3 houses, because Santa goes north, and then Robo-Santa goes south.
|
||||
^>v< now delivers presents to 3 houses, and Santa and Robo-Santa end up back where they started.
|
||||
^v^v^v^v^v now delivers presents to 11 houses, with Santa going one direction and Robo-Santa going the other.
|
||||
@@ -0,0 +1,10 @@
|
||||
--- Day 4: The Ideal Stocking Stuffer ---
|
||||
Santa needs help mining some AdventCoins (very similar to bitcoins) to use as gifts for all the economically forward-thinking little girls and boys.
|
||||
|
||||
To do this, he needs to find MD5 hashes which, in hexadecimal, start with at least five zeroes. The input to the MD5 hash is some secret key (your puzzle input, given below) followed by a number in decimal. To mine AdventCoins, you must find Santa the lowest positive number (no leading zeroes: 1, 2, 3, ...) that produces such a hash.
|
||||
|
||||
For example:
|
||||
|
||||
If your secret key is abcdef, the answer is 609043, because the MD5 hash of abcdef609043 starts with five zeroes (000001dbbfa...), and it is the lowest such number to do so.
|
||||
If your secret key is pqrstuv, the lowest number it combines with to make an MD5 hash starting with five zeroes is 1048970; that is, the MD5 hash of pqrstuv1048970 looks like 000006136ef....
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
--- Day 5: Doesn't He Have Intern-Elves For This? ---
|
||||
Santa needs help figuring out which strings in his text file are naughty or nice.
|
||||
|
||||
A nice string is one with all of the following properties:
|
||||
|
||||
It contains at least three vowels (aeiou only), like aei, xazegov, or aeiouaeiouaeiou.
|
||||
It contains at least one letter that appears twice in a row, like xx, abcdde (dd), or aabbccdd (aa, bb, cc, or dd).
|
||||
It does not contain the strings ab, cd, pq, or xy, even if they are part of one of the other requirements.
|
||||
For example:
|
||||
|
||||
ugknbfddgicrmopn is nice because it has at least three vowels (u...i...o...), a double letter (...dd...), and none of the disallowed substrings.
|
||||
aaa is nice because it has at least three vowels and a double letter, even though the letters used by different rules overlap.
|
||||
jchzalrnumimnmhp is naughty because it has no double letter.
|
||||
haegwjzuvuyypxyu is naughty because it contains the string xy.
|
||||
dvszwmarrgswjxmb is naughty because it contains only one vowel.
|
||||
How many strings are nice?
|
||||
|
||||
--- Part Two ---
|
||||
Realizing the error of his ways, Santa has switched to a better model of determining whether a string is naughty or nice. None of the old rules apply, as they are all clearly ridiculous.
|
||||
|
||||
Now, a nice string is one with all of the following properties:
|
||||
|
||||
It contains a pair of any two letters that appears at least twice in the string without overlapping, like xyxy (xy) or aabcdefgaa (aa), but not like aaa (aa, but it overlaps).
|
||||
It contains at least one letter which repeats with exactly one letter between them, like xyx, abcdefeghi (efe), or even aaa.
|
||||
For example:
|
||||
|
||||
qjhvhtzxzqqjkmpb is nice because is has a pair that appears twice (qj) and a letter that repeats with exactly one letter between them (zxz).
|
||||
xxyxx is nice because it has a pair that appears twice and a letter that repeats with one between, even though the letters used by each rule overlap.
|
||||
uurcxstgmygtbstg is naughty because it has a pair (tg) but no repeat with a single letter between them.
|
||||
ieodomkazucvgmuy is naughty because it has a repeating letter with one between (odo), but no pair that appears twice.
|
||||
How many strings are nice under these new rules?
|
||||
@@ -0,0 +1,33 @@
|
||||
--- Day 6: Probably a Fire Hazard ---
|
||||
Because your neighbors keep defeating you in the holiday house decorating contest year after year, you've decided to deploy one million lights in a 1000x1000 grid.
|
||||
|
||||
Furthermore, because you've been especially nice this year, Santa has mailed you instructions on how to display the ideal lighting configuration.
|
||||
|
||||
Lights in your grid are numbered from 0 to 999 in each direction; the lights at each corner are at 0,0, 0,999, 999,999, and 999,0. The instructions include whether to turn on, turn off, or toggle various inclusive ranges given as coordinate pairs. Each coordinate pair represents opposite corners of a rectangle, inclusive; a coordinate pair like 0,0 through 2,2 therefore refers to 9 lights in a 3x3 square. The lights all start turned off.
|
||||
|
||||
To defeat your neighbors this year, all you have to do is set up your lights by doing the instructions Santa sent you in order.
|
||||
|
||||
For example:
|
||||
|
||||
turn on 0,0 through 999,999 would turn on (or leave on) every light.
|
||||
toggle 0,0 through 999,0 would toggle the first line of 1000 lights, turning off the ones that were on, and turning on the ones that were off.
|
||||
turn off 499,499 through 500,500 would turn off (or leave off) the middle four lights.
|
||||
After following the instructions, how many lights are lit?
|
||||
|
||||
--- Part Two ---
|
||||
You just finish implementing your winning light pattern when you realize you mistranslated Santa's message from Ancient Nordic Elvish.
|
||||
|
||||
The light grid you bought actually has individual brightness controls; each light can have a brightness of zero or more. The lights all start at zero.
|
||||
|
||||
The phrase turn on actually means that you should increase the brightness of those lights by 1.
|
||||
|
||||
The phrase turn off actually means that you should decrease the brightness of those lights by 1, to a minimum of zero.
|
||||
|
||||
The phrase toggle actually means that you should increase the brightness of those lights by 2.
|
||||
|
||||
What is the total brightness of all lights combined after following Santa's instructions?
|
||||
|
||||
For example:
|
||||
|
||||
turn on 0,0 through 0,0 would increase the total brightness by 1.
|
||||
toggle 0,0 through 999,999 would increase the total brightness by 2000000.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,87 @@
|
||||
using System.Reflection;
|
||||
|
||||
namespace AOC.Tests.Y2021
|
||||
{
|
||||
[TestFixture, Parallelizable(ParallelScope.All)]
|
||||
public class Day01
|
||||
{
|
||||
protected string GetThisClassName() { return this.GetType().Name; }
|
||||
private string[] realData;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
realData = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, "Y2021", "Data", $"{GetThisClassName()}.dat"));
|
||||
}
|
||||
|
||||
[TestCase("199,200,208,210,200,207,240,269,260,263", 7)] // Example data
|
||||
[TestCase(null, 1681)] // The actual answer
|
||||
public void Part1(string? input, int? expected)
|
||||
{
|
||||
var lines = input != null ? input.Split(',') : realData;
|
||||
|
||||
int numberOfBiggerMeasurements = 0;
|
||||
|
||||
foreach (var (line, index) in lines.WithIndex())
|
||||
{
|
||||
if (index > 0)
|
||||
{
|
||||
int previousReading = Int32.Parse(lines[index-1]);
|
||||
int currentReading = Int32.Parse(line);
|
||||
|
||||
if (currentReading > previousReading)
|
||||
{
|
||||
numberOfBiggerMeasurements += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(numberOfBiggerMeasurements, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 1: {numberOfBiggerMeasurements}");
|
||||
}
|
||||
|
||||
[TestCase("199,200,208,210,200,207,240,269,260,263", 5)] // Example data
|
||||
[TestCase(null, 1704)] // The actual answer
|
||||
public void Part2(string? input, int? expected)
|
||||
{
|
||||
var lines = input != null ? input.Split(',') : realData;
|
||||
|
||||
int numberOfBiggerSlidingTotals = 0;
|
||||
|
||||
List<int> slidingTotals = new List<int>();
|
||||
|
||||
for (int i = 0; i < lines.Count(); i++)
|
||||
{
|
||||
if (lines.Count() > i+2)
|
||||
{
|
||||
slidingTotals.Add(Int32.Parse(lines[i]) + Int32.Parse(lines[i+1]) + Int32.Parse(lines[i+2]));
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var (total, index) in slidingTotals.WithIndex())
|
||||
{
|
||||
if (index > 0)
|
||||
{
|
||||
int previousTotal = slidingTotals[index-1];
|
||||
int currentTotal = total;
|
||||
|
||||
if (currentTotal > previousTotal)
|
||||
{
|
||||
numberOfBiggerSlidingTotals += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(numberOfBiggerSlidingTotals, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 2: {numberOfBiggerSlidingTotals}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
--- Day 1: Sonar Sweep ---
|
||||
You're minding your own business on a ship at sea when the overboard alarm goes off! You rush to see if you can help. Apparently, one of the Elves tripped and accidentally sent the sleigh keys flying into the ocean!
|
||||
|
||||
Before you know it, you're inside a submarine the Elves keep ready for situations like this. It's covered in Christmas lights (because of course it is), and it even has an experimental antenna that should be able to track the keys if you can boost its signal strength high enough; there's a little meter that indicates the antenna's signal strength by displaying 0-50 stars.
|
||||
|
||||
Your instincts tell you that in order to save Christmas, you'll need to get all fifty stars by December 25th.
|
||||
|
||||
Collect stars by solving puzzles. Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants one star. Good luck!
|
||||
|
||||
As the submarine drops below the surface of the ocean, it automatically performs a sonar sweep of the nearby sea floor. On a small screen, the sonar sweep report (your puzzle input) appears: each line is a measurement of the sea floor depth as the sweep looks further and further away from the submarine.
|
||||
|
||||
For example, suppose you had the following report:
|
||||
|
||||
199
|
||||
200
|
||||
208
|
||||
210
|
||||
200
|
||||
207
|
||||
240
|
||||
269
|
||||
260
|
||||
263
|
||||
This report indicates that, scanning outward from the submarine, the sonar sweep found depths of 199, 200, 208, 210, and so on.
|
||||
|
||||
The first order of business is to figure out how quickly the depth increases, just so you know what you're dealing with - you never know if the keys will get carried into deeper water by an ocean current or a fish or something.
|
||||
|
||||
To do this, count the number of times a depth measurement increases from the previous measurement. (There is no measurement before the first measurement.) In the example above, the changes are as follows:
|
||||
|
||||
199 (N/A - no previous measurement)
|
||||
200 (increased)
|
||||
208 (increased)
|
||||
210 (increased)
|
||||
200 (decreased)
|
||||
207 (increased)
|
||||
240 (increased)
|
||||
269 (increased)
|
||||
260 (decreased)
|
||||
263 (increased)
|
||||
In this example, there are 7 measurements that are larger than the previous measurement.
|
||||
|
||||
How many measurements are larger than the previous measurement?
|
||||
|
||||
--- Part Two ---
|
||||
Considering every single measurement isn't as useful as you expected: there's just too much noise in the data.
|
||||
|
||||
Instead, consider sums of a three-measurement sliding window. Again considering the above example:
|
||||
|
||||
199 A
|
||||
200 A B
|
||||
208 A B C
|
||||
210 B C D
|
||||
200 E C D
|
||||
207 E F D
|
||||
240 E F G
|
||||
269 F G H
|
||||
260 G H
|
||||
263 H
|
||||
Start by comparing the first and second three-measurement windows. The measurements in the first window are marked A (199, 200, 208); their sum is 199 + 200 + 208 = 607. The second window is marked B (200, 208, 210); its sum is 618. The sum of measurements in the second window is larger than the sum of the first, so this first comparison increased.
|
||||
|
||||
Your goal now is to count the number of times the sum of measurements in this sliding window increases from the previous sum. So, compare A with B, then compare B with C, then C with D, and so on. Stop when there aren't enough measurements left to create a new three-measurement sum.
|
||||
|
||||
In the above example, the sum of each three-measurement window is as follows:
|
||||
|
||||
A: 607 (N/A - no previous sum)
|
||||
B: 618 (increased)
|
||||
C: 618 (no change)
|
||||
D: 617 (decreased)
|
||||
E: 647 (increased)
|
||||
F: 716 (increased)
|
||||
G: 769 (increased)
|
||||
H: 792 (increased)
|
||||
In this example, there are 5 sums that are larger than the previous sum.
|
||||
|
||||
Consider sums of a three-measurement sliding window. How many sums are larger than the previous sum?
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,300 @@
|
||||
DsPhSBQQQhqmBDhPDsFwjwsLjlRjlttvjvvtRb
|
||||
rNJMNNbrHrtjHLHjvwtg
|
||||
fNbNzZdrZnMnMPnQShFPDmnqFm
|
||||
QWVCFfQffgQCVZzVVpHsHJBqtpspJFRHqq
|
||||
mwDbmnnGNlNcwNDDNRbnNDlJTpBJBtJGtPTLsBGqTqqsqp
|
||||
MlSdnScRnnmmDjSdNSdCzvggWzrgzjvfvrgVzW
|
||||
gsMljbrjlZlWcWMJrWwTwbmwQbmmLDQQLhwL
|
||||
CdgpzdgpgnfThHfFRwhfRf
|
||||
SptgpSpnCNpVSGNPvPGSddcMWjMrjqBsJcWqMcBWcVlZ
|
||||
JcJLQQFWhQJPJpWcwjHvMQvnnlMvzBHd
|
||||
tCtGZrmVRmVGTVTtCfRTCHHNNvdNzmdMvMlNzvwdvw
|
||||
CTGGRftfSGtGTGDLbFchSgSWWWcM
|
||||
QcMFQrvrQbvtczbVbjbMzZzRpqmDDmqqnNzCDCDC
|
||||
SHHfPJssGLPSdHThLhHdRmqNmNssnNmNCNnpjmsn
|
||||
LhLJfTdLJwfgPTdfGccrtjcMrccwvcrrFr
|
||||
jFLLLqDGjbtqLCChpMMhMBvpwMTmffpZ
|
||||
ZnJHRncHHgnrsrZffTdMdMBfmMvfvR
|
||||
NWWPnZrVHrZPCDDQtzDCPLCq
|
||||
jpFjvBZhDFHZdwcmslcslBLLNl
|
||||
dVtTVVCzzfrrMPNLLcnVcPLRns
|
||||
CrzWzTqdWtGCzJtbJCrMjjDFHZQjZSpvFGFgHhHp
|
||||
JjJqMctnhtDZDQtf
|
||||
TrFFlrrCCHPwHwlPHFPzDhsffQQDsVfWwVJQJB
|
||||
HHHGdFlHldTpCCFFlLHdCRJccMnqvqMgnNjjMjjvLMLcSv
|
||||
cMfFcMFcrqgJLFZdrTDdthPGsGmtGs
|
||||
WwjNwnjjBQzVVQHwRDnmtPGhPPsPnnTGld
|
||||
bWHBjWVzpbRzbmScqgZMFcqf
|
||||
RJjPTBJhTNNjfPhRBdqtlgdbGldwtCPgdb
|
||||
ZmrHHmzpvSvvpzvmvDVCGlWVwCWtGtWCddggqf
|
||||
QQpzFrHHQnzHvfTcNshcLRNFJhcR
|
||||
QrPQDrppBQmCmFQm
|
||||
TzqzsLfmsfSTfqzVLftNdJJNJGCwwGdgCwSGNC
|
||||
TVHTfzWsfftsZstnbvrbWbrbppPbrmmP
|
||||
BQrfqrLtJnttqqtQBJDDtBnDzRgldhVVpJlgzpzhpzsgslhV
|
||||
TTNcPZCvZjmPFZjvPHLlWdNLghVhzzlllpVd
|
||||
jcFPbTcZTFcmcjMjjFjbLwbnDBtfqbtBwfwSBnrbGw
|
||||
SZJNJtrNzjjNCzlBBmqmQDBBmDBBjB
|
||||
PGPbGwhLsnvwnVbGPVMZsDsTBBgcZgBBDBfDBf
|
||||
pnnhhvphGVpvRPnJlSFRNNJHZHSdSR
|
||||
hbmDDmwnnVGbhmjNrrWwLNLsWBrw
|
||||
dMrgvcQqdjlBLlfW
|
||||
HzzPSrcHqFHQgzpPcMpQqrtmbbbRhHHVGnZDnVHhVbVZ
|
||||
RwtvdPRvSlTQmHHBQBRL
|
||||
FjVSjrsFVnFQnTHmnT
|
||||
VCVVMrWWjVGgbcNVGCCVdlvfdqfvwbSzwqfwZzwv
|
||||
fmPDwJPDFRmRgPdwwwDNwgwPzhSQzVSzVTQdzHZzHhzQMQzQ
|
||||
sWtGCWtpcqqpNnQjjzhVTTVQczhj
|
||||
tWBGntsCNlqrWswDRfFrbFrPDbPf
|
||||
dmzmjcbQjjQztFNqsqBcMJqNPF
|
||||
nlTWnClWwQDTVnTrsMsCRBPZRJRJqRJq
|
||||
wTrhwpVVvgvlDpTvVWVDdLfzgbLtbzSQLSzzjzLz
|
||||
RWZdHvRdBRGbbvCjJnbn
|
||||
pqqpSwzpSSbCwPwjlwjl
|
||||
gDzzqSVzqrThpDBtRtCZdQRQLrQQ
|
||||
GRqTGqtmTVdGHHVVNNlhPlMqbNqNDbqW
|
||||
LzQSdFnfznfwBcLcnFppBBDDMPMPhDbhlwbWPlbWMjrD
|
||||
QznFnLZFvVvHRgsddG
|
||||
BBHBfBHFdSltmWJvqtNtHq
|
||||
TQDrrVMzVDnWnNZDJc
|
||||
gWzprTCrCMQzGGjjhwFwdffjfl
|
||||
LLLSSSzBBlBLsszncCBZSPSMMMpdWTdrmmnfVGVmMfmrmm
|
||||
DghttvwhHRvjJthNJwhVtDHGpddMWdMmrMmfGdppjWTfpq
|
||||
gbJRthQDDRvwtDhQhDFPcVcbPczLzPBScBBF
|
||||
sZsZpTtLCsbspZtTwrCwrwtDmNNdJmmqSJfqmfNGNmHqGdqb
|
||||
nQvjTcjQglFVlllMFMVFqWfNqnNHHHdfSfHqfSJq
|
||||
hFvvgFcFVzphpTrrwZDp
|
||||
qJqfhsBpfSpchpqcrqwCDvvCDQndmpwDtnRQ
|
||||
jWHPZWWjZsCmCWRDmQ
|
||||
PPzMGHlzMNsPLPlZsllgsNrhNVBqhFVBbBSqFFBFrV
|
||||
RnRsFFdSzmgwvQsqwc
|
||||
lbgHGMBHlWWWlfWGGBtGwqDpDwmcpMrrqrQDZrMZ
|
||||
GGJLBVJbVGjGtHVfJtWGHBLLPdzdCghnRnRnSShgNnhnddhj
|
||||
VgzLFjjwhhSwFhVZgRhRgHHCCvdZdrqqCTvBCrqvvr
|
||||
ncnNbGMcPpvHFrssdBHM
|
||||
cnctcNNbQGWFJctftgVmzShzzwwVwgmwfR
|
||||
pFWmSSFGQlvTbwWTwH
|
||||
jdBgNhRgMftNBhPbhHnZHlTTZcwZ
|
||||
lfBNRjCtCfMjsBfCjgfNBRMppGpJqsJQGrrmmJDpGmDDFG
|
||||
GznngnhzccVdgjbbVjVjVbVLwwQJmQMrLTZhJmZLQTJWmm
|
||||
pDBSslPCFPCpvCqvpPBQTlQLrdlJWrLJLmrlrr
|
||||
psSsBptpCBdjtcjNVcGG
|
||||
sssppsmchwspFLtvHhQJMtFb
|
||||
rRLDqRVLNSMvFSSV
|
||||
WDrLnzrDqzRqRzzfLgRnzrnsssZZZsZBgCwwmBppwBspZc
|
||||
MtPbwvzzVtzfsqGGVpdSjsLd
|
||||
DnNRCDJBnHJDHDnrDTRcnNZpZSsSLqjpdqqqSMqdddTj
|
||||
CFRFRFHgDRnRgMtfFvvwzwvwvzWv
|
||||
PNpFPncvvchPpNjpFhvPhPLmBwMgDRRwRgMDhBmLzBDD
|
||||
trHSrdTtslWrSWmfzgmMnfBzmn
|
||||
JsrQsJHHlsVqTjjpbbNnQNNpGG
|
||||
sVQCdsmGlnlCmnGmQQhGCJJNvNjpgqhqhvPgpgPqjpcpcW
|
||||
DMSfSbHLHbSDBBzLNvccWRcddvPjNj
|
||||
FSwHfTFdFsmJlnTTmV
|
||||
FctwtTTCScvShFqtwScrcTSCJQGNndGHWJNQHWHZdgJrJgGN
|
||||
jspLlfPlpfsDjBspfllWgdWHQggZHngHNGdsWJ
|
||||
lRMpBlPmSFRTcvZv
|
||||
TVZpRRVvFRVpTZRfFhFvvzGVwrwwwdDBMwQrgcDtMtDDwZrL
|
||||
jsNsWqWjNQCNWbjPMcBLPgBtrdMwdrdL
|
||||
SJSsmqlSNljbmlNjsbQVffzGRvzmmVhQpVGz
|
||||
BFFMvcwMwwpFFfpbDMqPVgLVgmLDPR
|
||||
JtSsSzJssQJJWjRZzgLnDgqLPZgzbg
|
||||
dsdtWQWdRGjTRNQNQvGfHCCFpvfGwlCfCp
|
||||
zzWGqWnqnwWCvCrHffHRpBpBBRSJzRFFDhSQFR
|
||||
VPVsZMNTLsMvPsmBJhllFpFBTJFQpl
|
||||
sZtsNsZtdZgjbwggjnbvqr
|
||||
QpTvrphmDvvddfcJJHTTncMlMG
|
||||
bRZZPRwjgzzlSSjGlnlSJS
|
||||
BZzBzssWgwzzwNBsgsPBgszmQptqrrGdvdWmqdhhFQDpQF
|
||||
FfMtzSqlDlzfMhPFhPtffNRsCgSgCCGspRpRGSsgsg
|
||||
WTcWLTTVnWmrVdLrcHmNGNCZwCCggpgDRwpCnR
|
||||
JcdWJHTJWdJdjJccrLvlFltFQQvPFDMjqqlP
|
||||
NfjFNNZPDQVJVWpCbQpJ
|
||||
lcmdzlmzBtRSTlTTcncsVSbhpLWpWgsWghgsVS
|
||||
mBTRRmGccRtBwDbrGPbrMMrF
|
||||
VVQqlsGrVsMWBNFNMQHF
|
||||
TfzZfDgjgnLGjjztTncCFwwNmdvNcwwNBvHNFwvd
|
||||
jzjDgZzjntGJZzCnhrrSlPVsJslpslPq
|
||||
dVhpjGPdjHhqHgtHJJ
|
||||
sFzrzllQswDwFbcmBlgvZTCgvqTCfgHQJtqT
|
||||
nDbBsFzzrrtFrlwzPdSVMWMVVMSnGNLd
|
||||
wqJCjqChmwMLmMmprNgG
|
||||
DNTtdsdWcHdNspGQggnrgLnQpc
|
||||
SZvFftdddDsDTtttTDJNCCwJJZzbbCjwwVPj
|
||||
VstwZCwslBZQDBjfDDBDfS
|
||||
rvHnmMRrTzmMrmhRppbhDfpjfbjbctjD
|
||||
rPFLRLmFvvLvHvTCtqsVVwldGZGPGV
|
||||
SNZDJGfvwgMgfgmLmLcmBqgWgQWr
|
||||
hPnPTnVGsPRqLWpTmQqQ
|
||||
tsbnFhhjhSdGJNCjSf
|
||||
QSbGgBjfTCMWFNPFFtDghPrP
|
||||
JqHqJVzZzwJJHLlqQptDhPrctpPDtnLF
|
||||
zZmwJwdwdvHddVJvZqdzHlfGBbsCmMTsWCBCjsGGBbMQ
|
||||
gVmLtpWrFTFBLtpcFNbvhNNnTnvnQRlQQv
|
||||
GHjjqsMqwZZJdqGfZjfZGjQDDhvQNzznzRzRwDNbvgzv
|
||||
sZGPgssMqHZpPptmCcpCrP
|
||||
CZCNNLmwzwCGMZQMQsFNWplvpsJBWpFHBp
|
||||
SPbSbDRRbnDqggnbVbVrbRWHJFTlBBcTvWvsPvFpHTcl
|
||||
tVgSvqVbnqDdgQzMQMGMmzthCw
|
||||
mpbPQlblbwSlfSPGBpBGPpBFgMMtLFSHMLVVDVdtHLNctF
|
||||
WnhZsrJhTnWrgZdZgHNLcLtt
|
||||
hjCsCWRhjzhTjnWnQBbmPQQPLBGfqjwQ
|
||||
BFrzdtmRmpFtFwwmjjzNQllPshqHvjNh
|
||||
fWCLLCMJnCDbgfMJhPsPHvqvqVsssQ
|
||||
WbLnCZnvprpmZrGd
|
||||
gjMzTGBjWFBCCSSrBC
|
||||
bddJJndbdJfwPPthrrSSSsFSSg
|
||||
NJHbZbbvvWGgjWgT
|
||||
dpfphMggHdQcwftMMgdtzWGfGWnDBnmvnVJVvfmn
|
||||
CqPFTZPSNCTsZZZRLzGmcGVzDLGvLWBWJm
|
||||
TCrTNSScPlplpHrQrQ
|
||||
lqrCvhWFvMGWgfHPgLfjfdgG
|
||||
zjmbjSnzRzVVRmzBRtwjVQnNLfdPgfLdfTtNLPHTNNpppf
|
||||
mbSZRzQRBnnzbQJbmjmSbmVhlslZMrclWFrrqWCWsFhchF
|
||||
mpfNshshflNthWfJCBBdmnQbQBZQdn
|
||||
VFVRccgGTqTrHTbWBFjJBCFFJCCQ
|
||||
PvTDHqHqPPGVqqhwfNlWlDhMltlh
|
||||
HmLLgWVjJwhwWLgjjhmVHLLLlSzBlBlSvBvBFGvtdStJSSvq
|
||||
TRRrPMsfQTbRRCZRnTMRZZTCcvSccqBqBBlzdFvBqFsGBcts
|
||||
bRNPbRCZMCrQNfPLdhVpLDVgDhNHWV
|
||||
sPJFDsSsVLgHjLHPbj
|
||||
vCnRQhhRQdVQZlZdbHNMlqNNjgjbpbBL
|
||||
ChhCCCWTWnnmvmGtztStzScwrcVcFW
|
||||
NRBTNDBglSSgDwCClQQSFFHdLLsFbPFFLt
|
||||
McpmWccMWHZPcLstbt
|
||||
MWnWphVMvvzJzpWJWmVphjrDDBBTRwRDDDRRCnPDnqgg
|
||||
hsnnhhLljLPTmZwvdZdZjmmz
|
||||
RQNNDpNMSZwvsmqstN
|
||||
QFMFRDVDsHSpRpHSMRHfGGGTLhCChBGhBhBFBJ
|
||||
TTbltCvClzvzCZtwtwLTtQQQgjNgmjgQRRRQSjQLjR
|
||||
HPpnZHcJsdnnfsdVHHSSqghhmqBSSqSmBfNj
|
||||
VMJJdnMPrMGVrzvCZwZWCzCt
|
||||
CcQnBBCfBvRzDlsS
|
||||
PdbPPCbhGGpDSDlDDhvDJl
|
||||
HmHWPWdbHnCwCHCr
|
||||
JHlmJcMWHQcPmlmJMmMZPfwTTRDfgdDBfRtgQgdfBw
|
||||
zVvFrqGjzWGVrqvjvNFpspvVBgNNddtTgghhRTwgdDwwwBfT
|
||||
bVFrrvsvjWGVsCsqpSHZmMPJlJnCcLcPZZ
|
||||
QrrQZFZnRtnFRTrnlFTtRZwpGGwzGszhjzbsGzzhmjjhhmhf
|
||||
SgvpDSJSgPBSDPDNgpggmsMhMmffsMmzfJmzHHMj
|
||||
WNVcCPgSSDCddSdWCpNBclCQQFRQQlnTLFLRZQnLtt
|
||||
tgvqWqzvntdlzNzzHrbPrMhHMhhrVrjPmC
|
||||
FGTGGRGTffcJRpQcJJwmjhPLhjnCQPrLPVQrMr
|
||||
SppRSDRwFnJJwwswTDdtzBzqWWzZDldNgtvl
|
||||
sjzPjLphMSrlppSp
|
||||
fbGqgwTqgVTFFcgGTTGcQvfHQZRlSrSlSmMNMBRNNNrZmm
|
||||
MVcFGTFtqjsJLjjtCd
|
||||
jVJqTRHjjtDjZnVJVVjnNdwfCFPZmPgCCgCZGCFFrrFg
|
||||
LSLBMBWsbBBCgfdrFd
|
||||
ShbbzdzQRNNNVhDN
|
||||
JwbSRqmSwRwcpmbSSVfhNBTVGGRnNNzRNh
|
||||
ZPfQPjZZrffQZszhzTnVGBvntsNz
|
||||
rLjggjQgQgFdPQjLFQZgwLMbWccLSwWHqHfSqpwc
|
||||
cBhzNpztzHNrpHSHQrhZjZqdJRRgPqjhjqqP
|
||||
bQwsMTswwVjdZMVRJM
|
||||
vGWCTDCTQvvtlvQQ
|
||||
mHVmTTsmzRmRHffmmfMGBzSPMhSWWdDWDSGB
|
||||
VNcnNbtqqJbcbvgvWhShDBDPhjgPhSjB
|
||||
FrrbCnqJcbCJcFFbnqJlppCTfQmfmZQTLVswRLZp
|
||||
rWWppSStfRBLfHPdHHDzlldZ
|
||||
QrTnQmmVCqvrvJvzJZPHvzHsDs
|
||||
qgMMmrTTCcnQQmCNQNQmgTpwRWRtwtpcBWwjSRSSpttW
|
||||
SzWQwwqVbQzwGSfVwffVwbqhFGFFMgGLGMlNMcnNgcvlMg
|
||||
ddZHHsrCdBssDsHmChFLNNnMvmNnnnFncL
|
||||
rpJJdHZJdZHQSRJbSfVhww
|
||||
jLtFhNwNNvHnjFVvQLQLHhfbGDMPfffpllpttZMPPZZb
|
||||
VmrqszVmgCWWggbPGclPlZbcZCbf
|
||||
JdrTmVTVsqsRJHvQnnhwhBLH
|
||||
vpdBvsvdVvSPhvQFCgrRmhjqqRgWcWWgmf
|
||||
tJDGbZHbjRHNrrBj
|
||||
DnMnzGJJwtzVSzzBzTBSTF
|
||||
hZMDbQhMhlMDJrDrPMJRRqGJSvFvSwFSVdvGvwSFqq
|
||||
HjjzcRTnpGVSGGFWHH
|
||||
pssmjctLzpsRRnhlQbPfPrgDbZls
|
||||
FJMhPhnTMGmBFdnmlrfqfCcwlwCwCv
|
||||
pjHLsLbjjRHsHsjDjVsgDRjzCnfCfzqrqvwgflcvcvvgqz
|
||||
njtpHZnLLQGhTtTWSSSh
|
||||
NMddMTDrrjNnrnMWMrlnPwNwftBtGvptGjBHgBgpfCCSfgvf
|
||||
mqRqLFZRVFbtgBSCbGWWHp
|
||||
LZZRmQhVLLFzZdTQPndPNTTnQW
|
||||
CprQrcpqhHhpppchpphdcdpLMRMGsVGGsMsLbZbtbfMRmtbG
|
||||
DzlgTjwPTlSSSCDSlggNmMRtbsstsMfbwtVssMmt
|
||||
TNCNSBNJJTNPJjCTBDzjlJrvvcQrrhphWBqHhHdqrnrr
|
||||
ScbcbglMPRSmvclTlzMTdhVHhhjfdsdhrVDzfjrD
|
||||
LJGtpQwpQBBCttJLGqtqGHhPfDdHwjjhrVrhdrdshr
|
||||
WCpZQCGqtqQWtQWplZPcvMmgmvPccbvT
|
||||
tGWqthqGVdzBWwdd
|
||||
BZvZHFFHZrHZvZNRRHHZNHrMMTzRMTdTzbgDVMVssTDTwg
|
||||
JnNmrHHNrCGBPPnGGc
|
||||
wvFvZBmppBdSLcvshcLrgl
|
||||
bTQqJJHJzJjDQjQtzRVJztDHslgNNVLcgSrsSsWrSslWgrgL
|
||||
TqHHjQnbHTbbmZBBcFMpmBwn
|
||||
ZFCqSlCPdCRTLWWTQQLLQS
|
||||
GjggHcvsggHVTVBLnlcpBQ
|
||||
hvGhlrtjmjrHHhjsMPFNPdtqMPqqRfCf
|
||||
cgRwVfVzrgqqwZctTztFMFMTCdPmmF
|
||||
bWJsSJHpTDRDTWMC
|
||||
sHHNbshnlJhJjBsjsbnBHbZcqrZZQwqvvZcrwwvRcZnr
|
||||
ttgVBtMbttngmHJVpzlzZlppzw
|
||||
cPcsRPmPPQfGcccRQSSZzzvzlflzZHvJppzJzT
|
||||
sQPSCPPWccWWWqsQqRCQFNRMmnbnjjNbgDdBjhBrdbdDbd
|
||||
gSsZDSgdQZgWSgddwLDLLfCDBqvlhBlClqtqjhvBhB
|
||||
RMcsVMcsbVsrPrmJcPHHVvfjjCnvvfCqhlqvqqqq
|
||||
NFMRRpHPgzszGppG
|
||||
WmmZZNJCgCBZCzPvmBCmjWjjqFtFqjFjbVwqwjtt
|
||||
ppDMpdMfSfSSNtlwqbqwwq
|
||||
dTGDhdnfLMLhfDDpQvZNZgmrmrQJgrLQ
|
||||
jrqRqfNNhrVvcTVdpTscpd
|
||||
tGWBlLggWGddTspZZd
|
||||
JJzWtQgQsDbBgDWsgbFrPrRJNMJMPqMNfHjH
|
||||
GdvVbbWsWdvWGDvWZcbFBTBZCzCjwzrhPBJjzF
|
||||
nQPfSHnglfpnMSngnMgJTprJCCwwrwCwpTpCFj
|
||||
SQQHSttRqggmlVsNcvWdRvbWPN
|
||||
WLNLCWLsSJgHFrSHrM
|
||||
gDbzRTcmbzPPgPPdtBctfHfrMMQfGFJrhQnMfGJR
|
||||
dmmzzqZdDqqTLLwjgZgNljws
|
||||
TCqsDHssmDsDGVGlVcMccGDV
|
||||
FLntWWnnFzFgzzbtbznLBtlfjGZmcfFGVNFGlVZcMNlN
|
||||
PpbLLmpgbRzqpCHwChQqwh
|
||||
lVBPVgflgBVVrVTTwgwBPmgflDQjnnGvqjGDDFjGlGnvqHHJ
|
||||
ScCLzdCZdbLSbFdFqvDDdGMQGQ
|
||||
bchNCLRWSbzCbNRzbWRmsrhQwVVwBhmQpPwpgV
|
||||
GmfHCCPqWqHLWLCfRJpbrrbQphwZbZ
|
||||
STVDQzNnzMzNdstMDzzNtZwFhrlwVJJrJlFFJRFwFR
|
||||
DzSvzstnszMnjQcqggjPqQBcqq
|
||||
BzNwLTqwTjrBrljWpBlrQpBpsCGGCtpssCMttDtHsttMDCHp
|
||||
mnrJVmRhhvJVcHtsGHMCnZCPZM
|
||||
bvSmVbRhbgmmSJflzNLrzqzfWfqBWr
|
||||
qsZLqqFNhfrGnJFv
|
||||
DVjVmWlcjVjdDTDlbbTDTzmrCnMmJGnHnmCHfJGfvnfM
|
||||
lVRdDglTlTgVlVjbWWVzVjvNZqSBsLZNtqRsLBqLqQtL
|
||||
ffRRfLVHZHfJHVJcMrMZZwwTzGBBzBTBjGTwrwdSCj
|
||||
qmWbWQbqnbvWhbQPGnGNnpvwSzltpBldtSdzllptCSjTTt
|
||||
vWsbnbWnNvQQQQvsRRLfJRRVGfDcfV
|
||||
PpqrvswPvvvPsNqmDLDttCCcHHZVrCtW
|
||||
hgSddBhghQMdbhbwhgSdQgCCctZcDtLntLttCVLtSLCc
|
||||
dGzdQMFzQMdgGGlGJMzBgBwRqNNfmmTsvfRfJTpwjmpP
|
||||
pcphpdrWDmTgHWMtRWqHRVVH
|
||||
SbGcGGQnvNQGvsjBtVHBLjvqVPVB
|
||||
lzbQCzbZllSzQslpCJpJJDggcggfDT
|
||||
ffrTlhrVrfCsDVTsWzGBBZcBRBqRBWtGtZcq
|
||||
QNFmFHrHNSSmSLJdJrNGZLbGjbcBjBGjqcbgjc
|
||||
ddQvPnHddnQJHSHSFPdnFfDDTfDMMCrwMlPTwDCsrC
|
||||
NBnrNHQHBscvhfBM
|
||||
bbGtgWWWqZFmnZGZbmVCdMzvvShfzfGcdcfMSS
|
||||
WqbjnmbnjWgmFFgtWVbWZwNTNLjNprNwQLDwrTrHQr
|
||||
lwwlcjlzQRBcBccbdLCVnNVWJJzfLndd
|
||||
pZDMtZpSDMZpMZMsPtHVNJVfRCRddVndnJLSJd
|
||||
mDTZvTqtDDHttRPcqhQlwgGlghbqBh
|
||||
DTspTqssqTbdmCMwVmnmlfCD
|
||||
PLPWjjrSjvPzqZvjvRqjLtPwnnHCmWVcncMnnwmncHcHll
|
||||
RFztFjjqjQFQTbdTbQ
|
||||
hTFSVSdhMMVMFjjgbthcbzczcg
|
||||
DvwCJVJWWJDRnfmbDmccfmmgfb
|
||||
QrJvPGWWnpVMqdZsZpqM
|
||||
gRLcHbgnfpgpJjlqqp
|
||||
SFwrTHFBqlZtBPZq
|
||||
HTzDwmSvCvCmsmmvTSwvFwcfRRNRLcQRWNssNNbRWLWL
|
||||
PpMgDMDnsWSnjBQnrjbn
|
||||
LFcVVGChCFdhdVFZVpVCdVbvQbRrbvBBbBjQSJZrrJrR
|
||||
FNwGNCCFHcVTHcFdHHHTDzMzfsgzwpPWMmPflmtt
|
||||
@@ -0,0 +1,110 @@
|
||||
using System.Reflection;
|
||||
|
||||
namespace AOC.Tests.Y2022
|
||||
{
|
||||
[TestFixture, Parallelizable(ParallelScope.All)]
|
||||
public class Day01
|
||||
{
|
||||
protected string GetThisClassName() { return this.GetType().Name; }
|
||||
private string[] realData;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
realData = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, "Y2022", "Data", $"{GetThisClassName()}.dat"));
|
||||
}
|
||||
|
||||
[TestCase(@"1000
|
||||
2000
|
||||
3000
|
||||
|
||||
4000
|
||||
|
||||
5000
|
||||
6000
|
||||
|
||||
7000
|
||||
8000
|
||||
9000
|
||||
|
||||
10000", 24000)]
|
||||
[TestCase(null, 70764)] // The actual answer
|
||||
public void Part1(string? input, int? expected)
|
||||
{
|
||||
string[] lines = input != null ? input.Split("\n") : realData;
|
||||
|
||||
List<int> elfTotalCalories = new() { 0 };
|
||||
|
||||
int elfCounter = 0;
|
||||
foreach (string line in lines)
|
||||
{
|
||||
if (line.Length == 0)
|
||||
{
|
||||
// Move to next elf
|
||||
elfCounter += 1;
|
||||
elfTotalCalories.Add(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
elfTotalCalories[elfCounter] += int.Parse(line);
|
||||
}
|
||||
}
|
||||
|
||||
int result = elfTotalCalories.Max();
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(result, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 1: {result}");
|
||||
}
|
||||
|
||||
[TestCase(@"1000
|
||||
2000
|
||||
3000
|
||||
|
||||
4000
|
||||
|
||||
5000
|
||||
6000
|
||||
|
||||
7000
|
||||
8000
|
||||
9000
|
||||
|
||||
10000", 45000)]
|
||||
[TestCase(null, 203905)] // The actual answer
|
||||
public void Part2(string? input, int? expected)
|
||||
{
|
||||
string[] lines = input != null ? input.Split("\n") : realData;
|
||||
|
||||
List<int> elfTotalCalories = new() { 0 };
|
||||
|
||||
int elfCounter = 0;
|
||||
foreach (string line in lines)
|
||||
{
|
||||
if (line.Length == 0)
|
||||
{
|
||||
// Move to next elf
|
||||
elfCounter += 1;
|
||||
elfTotalCalories.Add(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
elfTotalCalories[elfCounter] += int.Parse(line);
|
||||
}
|
||||
}
|
||||
|
||||
List<int>? topThreeCalorieElves = elfTotalCalories.OrderByDescending(x => x).Take(3).ToList();
|
||||
int result = topThreeCalorieElves.Sum();
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(result, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 2: {result}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
using System.Reflection;
|
||||
|
||||
namespace AOC.Tests.Y2022
|
||||
{
|
||||
[TestFixture, Parallelizable(ParallelScope.All)]
|
||||
public class Day02
|
||||
{
|
||||
protected string GetThisClassName() { return this.GetType().Name; }
|
||||
private string[] realData;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
realData = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, "Y2022", "Data", $"{GetThisClassName()}.dat"));
|
||||
}
|
||||
|
||||
[TestCase(@"A Y
|
||||
B X
|
||||
C Z", 15)]
|
||||
[TestCase(null, 8392)] // The actual answer
|
||||
public void Part1(string? input, int? expected)
|
||||
{
|
||||
string[] lines = input != null ? input.Split("\n") : realData;
|
||||
|
||||
int result = CalculateTotalScore(lines);
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(result, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 1: {result}");
|
||||
}
|
||||
|
||||
[TestCase(@"A Y
|
||||
B X
|
||||
C Z", 12)]
|
||||
[TestCase(null, 1783)] // The actual answer
|
||||
public void Part2(string? input, int? expected)
|
||||
{
|
||||
string[] lines = input != null ? input.Split("\n") : realData;
|
||||
|
||||
int result = CalculateTotalScoreV2(lines);
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(result, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 2: {result}");
|
||||
}
|
||||
|
||||
private int CalculateTotalScore(string[] lines)
|
||||
{
|
||||
int totalScore = 0;
|
||||
foreach (string line in lines)
|
||||
{
|
||||
// The score for a single round is the score for the shape you selected (1 for Rock, 2 for Paper, and 3 for Scissors)
|
||||
int scoreForMyShape = line[2] switch
|
||||
{
|
||||
'X' => 1, // Rock
|
||||
'Y' => 2, // Paper
|
||||
'Z' => 3, // Scissors
|
||||
_ => 0 // Invalid
|
||||
};
|
||||
|
||||
// plus the score for the outcome of the round (0 if you lost, 3 if the round was a draw, and 6 if you won).
|
||||
int scoreForOutcome = DetermineWinOrLoss(line[0], line[2]);
|
||||
|
||||
totalScore += scoreForMyShape + scoreForOutcome;
|
||||
}
|
||||
|
||||
return totalScore;
|
||||
}
|
||||
|
||||
private int DetermineWinOrLoss(char opponentShape, char myShape)
|
||||
{
|
||||
if ((opponentShape is 'A' && myShape is 'Y')
|
||||
|| (opponentShape is 'B' && myShape is 'Z')
|
||||
|| (opponentShape is 'C' && myShape is 'X'))
|
||||
{
|
||||
// I win
|
||||
return 6;
|
||||
}
|
||||
else if ((opponentShape is 'A' && myShape is 'Z')
|
||||
|| (opponentShape is 'B' && myShape is 'X')
|
||||
|| (opponentShape is 'C' && myShape is 'Y'))
|
||||
{
|
||||
// They win
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Draw
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
private int CalculateTotalScoreV2(string[] lines)
|
||||
{
|
||||
// the second column says how the round needs to end:
|
||||
// X means you need to lose, Y means you need to end the round in a draw,
|
||||
// and Z means you need to win.
|
||||
int totalScore = 0;
|
||||
foreach (string line in lines)
|
||||
{
|
||||
// Determine what the outcome should be
|
||||
int outcome = line[2] switch
|
||||
{
|
||||
'X' => 0, // Lose
|
||||
'Y' => 3, // Draw
|
||||
'Z' => 6, // Win
|
||||
_ => 0 // Invalid
|
||||
};
|
||||
|
||||
char myShape = GetShapeForOutcome(outcome, line[0]);
|
||||
|
||||
// The score for a single round is the score for the shape you selected (1 for Rock, 2 for Paper, and 3 for Scissors)
|
||||
int scoreForMyShape = myShape switch
|
||||
{
|
||||
'X' => 1, // Rock
|
||||
'Y' => 2, // Paper
|
||||
'Z' => 3, // Scissors
|
||||
_ => 0 // Invalid
|
||||
};
|
||||
|
||||
// plus the score for the outcome of the round (0 if you lost, 3 if the round was a draw, and 6 if you won).
|
||||
int scoreForOutcome = DetermineWinOrLoss(line[0], myShape);
|
||||
|
||||
totalScore += scoreForMyShape + scoreForOutcome;
|
||||
}
|
||||
|
||||
return totalScore;
|
||||
}
|
||||
|
||||
private char GetShapeForOutcome(int outcome, char opponentShape)
|
||||
{
|
||||
if (outcome is 0)
|
||||
{
|
||||
// Lose
|
||||
return opponentShape switch
|
||||
{
|
||||
'A' => 'Z',
|
||||
'B' => 'X',
|
||||
'C' => 'Y',
|
||||
_ => throw new InvalidDataException("Invalid opponent shape") // Invalid
|
||||
};
|
||||
}
|
||||
else if (outcome is 3)
|
||||
{
|
||||
// Draw
|
||||
return opponentShape switch
|
||||
{
|
||||
'A' => 'X',
|
||||
'B' => 'Y',
|
||||
'C' => 'Z',
|
||||
_ => throw new InvalidDataException("Invalid opponent shape") // Invalid
|
||||
};
|
||||
}
|
||||
else if (outcome is 6)
|
||||
{
|
||||
// Win
|
||||
return opponentShape switch
|
||||
{
|
||||
'A' => 'Y',
|
||||
'B' => 'Z',
|
||||
'C' => 'X',
|
||||
_ => throw new InvalidDataException("Invalid opponent shape") // Invalid
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidDataException("Invalid outcome");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
using System.Reflection;
|
||||
|
||||
namespace AOC.Tests.Y2022
|
||||
{
|
||||
[TestFixture, Parallelizable(ParallelScope.All)]
|
||||
public class Day03
|
||||
{
|
||||
protected string GetThisClassName() { return this.GetType().Name; }
|
||||
private string[] realData;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
realData = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, "Y2022", "Data", $"{GetThisClassName()}.dat"));
|
||||
}
|
||||
|
||||
private char FindItemInBothCompartments(string rucksack)
|
||||
{
|
||||
string firstCompartment = rucksack[..(rucksack.Length / 2)];
|
||||
string secondCompartment = rucksack.Substring(rucksack.Length / 2, rucksack.Length / 2);
|
||||
|
||||
List<char> commonItems = firstCompartment.Intersect(secondCompartment).ToList();
|
||||
|
||||
return commonItems.Count == 1
|
||||
? commonItems[0]
|
||||
: throw new IndexOutOfRangeException("More than one common item between compartments");
|
||||
}
|
||||
|
||||
private char FindCommonItem(string rucksack1, string rucksack2, string rucksack3)
|
||||
{
|
||||
List<char> allChars = new();
|
||||
foreach (char letter in rucksack1)
|
||||
{
|
||||
allChars.Add(letter);
|
||||
}
|
||||
foreach (char letter in rucksack2)
|
||||
{
|
||||
allChars.Add(letter);
|
||||
}
|
||||
foreach (char letter in rucksack3)
|
||||
{
|
||||
allChars.Add(letter);
|
||||
}
|
||||
|
||||
List<char> commonItems1 = rucksack1.Intersect(rucksack2).ToList();
|
||||
List<char> commonItems2 = rucksack1.Intersect(rucksack3).ToList();
|
||||
List<char> commonItems3 = rucksack2.Intersect(rucksack3).ToList();
|
||||
|
||||
List<char> commonItems = allChars.Where(c => commonItems1.Contains(c) && commonItems2.Contains(c) && commonItems3.Contains(c)).Distinct().ToList();
|
||||
|
||||
return commonItems.Count == 1
|
||||
? commonItems[0]
|
||||
: throw new IndexOutOfRangeException("More than one common item between compartments");
|
||||
}
|
||||
|
||||
private int GetPriority(char item)
|
||||
{
|
||||
if (char.IsUpper(item))
|
||||
{
|
||||
// Uppercase item types A through Z have priorities 27 through 52.
|
||||
// 65 is ascii for A -> -38
|
||||
return item - 38;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Lowercase item types a through z have priorities 1 through 26.
|
||||
// 97 is ascii for A -> -96
|
||||
return item - 96;
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase(@"vJrwpWtwJgWrhcsFMMfFFhFp
|
||||
jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL
|
||||
PmmdzqPrVvPwwTWBwg
|
||||
wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn
|
||||
ttgJtRGJQctTZtZT
|
||||
CrZsJsPPZsGzwwsLwLmpwMDw", 157)]
|
||||
[TestCase(null, 8176)] // The actual answer
|
||||
public void Part1(string? input, int? expected)
|
||||
{
|
||||
string[] lines = input != null ? input.Split("\n") : realData;
|
||||
List<char> items = new();
|
||||
List<int> priorities = new();
|
||||
|
||||
// Find char appearing in both halves of the input string (case sensitive)
|
||||
foreach (string line in lines)
|
||||
{
|
||||
items.Add(FindItemInBothCompartments(line));
|
||||
}
|
||||
|
||||
// Get priority value of char
|
||||
foreach (char item in items)
|
||||
{
|
||||
priorities.Add(GetPriority(item));
|
||||
}
|
||||
|
||||
// Get sum of priorities
|
||||
int result = priorities.Sum();
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(result, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 1: {result}");
|
||||
}
|
||||
|
||||
[TestCase(@"vJrwpWtwJgWrhcsFMMfFFhFp
|
||||
jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL
|
||||
PmmdzqPrVvPwwTWBwg
|
||||
wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn
|
||||
ttgJtRGJQctTZtZT
|
||||
CrZsJsPPZsGzwwsLwLmpwMDw", 70)]
|
||||
[TestCase(null, 2689)] // The actual answer
|
||||
public void Part2(string? input, int? expected)
|
||||
{
|
||||
string[] lines = input != null ? input.Split("\n") : realData;
|
||||
List<char> items = new();
|
||||
List<int> priorities = new();
|
||||
|
||||
// Get each three line group and find the common item
|
||||
for (int i = 0; i < lines.Length; i += 3)
|
||||
{
|
||||
items.Add(FindCommonItem(lines[i], lines[i + 1], lines[i + 2]));
|
||||
}
|
||||
|
||||
// Get the priorities of all common items
|
||||
foreach (char item in items)
|
||||
{
|
||||
priorities.Add(GetPriority(item));
|
||||
}
|
||||
|
||||
// Get sum of priorities
|
||||
int result = priorities.Sum();
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(result, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 2: {result}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
--- Day 1: Calorie Counting ---
|
||||
Santa's reindeer typically eat regular reindeer food, but they need a lot of magical energy to deliver presents on Christmas. For that, their favorite snack is a special type of star fruit that only grows deep in the jungle. The Elves have brought you on their annual expedition to the grove where the fruit grows.
|
||||
|
||||
To supply enough magical energy, the expedition needs to retrieve a minimum of fifty stars by December 25th. Although the Elves assure you that the grove has plenty of fruit, you decide to grab any fruit you see along the way, just in case.
|
||||
|
||||
Collect stars by solving puzzles. Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants one star. Good luck!
|
||||
|
||||
The jungle must be too overgrown and difficult to navigate in vehicles or access from the air; the Elves' expedition traditionally goes on foot. As your boats approach land, the Elves begin taking inventory of their supplies. One important consideration is food - in particular, the number of Calories each Elf is carrying (your puzzle input).
|
||||
|
||||
The Elves take turns writing down the number of Calories contained by the various meals, snacks, rations, etc. that they've brought with them, one item per line. Each Elf separates their own inventory from the previous Elf's inventory (if any) by a blank line.
|
||||
|
||||
For example, suppose the Elves finish writing their items' Calories and end up with the following list:
|
||||
|
||||
1000
|
||||
2000
|
||||
3000
|
||||
|
||||
4000
|
||||
|
||||
5000
|
||||
6000
|
||||
|
||||
7000
|
||||
8000
|
||||
9000
|
||||
|
||||
10000
|
||||
This list represents the Calories of the food carried by five Elves:
|
||||
|
||||
The first Elf is carrying food with 1000, 2000, and 3000 Calories, a total of 6000 Calories.
|
||||
The second Elf is carrying one food item with 4000 Calories.
|
||||
The third Elf is carrying food with 5000 and 6000 Calories, a total of 11000 Calories.
|
||||
The fourth Elf is carrying food with 7000, 8000, and 9000 Calories, a total of 24000 Calories.
|
||||
The fifth Elf is carrying one food item with 10000 Calories.
|
||||
In case the Elves get hungry and need extra snacks, they need to know which Elf to ask: they'd like to know how many Calories are being carried by the Elf carrying the most Calories. In the example above, this is 24000 (carried by the fourth Elf).
|
||||
|
||||
Find the Elf carrying the most Calories. How many total Calories is that Elf carrying?
|
||||
|
||||
--- Part Two ---
|
||||
By the time you calculate the answer to the Elves' question, they've already realized that the Elf carrying the most Calories of food might eventually run out of snacks.
|
||||
|
||||
To avoid this unacceptable situation, the Elves would instead like to know the total Calories carried by the top three Elves carrying the most Calories. That way, even if one of those Elves runs out of snacks, they still have two backups.
|
||||
|
||||
In the example above, the top three Elves are the fourth Elf (with 24000 Calories), then the third Elf (with 11000 Calories), then the fifth Elf (with 10000 Calories). The sum of the Calories carried by these three elves is 45000.
|
||||
|
||||
Find the top three Elves carrying the most Calories. How many Calories are those Elves carrying in total?
|
||||
@@ -0,0 +1,38 @@
|
||||
--- Day 2: Rock Paper Scissors ---
|
||||
The Elves begin to set up camp on the beach. To decide whose tent gets to be closest to the snack storage, a giant Rock Paper Scissors tournament is already in progress.
|
||||
|
||||
Rock Paper Scissors is a game between two players. Each game contains many rounds; in each round, the players each simultaneously choose one of Rock, Paper, or Scissors using a hand shape. Then, a winner for that round is selected: Rock defeats Scissors, Scissors defeats Paper, and Paper defeats Rock. If both players choose the same shape, the round instead ends in a draw.
|
||||
|
||||
Appreciative of your help yesterday, one Elf gives you an encrypted strategy guide (your puzzle input) that they say will be sure to help you win. "The first column is what your opponent is going to play: A for Rock, B for Paper, and C for Scissors. The second column--" Suddenly, the Elf is called away to help with someone's tent.
|
||||
|
||||
The second column, you reason, must be what you should play in response: X for Rock, Y for Paper, and Z for Scissors. Winning every time would be suspicious, so the responses must have been carefully chosen.
|
||||
|
||||
The winner of the whole tournament is the player with the highest score. Your total score is the sum of your scores for each round. The score for a single round is the score for the shape you selected (1 for Rock, 2 for Paper, and 3 for Scissors) plus the score for the outcome of the round (0 if you lost, 3 if the round was a draw, and 6 if you won).
|
||||
|
||||
Since you can't be sure if the Elf is trying to help you or trick you, you should calculate the score you would get if you were to follow the strategy guide.
|
||||
|
||||
For example, suppose you were given the following strategy guide:
|
||||
|
||||
A Y
|
||||
B X
|
||||
C Z
|
||||
This strategy guide predicts and recommends the following:
|
||||
|
||||
In the first round, your opponent will choose Rock (A), and you should choose Paper (Y). This ends in a win for you with a score of 8 (2 because you chose Paper + 6 because you won).
|
||||
In the second round, your opponent will choose Paper (B), and you should choose Rock (X). This ends in a loss for you with a score of 1 (1 + 0).
|
||||
The third round is a draw with both players choosing Scissors, giving you a score of 3 + 3 = 6.
|
||||
In this example, if you were to follow the strategy guide, you would get a total score of 15 (8 + 1 + 6).
|
||||
|
||||
What would your total score be if everything goes exactly according to your strategy guide?
|
||||
|
||||
--- Part Two ---
|
||||
The Elf finishes helping with the tent and sneaks back over to you. "Anyway, the second column says how the round needs to end: X means you need to lose, Y means you need to end the round in a draw, and Z means you need to win. Good luck!"
|
||||
|
||||
The total score is still calculated in the same way, but now you need to figure out what shape to choose so the round ends as indicated. The example above now goes like this:
|
||||
|
||||
In the first round, your opponent will choose Rock (A), and you need the round to end in a draw (Y), so you also choose Rock. This gives you a score of 1 + 3 = 4.
|
||||
In the second round, your opponent will choose Paper (B), and you choose Rock so you lose (X) with a score of 1 + 0 = 1.
|
||||
In the third round, you will defeat your opponent's Scissors with Rock for a score of 1 + 6 = 7.
|
||||
Now that you're correctly decrypting the ultra top secret strategy guide, you would get a total score of 12.
|
||||
|
||||
Following the Elf's instructions for the second column, what would your total score be if everything goes exactly according to your strategy guide?
|
||||
@@ -0,0 +1,55 @@
|
||||
--- Day 3: Rucksack Reorganization ---
|
||||
One Elf has the important job of loading all of the rucksacks with supplies for the jungle journey. Unfortunately, that Elf didn't quite follow the packing instructions, and so a few items now need to be rearranged.
|
||||
|
||||
Each rucksack has two large compartments. All items of a given type are meant to go into exactly one of the two compartments. The Elf that did the packing failed to follow this rule for exactly one item type per rucksack.
|
||||
|
||||
The Elves have made a list of all of the items currently in each rucksack (your puzzle input), but they need your help finding the errors. Every item type is identified by a single lowercase or uppercase letter (that is, a and A refer to different types of items).
|
||||
|
||||
The list of items for each rucksack is given as characters all on a single line. A given rucksack always has the same number of items in each of its two compartments, so the first half of the characters represent items in the first compartment, while the second half of the characters represent items in the second compartment.
|
||||
|
||||
For example, suppose you have the following list of contents from six rucksacks:
|
||||
|
||||
vJrwpWtwJgWrhcsFMMfFFhFp
|
||||
jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL
|
||||
PmmdzqPrVvPwwTWBwg
|
||||
wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn
|
||||
ttgJtRGJQctTZtZT
|
||||
CrZsJsPPZsGzwwsLwLmpwMDw
|
||||
The first rucksack contains the items vJrwpWtwJgWrhcsFMMfFFhFp, which means its first compartment contains the items vJrwpWtwJgWr, while the second compartment contains the items hcsFMMfFFhFp. The only item type that appears in both compartments is lowercase p.
|
||||
The second rucksack's compartments contain jqHRNqRjqzjGDLGL and rsFMfFZSrLrFZsSL. The only item type that appears in both compartments is uppercase L.
|
||||
The third rucksack's compartments contain PmmdzqPrV and vPwwTWBwg; the only common item type is uppercase P.
|
||||
The fourth rucksack's compartments only share item type v.
|
||||
The fifth rucksack's compartments only share item type t.
|
||||
The sixth rucksack's compartments only share item type s.
|
||||
To help prioritize item rearrangement, every item type can be converted to a priority:
|
||||
|
||||
Lowercase item types a through z have priorities 1 through 26.
|
||||
Uppercase item types A through Z have priorities 27 through 52.
|
||||
In the above example, the priority of the item type that appears in both compartments of each rucksack is 16 (p), 38 (L), 42 (P), 22 (v), 20 (t), and 19 (s); the sum of these is 157.
|
||||
|
||||
Find the item type that appears in both compartments of each rucksack. What is the sum of the priorities of those item types?
|
||||
|
||||
--- Part Two ---
|
||||
As you finish identifying the misplaced items, the Elves come to you with another issue.
|
||||
|
||||
For safety, the Elves are divided into groups of three. Every Elf carries a badge that identifies their group. For efficiency, within each group of three Elves, the badge is the only item type carried by all three Elves. That is, if a group's badge is item type B, then all three Elves will have item type B somewhere in their rucksack, and at most two of the Elves will be carrying any other item type.
|
||||
|
||||
The problem is that someone forgot to put this year's updated authenticity sticker on the badges. All of the badges need to be pulled out of the rucksacks so the new authenticity stickers can be attached.
|
||||
|
||||
Additionally, nobody wrote down which item type corresponds to each group's badges. The only way to tell which item type is the right one is by finding the one item type that is common between all three Elves in each group.
|
||||
|
||||
Every set of three lines in your list corresponds to a single group, but each group can have a different badge item type. So, in the above example, the first group's rucksacks are the first three lines:
|
||||
|
||||
vJrwpWtwJgWrhcsFMMfFFhFp
|
||||
jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL
|
||||
PmmdzqPrVvPwwTWBwg
|
||||
And the second group's rucksacks are the next three lines:
|
||||
|
||||
wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn
|
||||
ttgJtRGJQctTZtZT
|
||||
CrZsJsPPZsGzwwsLwLmpwMDw
|
||||
In the first group, the only item type that appears in all three rucksacks is lowercase r; this must be their badges. In the second group, their badge item type must be Z.
|
||||
|
||||
Priorities for these items must still be found to organize the sticker attachment efforts: here, they are 18 (r) for the first group and 52 (Z) for the second group. The sum of these is 70.
|
||||
|
||||
Find the item type that corresponds to the badges of each three-Elf group. What is the sum of the priorities of those item types?
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,100 @@
|
||||
Game 1: 4 green, 3 blue, 11 red; 7 red, 5 green, 10 blue; 3 green, 8 blue, 8 red; 4 red, 12 blue; 15 red, 3 green, 10 blue
|
||||
Game 2: 3 red, 1 blue, 2 green; 1 blue, 9 green; 1 red, 10 green
|
||||
Game 3: 5 green, 9 red, 4 blue; 3 green, 7 blue; 12 blue, 3 green, 3 red; 3 blue, 7 red, 2 green; 7 blue, 3 green, 10 red
|
||||
Game 4: 2 green, 2 blue; 12 red, 9 green, 2 blue; 13 green, 15 red, 4 blue; 14 red, 3 green, 5 blue; 6 red, 1 green; 1 blue, 2 red, 2 green
|
||||
Game 5: 2 green, 6 blue; 1 red, 3 green, 5 blue; 3 green, 4 blue; 3 blue, 5 green, 1 red; 5 blue
|
||||
Game 6: 5 green, 1 blue, 3 red; 8 green, 15 red; 16 green, 5 red, 1 blue
|
||||
Game 7: 1 blue, 3 red, 11 green; 18 red, 16 blue, 5 green; 13 blue, 5 green; 1 red, 8 green, 15 blue
|
||||
Game 8: 1 green, 14 blue, 1 red; 10 blue; 1 green
|
||||
Game 9: 4 green, 12 blue, 1 red; 14 blue; 2 blue, 4 green; 4 green, 1 red, 10 blue
|
||||
Game 10: 11 green, 9 red; 12 red, 9 green; 5 red, 7 blue, 5 green; 6 green, 1 blue, 12 red; 3 red, 3 blue; 16 red, 9 blue, 7 green
|
||||
Game 11: 11 green, 1 red, 9 blue; 2 red, 13 green, 5 blue; 5 green, 2 red, 5 blue; 5 green, 7 blue; 1 red, 5 blue, 1 green
|
||||
Game 12: 5 green, 1 red; 1 red, 4 green; 1 blue, 12 green; 15 green, 4 blue; 4 blue, 19 green; 16 green, 4 blue
|
||||
Game 13: 1 red, 9 green, 5 blue; 10 blue, 7 green, 1 red; 3 green, 2 red, 14 blue; 16 blue, 3 red
|
||||
Game 14: 9 red, 1 blue, 2 green; 16 blue, 7 red; 2 green, 3 red, 14 blue; 1 green, 9 blue
|
||||
Game 15: 6 blue; 4 blue; 1 red, 16 blue, 3 green
|
||||
Game 16: 14 green, 5 red, 1 blue; 1 red, 1 blue; 5 blue
|
||||
Game 17: 1 blue, 1 green, 3 red; 2 red, 2 blue, 2 green; 1 blue, 1 red; 1 red, 2 green, 2 blue; 2 blue; 1 green, 2 red, 1 blue
|
||||
Game 18: 4 blue, 2 green, 1 red; 1 green, 1 red, 10 blue; 1 green, 1 red, 2 blue; 1 red, 5 blue; 3 green, 6 blue; 1 red, 1 green, 7 blue
|
||||
Game 19: 1 blue, 13 green, 12 red; 7 blue, 2 green, 1 red; 1 blue, 3 red, 3 green; 3 blue, 8 green, 10 red; 7 blue, 2 green
|
||||
Game 20: 1 red, 17 blue; 10 blue, 5 green; 9 green, 1 red, 3 blue; 1 red, 5 green, 1 blue
|
||||
Game 21: 3 red, 6 blue, 5 green; 4 blue, 1 red, 7 green; 6 blue, 4 red, 9 green
|
||||
Game 22: 11 blue, 2 red, 6 green; 16 blue, 5 red, 6 green; 12 red, 2 green, 10 blue; 14 blue, 2 green, 11 red
|
||||
Game 23: 3 red, 5 green; 10 blue, 1 green, 9 red; 2 red, 10 green, 9 blue; 9 blue, 7 green
|
||||
Game 24: 8 blue, 1 red; 3 red, 9 blue; 9 green, 2 red, 8 blue
|
||||
Game 25: 2 red, 1 green, 1 blue; 1 green, 12 blue, 2 red; 2 red, 1 blue; 2 blue; 1 green, 10 blue; 6 blue
|
||||
Game 26: 2 red; 4 green, 1 red, 7 blue; 11 blue, 2 red, 4 green; 1 red, 1 blue; 1 red, 5 green, 12 blue
|
||||
Game 27: 1 red, 7 green, 8 blue; 13 green, 12 blue, 1 red; 6 red, 1 green, 10 blue; 8 red, 2 blue, 2 green; 11 blue, 4 green, 4 red
|
||||
Game 28: 1 red, 8 blue, 3 green; 12 green, 4 blue; 1 red, 4 blue, 11 green; 7 blue, 10 green, 10 red; 11 blue, 7 red, 8 green; 10 red, 2 green, 2 blue
|
||||
Game 29: 4 green, 2 red; 1 blue, 11 red; 2 blue, 3 green, 1 red; 16 red; 3 green, 8 red, 1 blue; 2 blue, 7 green, 12 red
|
||||
Game 30: 1 blue, 3 green; 4 green, 2 blue; 3 red, 5 blue; 4 green, 1 red
|
||||
Game 31: 2 red, 2 blue, 3 green; 2 green, 3 blue, 8 red; 7 red, 16 blue, 2 green; 5 red, 20 blue, 2 green
|
||||
Game 32: 2 red, 1 green, 4 blue; 4 green, 4 red, 1 blue; 4 red, 4 blue; 1 blue, 4 red, 2 green; 4 blue, 3 green, 4 red
|
||||
Game 33: 11 green, 4 blue, 10 red; 2 green, 13 red, 7 blue; 13 red, 2 blue, 8 green; 15 red, 9 blue, 12 green; 14 red, 10 green, 2 blue; 13 red, 7 green
|
||||
Game 34: 11 red, 6 blue, 4 green; 16 red, 7 blue, 4 green; 6 red, 18 green, 6 blue; 3 blue, 16 red, 3 green; 2 red, 3 blue, 17 green; 3 green, 9 red, 6 blue
|
||||
Game 35: 6 green, 10 red, 12 blue; 4 red, 1 blue, 2 green; 3 green, 8 blue, 7 red; 6 red, 12 blue, 2 green
|
||||
Game 36: 4 green, 2 blue, 2 red; 3 green, 10 red, 1 blue; 1 blue, 3 green, 2 red; 2 green, 1 red; 1 blue, 5 red
|
||||
Game 37: 3 blue, 1 red, 2 green; 8 red, 4 green, 10 blue; 4 red, 4 green
|
||||
Game 38: 13 green, 3 red, 2 blue; 1 red, 13 green, 2 blue; 20 green, 3 red, 2 blue; 1 red, 2 blue, 12 green
|
||||
Game 39: 13 blue, 1 red, 8 green; 5 red, 3 green, 8 blue; 6 blue, 4 green; 18 blue, 7 green, 1 red; 4 green, 3 blue, 5 red; 6 blue, 4 red, 1 green
|
||||
Game 40: 2 red, 2 blue, 9 green; 1 blue, 2 red, 12 green; 16 green, 11 blue, 1 red; 1 green, 2 red; 3 blue, 2 red
|
||||
Game 41: 7 blue, 1 red; 4 blue, 1 red; 3 blue, 1 red, 2 green; 13 blue
|
||||
Game 42: 18 red, 1 green, 13 blue; 2 blue, 2 green, 7 red; 16 red, 12 blue; 1 green, 10 blue, 14 red
|
||||
Game 43: 15 red, 6 green, 2 blue; 3 blue, 9 red, 3 green; 13 red
|
||||
Game 44: 2 blue, 5 green, 3 red; 4 red, 4 blue, 19 green; 5 red, 3 blue, 9 green; 19 green, 6 red, 5 blue
|
||||
Game 45: 5 red, 4 green, 13 blue; 12 red, 10 blue; 3 green, 9 blue, 5 red; 10 blue, 18 red, 5 green; 16 red, 6 green, 17 blue
|
||||
Game 46: 3 green; 3 green, 2 blue; 4 blue, 2 red, 3 green; 5 blue, 3 green, 4 red; 1 green, 1 blue
|
||||
Game 47: 2 blue, 1 red, 10 green; 2 red; 6 red, 1 blue; 16 red, 2 blue, 8 green; 5 blue, 8 red, 7 green
|
||||
Game 48: 11 green, 4 red, 2 blue; 2 blue, 5 green, 8 red; 9 green, 6 red; 3 red, 3 green, 1 blue; 2 blue, 12 green, 17 red
|
||||
Game 49: 10 blue, 4 green, 1 red; 10 red, 10 blue; 12 blue, 7 red; 13 blue, 6 green
|
||||
Game 50: 1 red, 19 green, 7 blue; 4 red, 1 green, 5 blue; 16 green, 8 red, 8 blue
|
||||
Game 51: 12 green, 18 blue; 13 green, 14 blue, 4 red; 7 green, 4 red, 14 blue; 8 green, 2 blue, 3 red; 16 blue, 8 green
|
||||
Game 52: 9 blue, 9 green, 3 red; 8 blue, 1 green, 13 red; 2 red, 8 blue, 9 green; 13 red, 4 green; 6 green, 15 red; 11 blue, 11 red, 9 green
|
||||
Game 53: 2 red, 4 green, 3 blue; 5 blue, 16 green; 4 blue, 8 red, 12 green
|
||||
Game 54: 6 red, 16 green; 6 red, 15 green; 8 green, 8 red, 2 blue
|
||||
Game 55: 9 red, 2 green; 4 blue; 2 green, 2 red, 7 blue; 1 red, 16 blue, 1 green; 17 blue, 5 red
|
||||
Game 56: 14 green, 3 red, 9 blue; 14 blue, 15 green, 2 red; 8 red, 13 blue, 15 green; 15 blue, 2 red, 12 green; 3 red, 7 blue, 10 green; 10 blue, 13 green
|
||||
Game 57: 1 blue, 10 green, 2 red; 4 blue, 9 green, 11 red; 2 blue
|
||||
Game 58: 4 red, 2 blue, 5 green; 1 blue, 5 green, 4 red; 3 green, 4 red, 8 blue; 4 blue, 7 green; 5 green, 4 blue; 1 blue, 6 red
|
||||
Game 59: 5 blue, 4 red, 3 green; 8 blue, 12 green, 5 red; 5 red, 8 blue, 15 green
|
||||
Game 60: 6 red, 12 blue, 1 green; 10 blue, 20 green, 4 red; 6 blue, 1 green, 5 red; 9 red, 12 blue, 14 green; 15 green, 1 red, 14 blue; 10 green, 13 blue
|
||||
Game 61: 1 blue, 12 green, 3 red; 4 green, 1 red, 4 blue; 8 red, 4 green, 6 blue
|
||||
Game 62: 6 blue, 7 green, 3 red; 6 blue, 3 red, 3 green; 11 green, 6 red, 2 blue; 2 red, 6 blue, 3 green; 2 green, 3 blue, 3 red; 3 blue, 11 green, 11 red
|
||||
Game 63: 5 green, 6 blue, 4 red; 6 green, 12 blue; 3 green, 9 blue, 10 red; 1 blue, 4 red, 5 green
|
||||
Game 64: 10 green, 14 red; 1 blue, 9 red; 3 green, 10 blue, 14 red; 5 green, 3 blue, 12 red; 5 blue, 12 red, 13 green
|
||||
Game 65: 1 red, 5 green, 10 blue; 14 red, 5 green, 10 blue; 10 blue, 10 red
|
||||
Game 66: 9 green, 8 blue, 1 red; 8 red, 14 blue; 8 red, 7 blue, 2 green; 4 blue, 3 green, 5 red; 2 red, 8 green, 8 blue
|
||||
Game 67: 4 red, 3 green, 3 blue; 4 green, 1 blue, 4 red; 1 blue, 3 red; 10 blue; 16 blue, 6 red, 4 green
|
||||
Game 68: 6 blue, 6 green, 9 red; 4 blue, 9 red, 3 green; 3 blue, 8 red
|
||||
Game 69: 4 green, 12 red, 3 blue; 2 red, 3 blue; 2 blue, 4 red, 2 green; 1 blue, 3 red
|
||||
Game 70: 4 red, 3 green, 15 blue; 1 green, 4 red; 1 red, 1 green, 5 blue
|
||||
Game 71: 4 blue, 2 red, 10 green; 7 red, 6 blue, 11 green; 4 blue, 7 red, 8 green
|
||||
Game 72: 9 red, 9 blue, 1 green; 4 red, 6 green, 5 blue; 3 green, 7 red, 2 blue
|
||||
Game 73: 3 green, 9 red; 4 green, 15 red; 12 red, 2 blue; 14 red, 3 green
|
||||
Game 74: 2 red, 6 blue, 1 green; 3 red, 6 blue; 1 green, 12 blue, 14 red
|
||||
Game 75: 3 green, 18 red; 1 green, 7 red, 1 blue; 2 red, 2 green, 3 blue; 11 red; 2 red, 3 green, 2 blue
|
||||
Game 76: 6 green, 2 red, 5 blue; 13 green, 5 blue; 5 blue, 1 red, 1 green
|
||||
Game 77: 4 blue, 6 green, 3 red; 15 red, 1 green; 4 green, 11 red, 13 blue; 8 blue, 6 green, 9 red; 3 blue, 1 green, 11 red; 3 green, 3 red
|
||||
Game 78: 11 green, 1 blue, 2 red; 7 red, 16 blue, 11 green; 9 blue, 10 red, 6 green; 1 green, 8 blue, 10 red; 8 blue, 6 red, 1 green
|
||||
Game 79: 2 blue, 5 green, 4 red; 1 blue, 1 red, 1 green; 1 blue, 5 red, 10 green; 6 red, 3 green, 3 blue; 8 red, 9 green, 6 blue; 7 blue, 6 green, 13 red
|
||||
Game 80: 10 green, 7 blue, 5 red; 5 red, 1 green, 6 blue; 8 blue, 2 red, 8 green
|
||||
Game 81: 3 green, 10 red; 6 blue, 8 green, 14 red; 4 green, 4 blue, 13 red; 5 blue, 11 green, 6 red; 16 red, 8 green, 5 blue; 6 green, 18 red, 6 blue
|
||||
Game 82: 13 red, 1 green, 7 blue; 8 green, 4 blue, 12 red; 18 red, 5 green, 3 blue; 13 red, 4 green, 9 blue
|
||||
Game 83: 1 red, 3 green, 4 blue; 5 blue, 4 green, 1 red; 3 green, 1 red, 12 blue; 4 green, 11 blue
|
||||
Game 84: 3 blue, 10 green, 2 red; 3 red, 8 blue; 11 blue, 12 red, 14 green; 2 red, 11 green, 2 blue
|
||||
Game 85: 8 blue, 2 green, 1 red; 13 blue, 6 red; 3 blue, 5 green
|
||||
Game 86: 16 red, 8 blue; 7 blue; 16 red, 16 blue, 1 green; 15 blue, 11 red; 2 green, 7 red, 5 blue
|
||||
Game 87: 6 green, 9 blue, 4 red; 1 red, 1 green, 4 blue; 5 blue, 13 green, 3 red; 2 green, 4 red; 16 blue, 10 green, 3 red
|
||||
Game 88: 1 blue, 14 red; 14 red, 3 blue, 8 green; 1 blue, 5 green
|
||||
Game 89: 12 green, 14 blue, 3 red; 2 red, 3 blue, 3 green; 2 blue, 8 green; 1 red, 3 green, 15 blue; 3 red, 5 blue
|
||||
Game 90: 3 blue, 17 red, 11 green; 2 red, 2 blue, 7 green; 7 blue; 8 blue, 4 green, 10 red; 1 blue, 4 red
|
||||
Game 91: 10 red, 9 blue, 8 green; 5 blue, 10 red, 2 green; 11 red, 17 green, 7 blue; 12 blue, 16 red, 18 green; 20 green, 5 blue, 15 red
|
||||
Game 92: 1 green, 14 red, 1 blue; 2 blue, 6 green; 9 red, 6 green; 5 blue, 5 red, 2 green; 3 blue, 3 green, 10 red; 5 blue, 1 red
|
||||
Game 93: 10 green, 1 red, 6 blue; 16 red, 5 blue, 2 green; 3 red, 7 green, 11 blue; 12 green, 5 blue, 4 red; 8 green, 7 blue, 10 red; 1 red, 5 blue
|
||||
Game 94: 3 blue, 1 red, 3 green; 1 blue, 4 green, 4 red; 9 green
|
||||
Game 95: 3 green, 5 blue, 9 red; 2 green, 9 red, 2 blue; 12 red, 9 green; 11 green, 9 red, 9 blue; 9 blue, 6 green, 10 red; 13 red, 2 blue, 5 green
|
||||
Game 96: 2 red, 19 blue, 2 green; 10 blue, 1 red, 2 green; 9 blue, 1 red; 2 green, 3 blue; 1 green, 1 red, 11 blue
|
||||
Game 97: 6 green, 7 blue, 5 red; 7 green, 1 red, 11 blue; 6 green, 6 red, 5 blue; 2 red, 9 blue, 1 green
|
||||
Game 98: 5 green, 8 red, 15 blue; 16 green, 9 blue, 8 red; 5 blue, 3 red, 2 green; 13 blue, 12 green, 4 red; 2 red, 15 green, 3 blue; 1 green, 11 blue, 2 red
|
||||
Game 99: 1 green, 7 blue, 6 red; 16 blue, 9 red; 1 green, 17 red, 12 blue; 15 red, 7 blue; 8 blue, 14 red
|
||||
Game 100: 5 blue, 11 red, 6 green; 11 red, 2 blue, 5 green; 6 blue, 6 green; 2 blue, 6 red, 15 green; 7 red, 4 blue, 7 green
|
||||
@@ -0,0 +1,140 @@
|
||||
...................305.124................................432..............................................576..313.....514.................
|
||||
.............113...-......&....................&...819...........654..../..........................&901................*....869.257.........
|
||||
...377..&783../.................................9...........855*......940..463................-.........................844.*....@......679.
|
||||
......*...........197.261.....817..336.759............&742......548.......&........748......844.............#.......&........254...169..*...
|
||||
.......36....368.*...............*....*.........*..88......%866.......135.........*..................515.682.....114...%...........*.....768
|
||||
...233......*....909..698.........427..........127.*...................*...........450.........482..../.................312.....621.........
|
||||
.../.......882...............776...................555......180.........971....217.......857.../........212....674.917......736.....441*760.
|
||||
............................*.....@....907....%940.....%.......+.#..........45*...........$............#..........*...............=.........
|
||||
..................370.225.425..211...................932..........381..267.............45.....=....549....238........367..&.....488.........
|
||||
.468.............*.......................761...677.......&.................929..907.....%....79...*.......*....324..*....515................
|
||||
....-.#103.504...388...........$..........*.....@........766.%................*....*623.........532..881...573....*..840..............497...
|
||||
...........*.........305....412..687.......971................676....@640....657........709......................807............98.....+....
|
||||
....279...502...62...*.............*..............................................838%.....$.........585..........................*.........
|
||||
....=...=......*....209.825.482.993..........972............620*664..-759............................*.......184.........952....160.....156.
|
||||
.......814.....931......*...*............551..*....711...65.................224*115...851.772..104..505.....=........796*...................
|
||||
....................723.103..275........*......564..*.........830........................*...../..............................232...........
|
||||
.............$......&....................951........703......=............160+.....138......*........257*809.............$298........284....
|
||||
.....684....464.333..................827.....*211..................................#.....855.86.....................$913............*.......
|
||||
.......*...........*..*......917.163....*.409......294.......................#..39.......................511....358.......$671.......237....
|
||||
.......663.......311..163....*...%...158........*....-.442.........958....108.....#.....941*837.........*..........*........................
|
||||
............865=..........409....................128...*.......283....................................680.........730.935@........768.......
|
||||
....../................=.............54.....857.........418.....*..911.......610..643............381...............................@........
|
||||
.......925............984...........-...800*.................194.../.........*.......*.........../.....................................@....
|
||||
.................................@...............................&......615...16....695.....-..........................*750.............855.
|
||||
....611..136...................108.540.........362..711......*....420.....................190.......................213.............86......
|
||||
204*....@.........288..825..+........&...........*....*......733.........................................7..387.......................*.....
|
||||
...........795..../.......+.505.834.....228....192...619..........886......467.....942.............................%838.........512...340...
|
||||
.......957.........................*...*..................962........................*..............211...$..............624................
|
||||
.......*....................349....144......./786..350.......*.......................541..21.......$.....284..190*......*............518....
|
||||
....484...@....17..........*..../........309..........*....530...118..........208..............253................489.828...........*.......
|
||||
..........309...........715.....531........+.516#...645.........$........369....*.......*185...@............=.#...........@............&....
|
||||
491*192..............................................................233.........711.948.........572.....869..289......932...........149....
|
||||
........274.....511.....425..........421.288*965...652=.919........./....*.786...........676.....*..................+.........=.............
|
||||
.........*.........@......$...*.........................*........*....791...+..113......*....527..897..499+.904...166........580.........389
|
||||
.......306.....................353.497..929/.......=....553......495.................884.....&........................794........774........
|
||||
...................../...........................582....................................................489..........*...............&......
|
||||
.605......537.....247.....................479................74................227*995.761.....@...........+.......958...87.....547.795.....
|
||||
...*.....*....................289+.....*.....%........967..............*...............*........611.....28....367.................*.........
|
||||
..690....916.497....................894.440......547$.............596.492......23...............................*...............237.221..786
|
||||
.........................681.....=..........580+.................+...............+.......696............@..542..56..........................
|
||||
...936..639*947.............+...48.*709..................307.257...-248.697.553.............+.........146.....#.......*241..................
|
||||
...*................568....................=378....41.......*............*...%..11......*..........................982.............#........
|
||||
..323..704.+724..*....*..195*....812..879...........*.....*....508@.....852....$.....664.......317....*......332..............326.158.......
|
||||
.......*........610..767.....936...#...&..744.290..839.382.543....................................&.827...../.............323*.........884..
|
||||
...........962...............................*...................46....502.265.150...................................639...............*....
|
||||
955*818.......*...@...124*512..256...................+....&..............*....*.......170....996...#........................786.......4.....
|
||||
..............284.697...........*......172...........398.435.......-.....380..........+..........698....428...361................206........
|
||||
.822...#..............936$...745..........*..%59..................726...........+.........249......../...*.....*..................%.........
|
||||
.....870................................978.......761=.......179.............692.........*..........477..550.....676..281.............507...
|
||||
..............913.................215.........................*..745...#.............882..130..569....................&..........*472..*....
|
||||
...27..710.....*.....................*.205*403..............59....+..172................=.............................................697...
|
||||
....*....*....731.......865.......155..........849*....#..............................................679...854....................&........
|
||||
.985..%.............599....#..........191..520.......473..#........./...........708....406..677+...=............................599.....133.
|
||||
......501...........*........@.........*...*..............446....767...*444........@......&.........49......#...311*413.....................
|
||||
..................157.......830..13.90.398.945.978............................950.................%.......88................$...............
|
||||
.............297........618.......+.*............%............317.............../.........709..481............503.........570...305*845.....
|
||||
......661....*....632.....@..+......524......../.....+...........*...590..............944....*...............*................+..........681
|
||||
.......*.....820...@..........829...........671.......206.......239.+......................339..#............106......415..213..........-...
|
||||
........114........................903.669=............................764...319....373........642...................................-......
|
||||
.................*...........................*.......121.......898&.....$......*...*.....................................211#.......579.....
|
||||
........*.......362......787.440..........842.825.....*......................590...357..........949......523....470..292....................
|
||||
.....594.459........98.....*....*.......................355&..*..................*..........554..*.......*.......*....*..222...243..........
|
||||
.........................535.....674.........804....#..........455.............847............=.32...23..951.....217.346....+.*....+272.....
|
||||
..183...........443..........119.......833....#..693......818#........................@..699..............................*....678..........
|
||||
...*......455/...%..826.............#.....*.........................$...........868.739....=..753...181....773.........323.508..............
|
||||
...382................*...169..510..590.295....212.767....*970......711.........*........#.......*..*............651...........36..766*.....
|
||||
............&..61..697.....*................46.*....*..691......970............786....953.....775...235..................*550....*.....417..
|
||||
..........45.....*........689...645.....549*...821.601.............*......................952..............#..........464.....609...........
|
||||
.....657.........48...888.......*...................................305......+47..........................254.27......................123...
|
||||
818......388............*....412....../491.........#336...506..422.................989....15...70..............*..354............@.....*....
|
||||
..............506........11......./...........643..........#..=..........703...963*........@.........613.....413....%...485.......265...33..
|
||||
....589.......*................207..............%...............................................+................*......*.....94............
|
||||
...*.........663...413+....................................819...........655.%...648..823.......770....385......457..150...#.../............
|
||||
515.......................475....825......33../350.....459...%..........*....681...*...*..............%..................437.......689......
|
||||
....$993..897@..............*.......*837...-...........*..............726........372....922......&198................................*......
|
||||
180............*..........679.................71.629=.796......109...........................527..................682.....558.....798.......
|
||||
........437.742.46.................@.......&...................*......498.......@.............*............./......$........*...............
|
||||
..761..$...........148.......856....701.377..536*510...604...540.....&........929........172.799.............310.....700...........440.%....
|
||||
.....*........808*....=.........@......................*.........577.....................*................&...........$...417.39.....&.229..
|
||||
........794.......446..............................214.543...%...*..........935......865..445...../....%.615................=..*............
|
||||
..572..+...............................419....932@.........924..72.902.......-..579.-...........997.203................873......945..567....
|
||||
.....*.................273.............*...........................*...142............688................755.850...........846.........=....
|
||||
...880................*..............883.698.....$.......=........197.*...........316*.........365.........$...*............*............904
|
||||
.........385..977..179....+...................652......875.............350...863............73......464.........214.852..478................
|
||||
......22....*..@.........93............*682..................*137..309.........*....557.....*........................=.......698.....+.218..
|
||||
......*...645......163...............89......*853..................*...386..341.......*...228............718*492...............*..153..*....
|
||||
.....576......................857.........513....................509......*.....322.710.........615.......................613.165.......292.
|
||||
................................@.....370.......598......487...........503..*.....................*...738#..#..$901...$.....#.......648.....
|
||||
..19*454.............78................/..876..#..........*......+..........937.......383........523........69......326.678.....212....*....
|
||||
.....................*.....436.@...646...*..........100....367..325.....361.......207*....50............621...............*..........237....
|
||||
757.........714......502...%...54......909.411.....*.....................*..........................=..$................415.................
|
||||
...$.......&.................................*...471..985...508.472....891.842..$.................418.........&.....&.......................
|
||||
.................$........906..........*215.338...............*..............*..606.#235......................813..259........229...........
|
||||
........472...222.........*.....245.572.......................927...769....344.............291.239.....................94....*..............
|
||||
...818...$.............291..............288...........163.734......+...........699............*.......981&...514*.............224.....=.....
|
||||
.....*..................................*.........................................+..189..........452............644...................669..
|
||||
....850................326$..............869..&985......784..../..............592.......*..153.....*....887..493.....211........%...........
|
||||
.............................457....834.....................94..564..........&.........498....*...304....../...*.....*..........845.....&...
|
||||
.......12*48.753...244..196....=......$..721....90*29.........*.................+.522.......487...............317.....531..311........20....
|
||||
.177...............*.....*.................*.............*969.611.......*565..338...*.............712..922$.......770......*....522.........
|
||||
....*..459......149......165...=........879...........103............497..........258.931..75....*..........400*.....*......972.............
|
||||
.269...*............#........715.............................*475..........................*....145.............414.....228........893......
|
||||
........209......508...................../331......469....894............347.890$..541.....56...............#........#..*...................
|
||||
......................=...........37................*...........................................$...........197...119.....=...........756...
|
||||
...........&.......850.....367.34...*............517........178*716..........=...................892......-............883...755............
|
||||
.....@496.125.................*......965.....428.....908..................405.....650...................=..493..89..........................
|
||||
..............581........396.............596.........*....964........672......159.%....463............768......./.............391...........
|
||||
.............*...........*.....871.660..*......577.73......@.....932....#....*............*574...186........154......996........*......720..
|
||||
............914..132..137......=.......746......*..................*......376.......&661............*560.%.......%....*...264....511........
|
||||
...%...151................*851...................................*..284.........754..........190.19.......611...326.841...............89....
|
||||
644.....*...797........133.....476..............................810.............*.....866......+.*..............................#903..*.....
|
||||
........839..*..478...........*........372.#.....744.....227*............477.3.253.%....&..746.....289.&860.....720*708.....................
|
||||
............443...%.....68*....283.......%..900...%....%..........584......*.$......308....*......*......................592................
|
||||
...239................@....250........50........&...%...192.$111.*........74............831....914...#.....886*492..........=...............
|
||||
...*......425.....181..680..............*......873.502............93.................................503.@..............116........372......
|
||||
492..........*.....$.............302...789.................861.......................290.......452........83....626....*.....76.......*.....
|
||||
......178...528..........*739...@..........................*......804....320....#.........&878.*.....746........./..&...148...$......741....
|
||||
...&....*.............262..............325...........599..592.579.....%...+..808...............386..*...............761.....................
|
||||
663..462...........*..........109..706*.................=.............553........712......*971......674.396...635*..........................
|
||||
........../...728.952...413......*......744.......%..........................300..*....782................*.......742..&424........41+...564
|
||||
........375...%.........*......450.456.$.........714........851.327..#...+......*...+.......179.630....854..................................
|
||||
..251................195...887.....*........*209.......430.*......-.83.596....956..966.274.%.....*........................83.359........411.
|
||||
....%.......................*..........89.........194..+...491.........................&.....*.762..+741..........598.......*.....910..*....
|
||||
..........618+..............677........*..598........+..........-.....58....290...........795...........................*.....580.&....559..
|
||||
...................561..............910......-..321....834....602.752*....=..+........191..............463....@..........792..*.............
|
||||
............216.......%...722*668.....................$..................109............*....222...195*.......689....380.......637..........
|
||||
.....846.......*..436..............=827...263@.764*.......*.464.................729.....934...*......................................289+...
|
||||
.127*.......757.....&......./954...................965..664........./......716*.+...........266....781.........989..........844...$.........
|
||||
................57.....................&118......=...........385.623...245..............345........*.....615-.....*..........*...768........
|
||||
...538...........#..860......................783.460..........*............401.............*796..354..............37......797........725.193
|
||||
....*..#620../.........*..........578..54...*..........780..251...634..946....*........................./....702........................*...
|
||||
..202.......815........724....#..............822..972...................$..........*.....#....@........27.....*...........268.....347.......
|
||||
.................+..........98.....703..............&....*52.....320.............670...318....734.............47..................+....239..
|
||||
.953*919...=......273................=...454.....@....601...........*...958.........................+.................758...=...............
|
||||
..........905./50.........@...................971..................762.*..................169........915.682..........=......533.......502..
|
||||
.....884.................24...........262.........@.....531..698.......234.................................................%.......149..*...
|
||||
....................834.....994.......*........266.....*......*............................................/.....941.434...812.......*..211.
|
||||
.............133......*......*.....613...85..........871.......497..346...737....88.....176.....192$........128.*.......&......./163.26.....
|
||||
....734..543....*.....656....461........*......531..................*........../...*..&................$971.....931.........................
|
||||
................606....................506............................779.......30...211.....243..........................153...504.........
|
||||
@@ -0,0 +1,198 @@
|
||||
Card 1: 81 1 43 40 49 51 38 65 36 4 | 21 15 1 43 60 9 83 81 35 49 40 38 82 65 20 4 58 94 16 89 84 10 77 48 76
|
||||
Card 2: 15 89 71 17 91 78 35 55 68 49 | 80 31 89 91 23 55 36 68 22 61 66 24 42 49 33 21 19 73 29 60 15 34 71 10 87
|
||||
Card 3: 4 45 78 42 29 92 16 90 93 30 | 97 90 75 40 43 65 92 83 41 4 47 35 29 80 68 87 30 71 98 42 95 7 76 69 88
|
||||
Card 4: 81 2 80 85 14 28 88 84 74 78 | 54 38 30 40 85 93 71 10 67 2 81 57 74 9 14 5 97 28 79 95 84 65 69 23 21
|
||||
Card 5: 40 27 72 38 99 28 74 31 45 41 | 64 61 77 92 96 34 29 44 91 40 73 20 38 39 85 27 56 52 86 41 87 24 13 62 30
|
||||
Card 6: 58 67 17 96 73 9 5 71 23 87 | 67 72 79 7 54 47 94 84 98 17 5 99 82 27 21 96 23 22 87 66 36 26 76 19 58
|
||||
Card 7: 89 70 36 38 86 50 94 62 56 3 | 7 8 56 14 58 65 63 36 54 59 78 79 11 2 69 55 61 39 19 60 4 99 90 17 95
|
||||
Card 8: 29 54 26 8 44 43 41 15 63 22 | 76 91 70 54 1 33 11 88 26 69 64 44 16 20 46 25 38 49 15 10 29 32 87 8 67
|
||||
Card 9: 41 26 83 86 96 27 57 6 92 10 | 14 1 39 15 12 21 13 25 43 87 78 67 58 51 49 97 30 76 59 65 93 60 44 77 90
|
||||
Card 10: 38 40 81 54 30 61 82 51 99 71 | 43 74 45 70 18 31 66 96 21 92 61 91 55 67 41 15 77 88 11 7 8 93 30 35 82
|
||||
Card 11: 69 47 52 27 78 17 39 88 83 71 | 70 87 71 33 25 43 82 49 30 58 67 89 95 74 93 28 99 85 78 73 10 75 9 91 15
|
||||
Card 12: 54 46 50 79 57 88 90 61 12 5 | 64 33 13 35 57 29 81 89 49 47 37 25 66 68 20 73 19 36 39 79 5 96 3 95 42
|
||||
Card 13: 67 56 62 13 55 38 89 10 91 75 | 23 58 95 92 17 52 84 64 77 54 20 98 89 83 4 66 87 25 27 51 2 37 81 56 12
|
||||
Card 14: 54 42 51 76 66 14 74 6 35 89 | 50 47 63 16 91 41 43 39 2 95 84 8 18 23 83 64 97 48 96 69 29 44 1 24 72
|
||||
Card 15: 83 1 88 31 58 35 21 62 36 33 | 68 30 85 28 71 49 2 86 12 13 7 42 20 93 66 17 4 67 19 65 43 6 16 75 22
|
||||
Card 16: 3 6 41 38 71 53 86 12 49 84 | 84 12 6 44 31 85 71 50 41 35 27 38 96 42 21 9 13 86 49 91 36 40 53 3 93
|
||||
Card 17: 1 14 50 61 19 68 48 40 63 69 | 19 11 69 63 25 50 86 80 26 29 42 48 52 21 56 14 6 41 68 40 1 61 36 16 3
|
||||
Card 18: 27 3 77 91 69 84 14 32 50 5 | 6 5 64 91 3 10 4 1 84 76 77 70 27 59 78 24 32 92 69 50 52 54 82 14 95
|
||||
Card 19: 93 65 3 23 46 82 49 95 30 91 | 35 89 49 82 32 18 71 46 81 93 95 23 27 45 96 65 94 24 70 3 30 19 85 56 91
|
||||
Card 20: 73 98 10 19 2 39 42 81 93 41 | 87 42 93 34 95 82 73 83 89 31 70 98 20 12 41 61 10 65 81 71 19 39 35 2 5
|
||||
Card 21: 3 97 15 68 19 48 46 47 42 91 | 68 15 13 12 20 79 19 94 99 5 97 4 16 91 36 76 47 45 48 53 3 46 64 42 67
|
||||
Card 22: 66 57 76 36 69 48 60 71 87 75 | 31 73 75 28 63 87 40 71 59 5 36 19 8 60 38 94 48 37 13 18 52 69 57 76 66
|
||||
Card 23: 11 15 29 35 99 68 65 86 88 50 | 36 8 16 20 85 61 17 44 38 55 52 27 35 94 99 37 74 33 90 65 30 28 83 11 14
|
||||
Card 24: 94 26 38 83 63 18 25 20 95 87 | 28 1 42 2 95 38 65 77 66 12 97 94 34 55 75 74 89 18 80 27 63 20 87 37 7
|
||||
Card 25: 35 79 48 37 65 59 17 70 9 78 | 2 78 80 70 13 9 48 97 12 65 29 37 81 35 79 38 4 22 59 68 17 72 11 83 23
|
||||
Card 26: 7 68 37 9 41 13 82 71 17 69 | 36 85 15 28 96 61 87 14 74 67 27 48 1 26 79 94 66 35 90 22 62 57 20 97 76
|
||||
Card 27: 85 65 73 76 50 52 58 28 49 96 | 25 28 89 80 9 33 18 58 5 34 68 41 13 4 65 64 75 47 55 6 43 66 69 62 24
|
||||
Card 28: 59 85 80 77 38 74 92 64 68 21 | 79 6 32 43 76 86 31 51 44 47 94 92 23 34 87 29 42 69 96 55 63 5 22 80 71
|
||||
Card 29: 39 73 96 21 22 45 72 9 16 31 | 52 91 73 53 97 24 65 51 59 89 69 70 21 16 12 63 30 9 86 55 40 22 45 90 33
|
||||
Card 30: 70 41 73 86 81 18 37 84 49 93 | 29 45 92 86 72 49 14 78 87 81 18 52 27 73 48 42 37 63 38 36 83 21 39 97 66
|
||||
Card 31: 47 38 27 20 53 19 65 36 32 76 | 72 32 46 37 67 92 63 1 36 96 22 14 84 35 48 55 18 81 79 49 66 7 88 3 70
|
||||
Card 32: 79 86 28 46 55 13 58 31 40 52 | 62 81 46 87 76 47 38 74 5 12 92 68 75 52 37 60 13 36 34 30 11 28 86 9 55
|
||||
Card 33: 73 51 26 98 78 41 27 63 70 77 | 49 27 32 41 48 86 47 70 7 63 65 10 13 94 69 66 90 22 96 46 82 77 79 67 51
|
||||
Card 34: 59 12 56 96 69 89 47 71 15 14 | 71 19 6 60 63 15 32 17 77 34 10 92 80 9 12 93 66 29 76 45 47 64 28 86 4
|
||||
Card 35: 97 68 94 87 35 74 86 71 63 19 | 86 6 94 1 81 65 36 13 78 8 32 49 25 16 99 18 59 76 60 14 51 11 66 56 58
|
||||
Card 36: 4 60 58 47 12 77 94 89 1 82 | 8 5 2 45 10 89 64 30 95 60 20 61 66 74 7 31 4 83 62 36 25 40 33 87 93
|
||||
Card 37: 18 9 92 54 47 19 81 89 51 7 | 73 13 72 18 37 71 76 59 91 99 65 92 80 38 26 83 6 58 46 43 84 60 27 1 12
|
||||
Card 38: 96 40 86 17 43 19 53 47 83 82 | 52 61 91 73 50 87 92 21 14 43 6 74 29 72 2 65 16 54 36 33 4 81 88 23 59
|
||||
Card 39: 65 9 73 98 89 68 57 40 4 44 | 28 83 13 20 3 9 77 19 82 48 90 85 45 51 96 43 52 7 29 92 21 88 66 87 2
|
||||
Card 40: 36 50 72 14 31 51 1 43 85 96 | 74 5 86 60 3 62 91 49 89 47 83 70 58 68 45 18 73 63 87 56 37 76 7 44 46
|
||||
Card 41: 71 72 28 29 92 64 8 30 12 59 | 83 68 7 28 12 3 9 5 87 72 82 19 66 30 71 77 1 65 59 96 92 29 8 64 45
|
||||
Card 42: 31 78 10 67 97 29 61 71 52 80 | 20 55 32 46 67 54 71 58 22 9 85 53 15 43 37 11 10 95 23 80 14 68 57 26 29
|
||||
Card 43: 5 24 93 52 33 75 72 23 12 35 | 63 39 99 45 60 15 33 61 2 67 46 79 65 56 68 20 80 51 74 85 73 23 52 14 5
|
||||
Card 44: 21 94 5 30 86 38 31 13 3 18 | 4 66 34 94 31 75 99 38 1 53 89 11 13 86 30 98 87 5 49 3 58 18 56 21 97
|
||||
Card 45: 37 78 71 90 77 58 56 55 31 34 | 5 61 83 88 90 39 30 32 58 37 71 57 79 1 78 13 22 81 34 69 77 18 41 98 8
|
||||
Card 46: 23 14 99 65 27 68 35 13 64 24 | 14 35 99 76 24 60 47 28 31 40 43 75 68 95 92 17 96 50 97 23 45 64 65 27 13
|
||||
Card 47: 40 19 7 69 68 78 63 76 21 74 | 79 87 45 42 60 77 40 26 99 55 81 5 50 20 32 57 82 90 98 83 33 75 97 31 73
|
||||
Card 48: 38 52 34 25 1 61 71 82 27 58 | 34 12 4 23 27 92 1 25 58 84 90 94 38 82 18 9 66 52 26 81 40 71 69 28 61
|
||||
Card 49: 96 89 21 24 10 33 69 25 79 12 | 84 54 41 56 59 79 76 74 1 28 85 95 82 40 64 45 15 30 87 91 71 22 58 33 63
|
||||
Card 50: 24 14 10 96 94 45 48 77 5 73 | 10 24 84 94 70 26 83 78 75 96 48 47 63 14 68 90 60 27 28 79 69 55 45 15 73
|
||||
Card 51: 81 19 42 56 58 88 6 80 75 25 | 36 15 32 61 3 92 8 9 89 96 87 73 1 60 74 98 70 55 37 62 86 48 76 94 47
|
||||
Card 52: 3 57 14 52 69 13 2 82 35 36 | 23 58 33 46 69 41 7 82 30 47 67 57 19 49 50 14 72 13 38 42 94 2 36 45 8
|
||||
Card 53: 70 24 88 94 11 91 8 61 29 2 | 77 11 49 96 82 21 16 35 45 1 85 72 98 33 91 29 47 17 97 31 3 94 63 19 90
|
||||
Card 54: 12 67 94 18 8 86 84 38 77 98 | 79 64 51 84 18 73 57 99 67 36 71 61 30 77 69 5 86 60 65 94 38 46 25 98 34
|
||||
Card 55: 7 58 8 59 13 67 54 34 81 46 | 52 1 26 51 71 94 98 18 20 2 19 29 72 12 83 14 57 11 96 32 43 88 85 93 6
|
||||
Card 56: 74 86 42 76 12 26 49 73 62 19 | 47 60 89 3 12 98 23 65 63 53 61 40 22 70 93 2 76 15 26 95 85 77 30 71 1
|
||||
Card 57: 50 14 66 88 89 21 57 47 98 32 | 22 53 34 87 91 84 54 69 42 79 19 39 74 65 89 38 71 52 98 24 56 67 73 51 64
|
||||
Card 58: 94 12 81 42 84 85 37 30 93 4 | 15 43 71 48 79 95 94 5 23 30 29 54 44 34 77 75 93 1 53 62 96 25 12 70 87
|
||||
Card 59: 37 60 52 85 77 10 44 84 50 57 | 73 78 72 97 70 59 31 7 65 79 28 86 91 95 14 20 77 41 9 67 98 38 32 63 80
|
||||
Card 60: 2 96 46 30 37 67 35 65 97 14 | 89 83 87 35 12 63 76 9 3 25 19 71 10 33 38 48 29 67 50 56 26 23 24 93 6
|
||||
Card 61: 36 88 25 8 78 58 18 77 11 68 | 30 64 98 56 73 16 87 66 54 81 27 38 43 83 72 15 21 95 71 8 42 97 65 37 84
|
||||
Card 62: 50 29 64 42 71 95 78 48 3 40 | 46 15 33 17 73 10 7 24 91 94 34 69 99 36 49 58 43 6 8 83 53 70 60 44 47
|
||||
Card 63: 16 95 72 65 91 86 81 31 28 60 | 14 3 53 47 48 29 64 19 22 82 66 5 69 37 92 42 18 43 49 73 44 27 99 11 35
|
||||
Card 64: 33 34 10 41 50 73 69 28 82 49 | 11 9 34 78 73 70 5 75 30 13 36 33 19 69 47 41 28 82 49 10 48 72 50 21 2
|
||||
Card 65: 31 78 16 5 43 79 41 58 65 23 | 94 5 6 81 28 82 67 1 65 23 91 25 78 53 58 79 43 41 12 47 55 33 31 83 98
|
||||
Card 66: 76 16 15 14 72 79 57 8 26 68 | 86 42 51 71 36 73 22 55 63 3 17 41 66 93 8 26 60 68 49 70 76 15 67 40 16
|
||||
Card 67: 12 43 36 8 27 29 82 11 52 2 | 44 93 26 55 89 83 84 99 62 98 17 53 76 37 23 80 58 69 31 34 15 86 64 41 60
|
||||
Card 68: 52 91 60 74 57 31 2 94 16 98 | 31 80 78 66 45 91 94 60 87 43 71 22 9 20 96 16 48 18 40 99 74 90 14 58 98
|
||||
Card 69: 58 42 63 21 36 46 93 75 38 17 | 69 67 66 93 64 30 4 14 77 78 36 90 18 6 53 97 8 20 59 31 92 96 54 37 49
|
||||
Card 70: 81 58 36 22 84 76 18 63 94 5 | 62 29 84 48 69 18 11 82 32 15 63 72 1 52 88 16 66 7 74 70 10 46 45 54 83
|
||||
Card 71: 9 92 75 47 72 95 62 28 22 60 | 72 54 75 44 9 79 56 47 76 46 27 31 62 80 68 48 12 87 8 89 39 95 51 60 92
|
||||
Card 72: 17 18 97 98 5 77 1 27 21 92 | 29 91 96 87 7 4 27 33 20 39 61 50 65 88 71 77 49 92 11 5 94 76 31 43 30
|
||||
Card 73: 89 59 60 62 74 28 15 31 13 38 | 99 26 16 52 28 98 68 53 23 64 27 74 80 11 18 22 62 54 95 24 32 97 43 94 87
|
||||
Card 74: 98 54 9 31 89 83 51 34 48 88 | 42 89 83 39 50 97 47 80 54 75 14 73 53 77 81 33 95 16 52 12 71 24 23 32 21
|
||||
Card 75: 24 64 34 75 55 60 68 26 45 22 | 65 20 69 44 83 42 17 95 97 28 82 30 3 6 34 35 58 86 75 76 5 80 91 90 40
|
||||
Card 76: 86 70 51 79 29 53 98 26 89 59 | 3 20 28 25 13 5 57 87 26 15 99 60 68 76 41 69 80 77 23 45 2 82 79 49 6
|
||||
Card 77: 57 84 40 61 41 9 90 37 38 94 | 12 20 95 50 98 87 8 17 46 25 48 9 7 78 43 70 2 56 84 99 28 3 54 45 42
|
||||
Card 78: 94 2 91 42 35 36 68 8 61 37 | 20 75 39 93 69 85 2 46 21 13 83 81 79 97 70 51 86 64 60 5 32 44 57 52 28
|
||||
Card 79: 51 27 71 56 6 7 1 3 74 75 | 83 97 79 78 53 90 37 89 4 96 62 31 76 10 92 46 24 47 20 11 32 82 80 64 88
|
||||
Card 80: 29 27 74 37 7 83 4 13 47 45 | 88 27 86 13 1 96 37 10 29 4 35 32 6 84 7 91 58 52 83 98 74 79 85 45 47
|
||||
Card 81: 89 40 36 96 57 82 45 92 3 60 | 5 96 40 30 21 45 6 90 77 60 59 75 57 47 3 36 82 92 84 38 89 15 72 39 32
|
||||
Card 82: 70 5 31 62 23 22 46 2 74 4 | 46 2 15 98 62 44 4 22 80 70 23 3 74 60 38 31 94 88 65 79 5 34 14 33 77
|
||||
Card 83: 99 84 10 98 92 62 70 35 71 21 | 21 92 31 8 32 4 20 35 10 26 79 83 30 2 70 41 84 65 17 62 99 12 23 98 71
|
||||
Card 84: 55 72 7 73 77 37 31 79 36 69 | 7 45 77 12 80 2 47 41 3 37 86 67 48 79 55 46 40 58 96 50 8 31 57 72 69
|
||||
Card 85: 51 64 50 28 40 36 30 32 14 15 | 98 62 75 15 70 36 66 48 43 60 40 28 30 14 17 50 51 4 93 23 33 56 32 64 11
|
||||
Card 86: 71 25 93 44 49 36 8 81 27 21 | 99 81 49 67 39 8 27 21 93 86 57 34 54 30 60 15 84 25 56 89 51 75 66 91 69
|
||||
Card 87: 47 21 67 31 70 33 43 48 55 71 | 21 13 86 52 93 81 60 73 70 74 48 41 43 3 67 46 64 4 22 33 80 44 51 47 91
|
||||
Card 88: 55 12 46 23 49 59 76 70 66 34 | 2 20 82 23 59 64 96 46 53 50 9 98 19 70 27 12 78 34 21 66 87 79 55 76 81
|
||||
Card 89: 33 68 78 59 34 50 69 32 38 77 | 16 90 68 4 79 67 94 12 40 10 51 6 24 36 30 60 76 19 33 87 21 38 5 96 31
|
||||
Card 90: 90 10 58 11 36 84 66 15 32 55 | 47 61 90 37 60 23 84 7 11 96 57 35 5 65 55 48 15 32 71 67 89 79 73 36 58
|
||||
Card 91: 50 90 96 33 20 71 28 37 79 26 | 7 1 61 31 34 24 99 36 30 63 6 32 2 15 92 9 69 3 84 22 14 49 12 67 65
|
||||
Card 92: 42 56 74 93 18 62 64 85 76 37 | 44 70 99 40 14 59 22 92 35 7 58 66 96 30 80 18 83 95 49 27 1 32 88 93 48
|
||||
Card 93: 20 31 24 33 44 69 63 88 58 96 | 27 60 17 22 73 96 35 52 66 13 37 93 21 75 32 83 4 24 85 5 46 42 29 58 16
|
||||
Card 94: 9 68 8 2 12 96 55 51 17 71 | 93 68 35 2 80 23 76 69 47 40 13 3 70 22 49 31 34 73 87 28 32 12 51 77 48
|
||||
Card 95: 89 97 54 86 26 76 36 32 31 50 | 86 70 61 64 79 56 23 83 62 11 77 36 92 96 38 87 47 55 98 68 37 28 76 82 51
|
||||
Card 96: 60 18 86 17 38 47 30 61 14 46 | 7 11 66 20 46 61 29 73 98 69 83 89 70 39 51 18 88 75 72 38 74 92 49 14 22
|
||||
Card 97: 89 43 39 76 94 1 10 75 14 37 | 96 49 56 87 37 50 97 68 27 71 51 24 45 2 42 17 91 8 90 26 7 18 84 21 64
|
||||
Card 98: 5 91 85 67 27 32 66 97 40 76 | 43 20 50 92 59 86 52 17 14 75 18 21 44 80 35 61 91 64 36 45 73 34 7 98 60
|
||||
Card 99: 25 45 1 82 43 93 30 73 26 38 | 74 34 41 76 94 60 14 73 16 55 86 49 2 44 62 96 42 17 10 63 35 95 81 26 18
|
||||
Card 100: 76 54 83 34 35 77 80 66 58 32 | 29 21 82 19 16 92 12 87 68 35 39 69 42 23 52 88 45 57 41 56 38 71 3 98 47
|
||||
Card 101: 36 66 81 51 70 28 63 85 57 32 | 77 59 13 48 17 27 96 3 39 89 1 10 62 18 80 65 33 95 73 97 94 34 86 92 24
|
||||
Card 102: 47 63 44 41 16 10 26 80 24 54 | 92 7 10 39 96 55 52 70 30 33 79 43 36 16 64 50 48 91 62 40 84 77 86 57 69
|
||||
Card 103: 70 79 59 80 98 14 21 77 65 9 | 20 91 8 97 2 41 11 65 30 90 45 82 3 43 39 71 13 36 87 95 57 10 1 23 27
|
||||
Card 104: 99 43 69 80 42 68 95 30 46 91 | 9 87 62 10 48 17 28 45 23 18 1 44 37 50 88 33 21 40 70 92 12 19 72 7 24
|
||||
Card 105: 30 98 37 46 69 28 20 87 5 96 | 92 71 2 63 15 49 51 26 82 62 75 38 79 53 3 32 55 41 81 90 44 61 22 31 28
|
||||
Card 106: 54 92 73 46 32 53 23 20 99 63 | 95 28 19 55 84 67 2 49 38 78 1 39 62 61 10 54 96 58 5 64 21 93 37 13 97
|
||||
Card 107: 40 77 62 63 41 86 85 43 25 33 | 50 43 70 30 40 69 85 96 98 18 68 64 16 41 62 57 33 25 93 17 63 77 86 66 94
|
||||
Card 108: 79 15 35 96 83 26 86 34 54 48 | 40 78 54 34 35 38 10 79 47 48 24 66 15 88 13 81 83 96 86 29 36 99 26 31 68
|
||||
Card 109: 5 69 8 35 87 89 70 94 77 90 | 90 99 97 54 22 82 24 30 48 34 89 9 39 87 8 14 88 51 68 66 40 84 35 5 93
|
||||
Card 110: 89 69 47 86 67 49 50 34 83 35 | 35 92 61 1 24 44 7 76 98 49 63 83 84 95 80 96 30 43 4 94 99 90 34 87 50
|
||||
Card 111: 46 48 20 27 68 54 57 81 12 43 | 35 27 91 22 20 7 97 81 30 76 41 60 62 28 72 96 10 89 32 16 79 57 67 46 48
|
||||
Card 112: 39 57 94 40 13 21 88 92 8 64 | 44 55 52 33 90 41 30 28 26 91 8 89 48 10 83 42 4 78 46 73 54 79 58 34 77
|
||||
Card 113: 29 36 9 46 51 84 21 13 45 50 | 91 57 36 51 46 29 21 45 50 20 8 3 93 65 16 95 52 15 4 59 98 72 97 25 75
|
||||
Card 114: 64 99 3 36 87 46 11 98 2 14 | 43 93 8 17 33 26 13 64 16 37 2 42 5 75 78 82 65 74 57 19 30 80 67 52 71
|
||||
Card 115: 85 49 62 11 63 77 19 57 98 78 | 88 50 78 14 44 99 91 69 37 66 2 47 32 85 77 98 34 57 93 53 80 10 71 33 38
|
||||
Card 116: 69 93 99 95 33 89 26 91 56 4 | 33 86 35 89 99 81 58 4 78 95 41 90 39 64 50 71 28 3 47 51 34 97 76 70 54
|
||||
Card 117: 41 34 8 24 13 87 58 15 73 22 | 41 47 67 4 2 18 87 20 22 12 50 77 90 15 39 79 80 28 32 66 78 48 98 37 29
|
||||
Card 118: 62 32 16 9 19 2 21 59 61 83 | 36 10 41 13 45 1 52 6 99 56 26 70 73 47 50 87 63 89 31 9 43 76 33 49 25
|
||||
Card 119: 78 55 68 49 54 98 75 36 41 11 | 67 69 87 3 99 96 76 93 98 65 51 73 80 35 1 53 52 31 5 2 13 17 82 48 62
|
||||
Card 120: 17 5 24 88 89 6 38 60 23 16 | 90 41 49 32 50 96 73 86 76 40 26 77 12 95 55 31 62 59 22 14 79 28 53 2 82
|
||||
Card 121: 8 50 67 74 78 44 24 11 45 83 | 85 3 99 17 58 13 56 77 41 70 97 39 33 18 9 64 82 27 14 10 89 46 79 16 95
|
||||
Card 122: 44 25 46 67 87 23 20 7 83 41 | 76 55 80 70 16 69 7 97 56 25 47 12 41 13 90 58 23 83 88 87 46 81 44 20 67
|
||||
Card 123: 65 80 57 31 93 94 35 97 27 13 | 41 13 4 46 84 94 27 31 52 16 37 99 57 97 45 65 29 89 25 93 9 35 14 6 80
|
||||
Card 124: 78 32 90 44 34 19 52 85 1 64 | 4 17 16 1 79 80 85 78 23 52 19 73 90 70 95 37 74 60 76 24 10 99 27 44 47
|
||||
Card 125: 4 98 94 53 18 56 90 16 49 21 | 1 31 70 51 78 57 91 5 79 32 93 43 74 98 80 33 68 30 10 65 94 9 16 47 6
|
||||
Card 126: 82 50 99 63 32 55 61 79 43 23 | 80 23 82 21 32 76 93 35 99 4 94 42 13 69 24 92 53 88 51 2 34 91 70 18 83
|
||||
Card 127: 50 96 38 83 65 21 75 67 71 69 | 39 38 83 54 71 69 35 96 43 32 21 22 57 72 65 9 80 50 23 29 30 62 49 97 79
|
||||
Card 128: 4 27 28 3 2 54 14 81 72 37 | 34 83 54 57 3 14 72 13 82 65 51 30 1 27 97 36 4 92 67 10 37 50 7 28 90
|
||||
Card 129: 50 72 35 29 15 8 88 74 66 12 | 90 54 47 75 37 99 26 36 60 80 31 38 10 45 91 4 41 24 19 34 40 39 61 17 69
|
||||
Card 130: 59 72 30 1 5 41 39 89 50 96 | 36 40 41 94 42 26 39 86 3 77 30 68 96 51 54 89 50 53 1 72 64 84 5 38 73
|
||||
Card 131: 21 25 84 29 56 46 54 48 13 44 | 44 67 71 28 59 10 60 15 26 98 4 66 54 65 48 46 40 90 81 80 38 53 61 62 72
|
||||
Card 132: 60 44 30 70 84 66 88 55 32 15 | 15 92 91 67 41 97 66 63 47 84 57 5 94 44 70 86 20 69 24 98 27 55 49 13 30
|
||||
Card 133: 22 68 81 44 90 28 31 70 93 33 | 2 54 7 93 21 34 56 36 33 70 27 32 18 97 31 90 44 28 22 64 10 82 89 73 6
|
||||
Card 134: 43 93 16 41 48 7 55 1 70 4 | 83 30 21 6 78 82 67 24 94 52 95 87 50 98 48 33 37 86 88 81 20 54 80 97 71
|
||||
Card 135: 71 86 24 58 16 46 63 17 55 47 | 89 18 92 64 91 73 33 32 83 77 45 54 97 29 50 88 93 47 74 86 81 35 17 94 51
|
||||
Card 136: 57 25 67 64 72 29 33 56 84 30 | 61 50 77 96 67 57 63 42 69 80 33 86 72 26 6 29 38 92 25 66 15 56 49 27 75
|
||||
Card 137: 64 43 92 88 35 38 10 42 97 40 | 3 87 66 77 80 25 55 73 41 14 86 20 70 12 78 91 96 19 84 93 31 15 75 29 17
|
||||
Card 138: 43 36 16 54 58 95 77 52 88 14 | 36 64 34 71 41 66 43 87 89 5 12 97 88 96 86 14 4 46 91 58 16 26 74 61 94
|
||||
Card 139: 45 54 91 84 94 89 22 53 18 62 | 53 85 42 67 35 3 69 20 88 63 45 87 43 83 82 64 25 90 97 54 29 51 91 39 95
|
||||
Card 140: 87 37 43 72 53 38 84 33 25 96 | 76 63 49 60 92 3 39 85 32 10 16 98 26 90 6 29 69 95 9 68 15 71 31 45 19
|
||||
Card 141: 28 2 13 27 77 15 39 17 11 58 | 74 93 79 17 94 22 81 41 50 33 84 1 3 16 72 73 87 25 57 36 92 46 82 14 37
|
||||
Card 142: 32 47 69 39 97 31 50 49 6 61 | 7 72 68 21 19 36 2 84 38 18 56 40 54 24 58 33 9 92 53 4 74 67 99 71 57
|
||||
Card 143: 3 57 55 78 97 27 92 15 83 30 | 70 98 67 21 56 38 72 91 96 1 71 81 26 89 62 44 49 88 43 80 35 87 41 16 69
|
||||
Card 144: 99 23 20 36 93 37 89 79 35 42 | 39 97 50 85 95 7 6 83 63 24 78 81 32 59 56 76 75 41 55 28 10 67 73 2 43
|
||||
Card 145: 13 40 34 79 46 83 47 76 68 29 | 90 66 95 74 13 7 39 83 76 20 15 62 34 79 47 25 29 68 33 46 50 59 52 40 22
|
||||
Card 146: 17 16 25 80 3 7 84 66 88 63 | 83 5 59 48 65 51 26 21 29 98 44 8 9 4 54 49 78 46 14 85 22 72 34 67 95
|
||||
Card 147: 81 12 43 8 42 14 96 54 47 52 | 63 80 4 71 70 9 20 81 59 16 14 17 74 36 6 60 79 44 33 51 38 39 35 67 92
|
||||
Card 148: 69 74 54 36 21 61 33 44 80 43 | 42 66 35 67 13 31 39 2 94 57 63 20 81 49 18 51 52 98 78 23 59 14 4 53 48
|
||||
Card 149: 36 96 53 65 13 27 45 71 68 33 | 34 71 40 98 87 15 23 39 95 44 38 94 69 79 53 88 56 63 12 92 61 78 49 37 54
|
||||
Card 150: 83 23 40 11 96 80 90 63 48 74 | 92 80 40 29 55 26 63 57 3 83 15 58 47 88 96 77 81 85 48 51 37 90 11 23 73
|
||||
Card 151: 67 29 3 38 79 20 8 70 44 53 | 10 20 13 21 70 53 59 92 9 56 79 8 3 78 75 42 38 41 44 80 29 48 47 32 7
|
||||
Card 152: 72 90 11 9 12 41 6 17 62 64 | 92 40 16 6 69 90 52 71 27 36 13 99 26 19 86 50 47 82 11 98 59 12 10 17 51
|
||||
Card 153: 58 33 55 4 81 77 73 37 7 31 | 16 42 96 90 3 64 68 1 20 87 69 30 81 43 57 36 17 89 51 58 52 11 85 13 12
|
||||
Card 154: 50 32 62 53 49 81 86 96 26 88 | 97 88 14 3 50 44 11 31 75 57 10 86 85 49 40 26 53 5 96 62 58 27 93 80 45
|
||||
Card 155: 39 32 21 4 62 2 85 34 43 63 | 59 87 2 42 4 24 57 61 34 32 21 96 41 85 12 28 49 6 38 95 40 62 93 9 36
|
||||
Card 156: 22 21 19 70 56 82 37 13 49 24 | 25 65 91 83 31 82 63 84 66 5 30 89 21 87 10 85 19 37 28 94 73 88 42 39 70
|
||||
Card 157: 9 44 60 12 41 48 50 10 34 29 | 89 92 57 68 61 48 15 50 88 67 1 22 81 10 12 70 53 58 60 6 79 73 44 45 21
|
||||
Card 158: 67 65 58 45 61 37 43 18 54 64 | 12 34 8 21 35 14 76 93 81 60 30 15 83 95 50 53 1 25 19 20 90 77 75 96 71
|
||||
Card 159: 41 57 7 20 29 49 60 58 48 97 | 35 6 94 99 66 64 67 56 65 13 69 21 24 71 98 32 89 16 23 55 10 52 45 19 53
|
||||
Card 160: 81 31 86 67 69 89 71 51 73 14 | 50 21 68 95 85 38 43 72 24 75 63 23 13 44 81 25 40 31 99 88 94 27 79 34 2
|
||||
Card 161: 13 63 90 73 6 24 5 62 33 4 | 72 74 78 67 58 95 66 50 88 99 97 38 37 65 60 93 29 85 8 86 20 36 39 75 27
|
||||
Card 162: 28 12 51 55 66 27 10 79 76 40 | 46 67 71 63 47 17 5 91 6 68 86 23 95 84 1 93 29 13 31 3 72 82 21 94 56
|
||||
Card 163: 79 12 14 39 8 58 97 63 44 40 | 65 85 70 37 10 51 49 61 77 99 9 81 48 94 13 23 66 83 1 56 3 58 62 84 24
|
||||
Card 164: 77 14 66 16 44 59 21 48 36 26 | 82 1 42 39 9 95 25 8 62 13 52 17 7 10 96 57 35 85 2 33 34 12 37 18 63
|
||||
Card 165: 34 60 36 4 80 62 37 81 93 6 | 80 97 36 5 27 20 82 58 60 46 6 4 99 47 11 39 59 64 57 62 34 3 93 37 81
|
||||
Card 166: 10 34 27 79 26 76 87 16 36 77 | 2 74 35 97 72 84 46 23 88 90 22 49 79 42 19 98 95 21 43 31 8 10 70 34 54
|
||||
Card 167: 38 13 10 92 40 67 16 77 11 1 | 42 90 47 61 60 94 11 5 49 74 13 22 41 27 29 45 2 99 9 16 85 28 81 92 56
|
||||
Card 168: 97 99 14 29 32 61 38 3 56 18 | 17 16 96 90 2 83 78 84 74 99 43 62 41 97 51 4 85 10 66 9 3 29 13 32 89
|
||||
Card 169: 35 31 8 74 82 62 21 51 85 76 | 77 48 41 64 35 76 25 40 8 19 51 47 22 39 21 96 82 65 91 62 85 70 5 31 75
|
||||
Card 170: 36 62 55 59 61 4 87 9 56 20 | 68 35 23 70 24 7 71 22 1 63 44 38 2 3 74 48 39 76 21 57 49 45 19 62 51
|
||||
Card 171: 69 70 61 23 84 28 90 80 8 65 | 3 57 90 20 83 4 8 61 40 94 60 34 42 46 14 62 36 80 65 84 5 13 55 28 91
|
||||
Card 172: 27 16 18 14 80 76 61 6 55 82 | 40 24 41 7 95 64 33 9 74 98 32 71 26 77 45 73 53 19 30 61 88 54 6 78 39
|
||||
Card 173: 73 37 11 46 96 25 86 74 78 87 | 84 25 86 37 74 90 43 79 73 83 70 46 78 12 45 87 14 21 24 64 8 11 44 92 96
|
||||
Card 174: 64 77 90 88 70 82 73 26 65 3 | 69 64 45 75 82 58 83 23 59 6 50 53 67 86 24 71 49 88 65 98 26 90 73 70 87
|
||||
Card 175: 99 56 50 46 23 95 34 76 7 25 | 28 4 87 83 13 84 98 39 20 93 71 68 23 69 60 29 6 2 31 65 25 19 72 48 52
|
||||
Card 176: 52 41 60 2 99 40 90 56 27 12 | 90 62 4 75 61 11 10 9 60 41 27 31 89 50 83 2 63 40 17 26 39 5 43 57 1
|
||||
Card 177: 17 85 50 18 12 45 52 11 20 40 | 57 87 18 56 55 16 59 11 7 50 97 86 81 52 2 53 27 3 25 95 40 13 61 12 88
|
||||
Card 178: 89 87 14 11 16 97 21 54 92 53 | 19 55 66 61 54 15 44 7 13 70 40 78 22 98 75 96 95 41 91 93 38 92 8 11 80
|
||||
Card 179: 80 37 88 81 85 20 56 87 78 19 | 86 56 26 25 4 52 66 51 64 23 71 54 41 34 80 93 99 37 97 79 45 8 81 15 22
|
||||
Card 180: 25 47 40 46 63 39 56 61 31 93 | 41 70 7 33 55 84 25 24 97 50 88 54 20 83 56 37 27 65 14 2 43 17 5 61 42
|
||||
Card 181: 81 41 48 64 14 92 42 54 60 97 | 14 27 17 54 88 90 94 31 66 32 35 47 74 53 69 68 82 83 18 21 77 87 75 24 29
|
||||
Card 182: 8 59 57 32 58 34 49 60 98 18 | 80 41 9 16 55 62 2 13 1 5 6 17 96 28 43 32 86 69 26 61 42 90 39 20 44
|
||||
Card 183: 78 50 21 33 23 94 20 72 32 66 | 58 64 65 54 81 9 71 57 22 55 29 88 19 85 92 17 4 40 44 14 24 61 86 87 7
|
||||
Card 184: 85 36 60 35 13 69 81 49 91 31 | 9 52 16 89 41 19 98 10 1 57 38 44 65 21 39 82 43 4 27 34 29 55 95 90 20
|
||||
Card 185: 32 24 14 77 59 89 2 93 43 45 | 95 78 13 24 63 98 12 34 2 19 51 75 66 9 80 89 83 26 84 23 57 11 44 52 71
|
||||
Card 186: 53 81 95 60 84 67 92 65 4 10 | 65 21 72 84 83 34 95 23 15 53 31 92 41 66 86 18 60 81 49 10 62 8 70 20 69
|
||||
Card 187: 56 63 1 20 14 23 40 83 91 85 | 2 52 6 19 3 89 44 22 55 94 60 58 74 87 88 90 71 10 16 66 8 98 38 17 28
|
||||
Card 188: 64 94 29 13 36 75 74 54 45 47 | 9 15 6 69 66 85 5 89 34 70 3 37 46 59 25 2 18 55 1 62 14 24 58 93 96
|
||||
Card 189: 95 3 65 23 50 24 62 18 42 78 | 3 53 62 74 13 28 21 89 8 83 65 18 90 63 42 24 93 22 55 12 50 67 95 14 99
|
||||
Card 190: 58 62 33 96 59 90 3 36 2 86 | 52 11 1 10 67 28 22 29 95 31 75 74 42 32 43 60 82 76 64 55 34 24 4 72 73
|
||||
Card 191: 75 67 90 35 11 25 26 66 3 93 | 17 95 29 47 97 58 33 22 98 56 28 23 69 13 41 83 64 1 19 45 49 89 74 80 9
|
||||
Card 192: 10 41 20 48 67 50 7 92 76 82 | 96 71 85 81 78 53 93 17 35 12 99 67 92 46 90 8 32 89 24 18 61 43 72 19 48
|
||||
Card 193: 36 52 61 35 86 70 43 85 55 32 | 47 28 80 55 21 87 83 96 73 39 34 75 14 3 16 2 5 36 24 56 43 32 52 49 81
|
||||
Card 194: 38 41 42 54 96 91 98 72 35 2 | 56 17 99 24 90 72 55 77 35 92 97 62 12 98 18 13 61 45 74 48 79 68 47 64 16
|
||||
Card 195: 17 18 58 50 46 31 82 67 60 56 | 87 2 80 77 39 76 59 20 16 42 91 48 37 62 85 84 41 70 10 82 27 99 66 92 63
|
||||
Card 196: 44 24 77 69 32 10 30 57 36 12 | 34 88 12 23 71 74 52 79 85 78 70 69 97 60 50 92 37 49 15 35 28 91 18 39 8
|
||||
Card 197: 55 19 90 7 53 3 34 96 8 95 | 47 50 57 44 88 76 81 85 13 62 94 10 23 26 69 75 27 51 24 43 19 82 2 4 38
|
||||
Card 198: 69 30 47 82 65 23 79 32 3 80 | 5 1 55 62 86 75 36 14 31 7 38 18 66 64 53 59 10 22 96 27 13 85 37 91 51
|
||||
@@ -0,0 +1,249 @@
|
||||
seeds: 763445965 78570222 1693788857 146680070 1157620425 535920936 3187993807 180072493 1047354752 20193861 2130924847 274042257 20816377 596708258 950268560 11451287 3503767450 182465951 3760349291 265669041
|
||||
|
||||
seed-to-soil map:
|
||||
0 1894195346 315486903
|
||||
1184603419 2977305241 40929361
|
||||
1225532780 597717 4698739
|
||||
1988113706 1603988885 78481073
|
||||
679195301 529385087 505408118
|
||||
1781158512 2285166785 39457705
|
||||
352613463 2324624490 326581838
|
||||
1820616217 1738931330 104130014
|
||||
2066594779 2671974456 78036460
|
||||
1288754536 1682469958 56461372
|
||||
1371340411 3442489267 409818101
|
||||
3341036988 1092718505 511270380
|
||||
315486903 1857068786 37126560
|
||||
1924746231 2209682249 49360033
|
||||
1345215908 2259042282 26124503
|
||||
2917167497 2651206328 20768128
|
||||
1230231519 1034793205 57925300
|
||||
2144631239 3421335965 21153302
|
||||
2689873172 2750010916 227294325
|
||||
1974106264 1843061344 14007442
|
||||
2165784541 5296456 524088631
|
||||
1288156819 0 597717
|
||||
2937935625 3018234602 403101363
|
||||
|
||||
soil-to-fertilizer map:
|
||||
3849355959 3101885274 170573538
|
||||
3006688391 3025445580 66663107
|
||||
1656285214 0 92188755
|
||||
2361256790 4033128077 180329908
|
||||
2073349245 3676064680 287907545
|
||||
3458323699 4213457985 81509311
|
||||
2607585697 2380345050 99923790
|
||||
2541586698 3332501375 61727497
|
||||
3789313396 3272458812 60042563
|
||||
1858319884 917612384 162600389
|
||||
404885474 510011966 407600418
|
||||
4019929497 3603127472 72937208
|
||||
812485892 1190058688 253881561
|
||||
2603314195 2073349245 4271502
|
||||
1469824760 92188755 186460454
|
||||
0 278649209 231362757
|
||||
1249323571 1443940249 220501189
|
||||
4285190709 3092108687 9776587
|
||||
1066367453 1817839802 182956118
|
||||
3257369783 2724171240 184379320
|
||||
2707509487 2480268840 111317034
|
||||
2818826521 2192483180 187861870
|
||||
1748473969 1080212773 109845915
|
||||
3441749103 3394228872 16574596
|
||||
3142507350 2077620747 114862433
|
||||
3539833010 2908550560 116895020
|
||||
231362757 1664441438 153398364
|
||||
384761121 2000795920 20124353
|
||||
3656728030 2591585874 132585366
|
||||
3073351498 3963972225 69155852
|
||||
4092866705 3410803468 192324004
|
||||
|
||||
fertilizer-to-water map:
|
||||
2289944373 962149121 35670423
|
||||
3187295333 3295892606 34862460
|
||||
3798694276 3187295333 48036047
|
||||
3633796172 3644673845 164898104
|
||||
3222157793 3909959418 311250910
|
||||
922447685 2248438960 142418952
|
||||
648510907 2390857912 2187794
|
||||
3533408703 3809571949 100387469
|
||||
650698701 1840321280 271748984
|
||||
464371310 553340958 30176545
|
||||
3907291549 3330755066 313918779
|
||||
2791296727 461310335 25110510
|
||||
397451197 486420845 66920113
|
||||
3846730323 3235331380 60561226
|
||||
2575399801 2393045706 96151163
|
||||
1064866637 583517503 106955439
|
||||
1308190772 822897256 139251865
|
||||
0 236670371 224639964
|
||||
2671550964 0 119745763
|
||||
1171822076 2112070264 136368696
|
||||
224639964 690472942 132424314
|
||||
494547855 2489196869 153963052
|
||||
2498862112 160132682 76537689
|
||||
1447442637 997819544 842501736
|
||||
357064278 119745763 40386919
|
||||
2325614796 2643159921 173247316
|
||||
|
||||
water-to-light map:
|
||||
3181220930 3836164803 159006567
|
||||
1405924027 2473049234 39930303
|
||||
1275636734 1411161599 10830099
|
||||
3831476263 1580605379 266491658
|
||||
1570444205 1294782382 116379217
|
||||
3133505036 2271845049 47715894
|
||||
1305612481 2512979537 100311546
|
||||
1286466833 1275636734 19145648
|
||||
167024508 145118817 64336111
|
||||
92584517 615923894 40913901
|
||||
2227655152 2098041405 130620812
|
||||
2181794752 2613291083 34326669
|
||||
433451288 209454928 64553504
|
||||
4223684323 2228662217 43182832
|
||||
3527642272 3532330812 303833991
|
||||
2855274869 2647617752 119788915
|
||||
4266867155 2319560943 28100141
|
||||
231360619 1167459710 18705935
|
||||
2136463524 3995171370 45331228
|
||||
2978600831 1421991698 154904205
|
||||
4097967921 2825698355 78160170
|
||||
0 489813287 92584517
|
||||
1686823422 3023927616 328136942
|
||||
2014960364 2903858525 116532044
|
||||
1512152517 2767406667 58291688
|
||||
395185371 1129193793 38265917
|
||||
498004792 274008432 215804855
|
||||
2975063784 3020390569 3537047
|
||||
3340227497 3352064558 180266254
|
||||
3524203227 4040502598 3439045
|
||||
713809647 656837795 472355998
|
||||
1445854330 2395217316 66298187
|
||||
3520493751 1576895903 3709476
|
||||
4176128091 2347661084 47556232
|
||||
2216121421 2461515503 11533731
|
||||
2604330501 1847097037 250944368
|
||||
2358275964 4043941643 246054537
|
||||
133498418 582397804 33526090
|
||||
2131492408 4289996180 4971116
|
||||
250066554 0 145118817
|
||||
|
||||
light-to-temperature map:
|
||||
1212130960 1395832798 58636484
|
||||
542019293 812004214 195851408
|
||||
1706861165 2688952641 3198757
|
||||
3097592274 3018951608 116723898
|
||||
1148165381 3135675506 2936711
|
||||
938881022 300892136 26815610
|
||||
2884354982 3318488806 103553821
|
||||
789335095 421331130 149545927
|
||||
3270968199 1036156523 69989778
|
||||
1142047574 1030038716 6117807
|
||||
1710059922 1367448764 28384034
|
||||
3961474833 1257923390 109525374
|
||||
300892136 570877057 241127157
|
||||
2564647329 3422042627 200129932
|
||||
3534803741 2001828127 16273450
|
||||
1738443956 1454469282 486329977
|
||||
3717055162 2018101577 244419671
|
||||
4071000207 2781125469 223967089
|
||||
1030038716 3005092558 13859050
|
||||
737870701 358179343 20992797
|
||||
3388483069 4209077325 84901810
|
||||
3551077191 3622172559 62988195
|
||||
3614065386 2769635501 11489968
|
||||
3215304333 3262824940 55663866
|
||||
2278270544 2395185346 286376785
|
||||
1151102092 1940799259 61028868
|
||||
3625555354 4044566844 91499808
|
||||
2987908803 1106146301 109683471
|
||||
1134657064 2681562131 7390510
|
||||
2236365744 2353280546 41904800
|
||||
1270767444 3685160754 311880998
|
||||
1043897766 2262521248 90759298
|
||||
2806870879 2692151398 77484103
|
||||
3340957977 3997041752 47525092
|
||||
3214316172 4293979135 988161
|
||||
2764777261 1215829772 42093618
|
||||
965696632 379172140 42158990
|
||||
3473384879 4147658463 61418862
|
||||
2224773933 4136066652 11591811
|
||||
1582648442 3201806221 61018719
|
||||
758863498 327707746 30471597
|
||||
1643667161 3138612217 63194004
|
||||
|
||||
temperature-to-humidity map:
|
||||
3893671309 2897869925 193525827
|
||||
1232495182 999263760 191357681
|
||||
2440090529 1477966061 163000786
|
||||
3554817869 2745268041 3258240
|
||||
2845194314 3091395752 30017739
|
||||
4087197136 1397536284 33207741
|
||||
131252236 827398049 11627380
|
||||
2183328852 2476037434 27127608
|
||||
2603091315 2503165042 242102999
|
||||
2875212053 1778930312 348370034
|
||||
1427151141 891672290 77843721
|
||||
1642958327 3928570372 200739395
|
||||
3610489285 3219006125 283182024
|
||||
3277129360 3580618829 128344865
|
||||
2233175686 1190621441 206914843
|
||||
891672290 4129309767 165657529
|
||||
0 205218291 35419402
|
||||
3584280491 3551111757 26208794
|
||||
4247745260 1430744025 47222036
|
||||
2210456460 3502188149 21171921
|
||||
1843697722 2136406304 209010485
|
||||
1423852863 3577320551 3298278
|
||||
348097907 336470527 490927522
|
||||
1057329819 3708963694 175165363
|
||||
2231628381 3549564452 1547305
|
||||
3268023402 2127300346 9105958
|
||||
142879616 0 205218291
|
||||
3558076109 3523360070 26204382
|
||||
2052708207 2345416789 130620645
|
||||
4120404877 969516011 29747749
|
||||
35419402 240637693 95832834
|
||||
4150152626 3121413491 97592634
|
||||
3223582087 3884129057 44441315
|
||||
1504994862 1640966847 137963465
|
||||
3405474225 2748526281 149343644
|
||||
|
||||
humidity-to-location map:
|
||||
3554305993 3441523152 94289982
|
||||
4052786034 3015714705 242181262
|
||||
491965155 895492593 72049890
|
||||
2437667299 3726944956 38441480
|
||||
0 387558480 141314689
|
||||
3811971022 3765386436 101972362
|
||||
3648595975 3535813134 51583790
|
||||
1318420824 1500487572 135197760
|
||||
230758172 30039204 163596268
|
||||
3097413876 4221249785 73717511
|
||||
3041068351 3257895967 56345525
|
||||
1454254795 641271247 181430537
|
||||
394354440 1139828795 97610715
|
||||
3215016925 2618366793 339289068
|
||||
827848339 193635472 113349295
|
||||
150184459 306984767 80573713
|
||||
1778801395 2099048921 519317872
|
||||
1176891800 1379491771 111489820
|
||||
1288381620 0 30039204
|
||||
3171131387 3891749067 43885538
|
||||
564015045 528873169 112398078
|
||||
3913943384 3935634605 11560990
|
||||
2767014161 3947195595 274054190
|
||||
941197634 822701784 72790809
|
||||
1453618584 1499851361 636211
|
||||
2298119267 3587396924 139548032
|
||||
3700179765 3867358798 24390269
|
||||
3742730647 1778801395 11181531
|
||||
1013988443 967542483 20851096
|
||||
141314689 1490981591 8869770
|
||||
3925504374 3314241492 127281660
|
||||
2476108779 2088802749 10246172
|
||||
676413123 988393579 151435216
|
||||
3753912178 2957655861 58058844
|
||||
2486354951 1789982926 280659210
|
||||
3724570034 2070642136 18160613
|
||||
1034839539 1237439510 142052261
|
||||
@@ -0,0 +1,2 @@
|
||||
Time: 47 98 66 98
|
||||
Distance: 400 1213 1011 1540
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,756 @@
|
||||
LLRRRLRLLRLRRLRLRLRRRLLRRLRRRLRRRLRRRLRRRLRRRLRRLRLLRRRLRRLLRLRLLLRRLRRLRLRLRLRRRLRLRRRLRRLLLRRRLLRRLLRRLLRRRLLLLRLRLRRRLRLRRRLRLLLRLRRLRRRLRRRLRRRLRRRLLRRLLLLRRLLRRLLRRLRLRRRLRRRLRRRLRRLRRRLRRLRRLRRLRLRRRLRRLRRRLRRRLRRLRLRRRLRRLLRLRRLRRRLRLRRLRRRLRRLRRLRRRLLRRRR
|
||||
|
||||
GXF = (XQB, GFH)
|
||||
QQC = (HQF, BNK)
|
||||
TPP = (XNG, FDD)
|
||||
LQD = (MGR, GJN)
|
||||
XNG = (RCM, BJG)
|
||||
NQC = (KNT, DQF)
|
||||
DGJ = (PGM, LSB)
|
||||
RBF = (RCH, RCH)
|
||||
DNH = (RTL, MLF)
|
||||
VKF = (SRV, TQR)
|
||||
MPT = (FVV, TVP)
|
||||
TKX = (VRN, KNV)
|
||||
XLQ = (MCF, MCF)
|
||||
MNJ = (FRT, QGV)
|
||||
STF = (LFQ, QDS)
|
||||
FFH = (JVM, TCJ)
|
||||
KRT = (GFC, HRX)
|
||||
FVG = (QFS, RSJ)
|
||||
DBH = (GXF, DJL)
|
||||
RKP = (VNL, MSC)
|
||||
VQX = (GGG, RPB)
|
||||
FCM = (VMC, MGV)
|
||||
SRL = (LVV, JQN)
|
||||
HHM = (BDM, FRV)
|
||||
GMN = (LPK, FHT)
|
||||
QCF = (RCH, NJM)
|
||||
PCB = (MDJ, KDM)
|
||||
VMR = (THX, HHB)
|
||||
XQK = (BJQ, LST)
|
||||
FCS = (KPT, RSC)
|
||||
XTG = (XTL, SVX)
|
||||
FVF = (KXB, VVV)
|
||||
NNR = (SBM, TPP)
|
||||
NPH = (RHN, FRR)
|
||||
GJF = (FXG, MLP)
|
||||
TRR = (LVC, RMR)
|
||||
NBS = (SFH, JGT)
|
||||
SSH = (KTK, DDM)
|
||||
CJH = (QJK, XHB)
|
||||
DQF = (NSR, MJB)
|
||||
FHT = (PFK, GPS)
|
||||
GTJ = (QXC, XBR)
|
||||
KQB = (JXT, KGR)
|
||||
JLL = (GTJ, CBN)
|
||||
QPH = (LTX, BDJ)
|
||||
BSP = (MRH, BXJ)
|
||||
QBX = (GPR, SHJ)
|
||||
SPJ = (SLD, XQK)
|
||||
PML = (TTV, BHX)
|
||||
FQN = (TPJ, BTV)
|
||||
GTK = (NBS, VNP)
|
||||
DSQ = (RFN, QGB)
|
||||
KTK = (JHR, FCM)
|
||||
FXV = (BBN, VPK)
|
||||
LJC = (VKH, PPQ)
|
||||
NBA = (JBL, LSR)
|
||||
RKK = (VTL, SNM)
|
||||
FVV = (DQS, CSM)
|
||||
MGJ = (QHP, DPL)
|
||||
RND = (JRQ, XGJ)
|
||||
DVP = (RBF, RBF)
|
||||
JXR = (TJN, CVC)
|
||||
FMV = (CVJ, BVZ)
|
||||
XBL = (KFC, HHT)
|
||||
GDR = (KCV, KCV)
|
||||
NGN = (VKH, PPQ)
|
||||
NJB = (VTH, FSQ)
|
||||
MBD = (JKS, SFQ)
|
||||
TGC = (PXP, TTF)
|
||||
VMT = (XJN, CCH)
|
||||
LBF = (QRB, SKN)
|
||||
DGH = (CSD, RND)
|
||||
SFH = (XHH, GSC)
|
||||
QQD = (VTT, NLX)
|
||||
BLB = (GHJ, KQD)
|
||||
LFG = (TLH, XJT)
|
||||
CQS = (FRR, RHN)
|
||||
XRS = (QLF, KLC)
|
||||
DJL = (GFH, XQB)
|
||||
LJM = (RPM, HPF)
|
||||
HHT = (LBF, VCS)
|
||||
GFL = (LFG, MGQ)
|
||||
TNX = (TSJ, HCK)
|
||||
HPR = (MTG, TJX)
|
||||
LKP = (BXL, BHG)
|
||||
KRC = (DCT, CTS)
|
||||
PSJ = (QPF, MQT)
|
||||
CXG = (NPG, JQP)
|
||||
QTK = (XBL, DSM)
|
||||
SVP = (MLF, RTL)
|
||||
NDT = (NLC, MLK)
|
||||
TDR = (DJR, CJQ)
|
||||
RHS = (HXN, PSZ)
|
||||
PSZ = (VNG, NNK)
|
||||
KKL = (GLH, SPJ)
|
||||
RSB = (SFQ, JKS)
|
||||
PQS = (XVK, LMV)
|
||||
TTV = (MLG, FRH)
|
||||
CJQ = (CTM, KCC)
|
||||
VTT = (QSQ, TVV)
|
||||
TCJ = (MTD, KKX)
|
||||
CNM = (SXQ, RGK)
|
||||
XCC = (DNP, FQN)
|
||||
CXD = (TJX, MTG)
|
||||
VTL = (JFV, DHN)
|
||||
BJG = (FHB, QVJ)
|
||||
MJR = (HDL, LSF)
|
||||
CSV = (CTS, DCT)
|
||||
LFQ = (LNX, RHQ)
|
||||
MNL = (XBL, DSM)
|
||||
NDR = (PGT, TPC)
|
||||
CKS = (CDQ, GLT)
|
||||
VVV = (BVL, QQC)
|
||||
GGG = (JGS, VRC)
|
||||
QRT = (SQJ, VSJ)
|
||||
HQF = (NJK, NJK)
|
||||
JGK = (FJK, PXJ)
|
||||
RXG = (CLT, GTK)
|
||||
TNH = (SJM, QNX)
|
||||
HLX = (QJX, PGN)
|
||||
FRR = (CKP, NHC)
|
||||
QMK = (QVH, QLH)
|
||||
FRT = (TMB, VRX)
|
||||
KJD = (GBS, QMT)
|
||||
RCH = (TGC, TGC)
|
||||
JGF = (DKD, CHG)
|
||||
TSM = (TDR, XHJ)
|
||||
MTG = (DRP, KRR)
|
||||
DCF = (NQC, KNM)
|
||||
VPQ = (HRB, MGG)
|
||||
XVK = (MPC, XMX)
|
||||
NNK = (FKT, CMD)
|
||||
TBF = (JDV, LQD)
|
||||
TTH = (SJM, QNX)
|
||||
NLX = (TVV, QSQ)
|
||||
HGT = (LSF, HDL)
|
||||
FCB = (KLC, QLF)
|
||||
GBH = (HTJ, LXL)
|
||||
BJQ = (XDH, RGV)
|
||||
FLH = (FXV, SMJ)
|
||||
XGN = (CHN, BLJ)
|
||||
RGV = (QCB, TCC)
|
||||
BCV = (NHF, NDH)
|
||||
GQD = (LDC, TVB)
|
||||
BCT = (KGS, QCH)
|
||||
NGC = (MGJ, RPT)
|
||||
LSL = (QVH, QLH)
|
||||
SQJ = (TTH, TNH)
|
||||
VNL = (RLV, CRK)
|
||||
XCQ = (KQB, BLP)
|
||||
CDL = (DJL, GXF)
|
||||
MJB = (CRR, HHM)
|
||||
GSP = (DQJ, FLV)
|
||||
NCM = (SQN, VPJ)
|
||||
JRQ = (RJM, CXG)
|
||||
SXA = (QPH, CFB)
|
||||
LBT = (GPL, NDJ)
|
||||
QNX = (PJT, PQC)
|
||||
PBV = (RRP, TSM)
|
||||
CSD = (XGJ, JRQ)
|
||||
MLK = (GLG, SKB)
|
||||
CFB = (LTX, BDJ)
|
||||
BCH = (HPQ, JBR)
|
||||
BBN = (RHR, VMT)
|
||||
KCV = (RHL, RHL)
|
||||
SGG = (SMP, QSP)
|
||||
GFB = (KCF, KJR)
|
||||
TSD = (NSD, NDL)
|
||||
CXL = (FVG, JCJ)
|
||||
FSQ = (FQG, GXQ)
|
||||
BQF = (HRB, MGG)
|
||||
LRK = (JPG, BHR)
|
||||
LBB = (BHX, TTV)
|
||||
CXR = (BXX, STP)
|
||||
MGV = (RLK, FDX)
|
||||
FHB = (LCN, KSX)
|
||||
JDQ = (GFK, BHD)
|
||||
FJL = (GDR, GDR)
|
||||
TSN = (RKJ, GLN)
|
||||
VPK = (RHR, VMT)
|
||||
VCS = (SKN, QRB)
|
||||
BKG = (RSC, KPT)
|
||||
LQB = (MMQ, BCT)
|
||||
KJK = (SMF, VPM)
|
||||
XMV = (PQS, RCX)
|
||||
TCC = (GPP, KRT)
|
||||
BFS = (DDP, VJJ)
|
||||
FDD = (RCM, BJG)
|
||||
BHG = (MKG, BSM)
|
||||
GQP = (PRR, FFH)
|
||||
GXQ = (BLH, FMB)
|
||||
XBV = (NSH, GCB)
|
||||
MCF = (QPH, CFB)
|
||||
BTD = (BCH, GFM)
|
||||
JQD = (VPQ, BQF)
|
||||
JGT = (XHH, GSC)
|
||||
KGS = (MGB, QQS)
|
||||
JMF = (PSK, GDD)
|
||||
VTZ = (NNR, NVQ)
|
||||
JGS = (KHM, DTS)
|
||||
CBF = (NDJ, GPL)
|
||||
XPM = (MCF, VGZ)
|
||||
RSJ = (VCC, MGS)
|
||||
BLQ = (HJP, MPP)
|
||||
HHB = (NKX, PXK)
|
||||
JKS = (DKV, GMN)
|
||||
GFH = (RXG, VGP)
|
||||
MSC = (RLV, CRK)
|
||||
KJR = (SLQ, FLH)
|
||||
KFC = (VCS, LBF)
|
||||
GGM = (KJK, QJF)
|
||||
QDS = (RHQ, LNX)
|
||||
TPC = (PFD, DJN)
|
||||
DSM = (HHT, KFC)
|
||||
BPJ = (RKK, GGV)
|
||||
MLG = (PDG, SGF)
|
||||
HTJ = (RBJ, PKL)
|
||||
HJR = (MRH, BXJ)
|
||||
JVA = (NVQ, NNR)
|
||||
PXK = (CRV, RHB)
|
||||
NJK = (CVJ, CVJ)
|
||||
XPR = (PGT, TPC)
|
||||
DTS = (FCS, BKG)
|
||||
XJN = (TFT, LKP)
|
||||
SNV = (DDT, LBL)
|
||||
BXX = (KKQ, GBH)
|
||||
PQM = (MXJ, FTT)
|
||||
NSX = (HLX, GVH)
|
||||
CVJ = (JBL, LSR)
|
||||
HKQ = (VMR, DSR)
|
||||
RQJ = (QFV, XMV)
|
||||
CMQ = (KKL, QDL)
|
||||
PGM = (VBL, KFF)
|
||||
LST = (RGV, XDH)
|
||||
CMD = (HKQ, SPB)
|
||||
XSV = (LBB, PML)
|
||||
JHB = (SSB, CXR)
|
||||
LVC = (JHB, TVH)
|
||||
QNT = (RBB, NDT)
|
||||
QPF = (FJG, TKX)
|
||||
NDH = (RRT, PQM)
|
||||
TSJ = (LGH, FBN)
|
||||
KDM = (GJJ, NVX)
|
||||
HMJ = (HPF, RPM)
|
||||
STP = (GBH, KKQ)
|
||||
LDC = (LBT, CBF)
|
||||
RCB = (BPN, JXR)
|
||||
MSN = (PDF, JHF)
|
||||
KKX = (HVX, BKX)
|
||||
GLT = (VHR, GGM)
|
||||
MRH = (LCD, CKD)
|
||||
VGP = (CLT, GTK)
|
||||
LLV = (MRN, PBV)
|
||||
PDL = (DGH, LNK)
|
||||
PFD = (RCB, VRH)
|
||||
CRK = (NGC, KQR)
|
||||
TVP = (CSM, DQS)
|
||||
VTH = (GXQ, FQG)
|
||||
RHJ = (SHN, PNR)
|
||||
MMQ = (QCH, KGS)
|
||||
GFK = (VDV, XCC)
|
||||
PQC = (SRF, KML)
|
||||
SHJ = (CHD, DCB)
|
||||
QJF = (SMF, VPM)
|
||||
QLF = (NGX, RKP)
|
||||
LTX = (RNS, VHH)
|
||||
RQB = (MGQ, LFG)
|
||||
BHD = (XCC, VDV)
|
||||
FQG = (BLH, FMB)
|
||||
SNM = (JFV, DHN)
|
||||
LRQ = (JDL, QBX)
|
||||
SHP = (FRT, QGV)
|
||||
DDP = (CRJ, SXV)
|
||||
LMV = (XMX, MPC)
|
||||
KMP = (HQB, SSK)
|
||||
GXM = (SRV, TQR)
|
||||
SMP = (JGK, GST)
|
||||
KRH = (PBV, MRN)
|
||||
RDM = (FKN, MSN)
|
||||
FNF = (VJJ, DDP)
|
||||
VKH = (CJX, PDB)
|
||||
NHF = (PQM, RRT)
|
||||
PBJ = (RMR, LVC)
|
||||
FRG = (QJC, BPL)
|
||||
RHG = (BGQ, XCQ)
|
||||
RPB = (VRC, JGS)
|
||||
KQD = (VBS, MBN)
|
||||
LSR = (SRH, CSS)
|
||||
KFF = (MFT, NSX)
|
||||
TJX = (KRR, DRP)
|
||||
GPL = (FPQ, SSH)
|
||||
XNM = (BCH, GFM)
|
||||
MPP = (RLX, FVF)
|
||||
HQB = (DJJ, SPV)
|
||||
SSK = (SPV, DJJ)
|
||||
XVA = (SHP, MNJ)
|
||||
TMT = (VRS, JHH)
|
||||
NGX = (MSC, VNL)
|
||||
SMF = (HFP, JMF)
|
||||
SFQ = (DKV, GMN)
|
||||
GBM = (NDH, NHF)
|
||||
DKV = (FHT, LPK)
|
||||
PTN = (FCD, SRL)
|
||||
GPB = (CVS, GFD)
|
||||
QFR = (BLQ, LCT)
|
||||
TLH = (KMP, LFS)
|
||||
TVG = (BHD, GFK)
|
||||
RRT = (MXJ, FTT)
|
||||
DCB = (BPC, GJF)
|
||||
VRN = (CVH, PLG)
|
||||
MGG = (RGR, DDB)
|
||||
XND = (LGX, FCN)
|
||||
HDC = (DJP, BPJ)
|
||||
TCV = (NNV, MDV)
|
||||
JQP = (LSL, QMK)
|
||||
KLC = (NGX, RKP)
|
||||
DPL = (VSL, GQP)
|
||||
BHX = (MLG, FRH)
|
||||
HNK = (LFQ, QDS)
|
||||
RHR = (CCH, XJN)
|
||||
RCM = (FHB, QVJ)
|
||||
JVN = (RHL, VTZ)
|
||||
HSS = (LXF, LXF)
|
||||
XQB = (RXG, VGP)
|
||||
XJQ = (NLN, XLD)
|
||||
HFP = (PSK, GDD)
|
||||
HCK = (FBN, LGH)
|
||||
VHR = (KJK, QJF)
|
||||
MLF = (MPT, SGJ)
|
||||
TPS = (PGM, LSB)
|
||||
HJJ = (CQS, NPH)
|
||||
LMQ = (JQD, VPR)
|
||||
GPR = (CHD, DCB)
|
||||
QFS = (MGS, VCC)
|
||||
SKB = (SMG, STS)
|
||||
CKT = (CCJ, RJH)
|
||||
SDV = (NGN, LJC)
|
||||
DJB = (DVP, SHV)
|
||||
CDR = (RQJ, BPH)
|
||||
QHP = (VSL, GQP)
|
||||
PFK = (HQJ, XSV)
|
||||
PNM = (NRQ, JGF)
|
||||
SQN = (LJM, HMJ)
|
||||
KXB = (BVL, QQC)
|
||||
NHX = (XDQ, PTN)
|
||||
TFT = (BHG, BXL)
|
||||
XDH = (TCC, QCB)
|
||||
XFN = (QGB, RFN)
|
||||
BLJ = (QRV, GGH)
|
||||
QLH = (SGG, QHQ)
|
||||
KPT = (LQB, TNG)
|
||||
VBS = (PDL, PJH)
|
||||
RFN = (GFL, RQB)
|
||||
JDL = (GPR, SHJ)
|
||||
NNV = (VSN, BRN)
|
||||
JNV = (KDM, MDJ)
|
||||
SLK = (FLV, DQJ)
|
||||
JPG = (XRS, FCB)
|
||||
DQJ = (NGR, XKM)
|
||||
LMT = (GJC, BKT)
|
||||
GFD = (DMP, XND)
|
||||
RJM = (NPG, JQP)
|
||||
GLH = (XQK, SLD)
|
||||
SPB = (DSR, VMR)
|
||||
MGQ = (TLH, XJT)
|
||||
SNL = (MLR, VTM)
|
||||
KNT = (MJB, NSR)
|
||||
DDM = (FCM, JHR)
|
||||
TDD = (GLN, RKJ)
|
||||
RRX = (XLQ, XPM)
|
||||
SGF = (SNL, FJF)
|
||||
BTV = (GFB, SMX)
|
||||
BPH = (XMV, QFV)
|
||||
VSJ = (TNH, TTH)
|
||||
DSD = (DVP, SHV)
|
||||
JXT = (DGJ, TPS)
|
||||
DDV = (NNV, MDV)
|
||||
DRP = (KDS, TNJ)
|
||||
MTD = (HVX, BKX)
|
||||
CVH = (FFD, RDM)
|
||||
LCD = (CMJ, CMJ)
|
||||
NLC = (SKB, GLG)
|
||||
XJT = (LFS, KMP)
|
||||
CHG = (DHF, FVX)
|
||||
MFT = (HLX, GVH)
|
||||
HRX = (HPM, XGN)
|
||||
KGR = (TPS, DGJ)
|
||||
GLJ = (NSH, GCB)
|
||||
GPP = (GFC, HRX)
|
||||
TVV = (NFR, QNT)
|
||||
QJK = (QKQ, KDV)
|
||||
XHH = (NJB, PVR)
|
||||
BHR = (FCB, XRS)
|
||||
CKD = (CMJ, RRX)
|
||||
XKM = (VQX, RDL)
|
||||
PXJ = (GBM, BCV)
|
||||
DCT = (HDC, BFG)
|
||||
HXN = (NNK, VNG)
|
||||
QGG = (BPH, RQJ)
|
||||
DQS = (FKL, NCM)
|
||||
STL = (DDT, LBL)
|
||||
PDB = (FNF, BFS)
|
||||
ZZZ = (TTF, PXP)
|
||||
SHV = (RBF, QCF)
|
||||
NGL = (GDR, XRQ)
|
||||
QVH = (QHQ, SGG)
|
||||
CBN = (XBR, QXC)
|
||||
RNT = (KRC, CSV)
|
||||
GCB = (DDF, LMQ)
|
||||
NDL = (DDV, TCV)
|
||||
SRV = (CDR, QGG)
|
||||
DMP = (LGX, LGX)
|
||||
RKJ = (KFG, FRG)
|
||||
SKG = (KBH, LRQ)
|
||||
QGB = (RQB, GFL)
|
||||
XBR = (GQD, QJV)
|
||||
DHN = (LMT, NBB)
|
||||
LPK = (PFK, GPS)
|
||||
QVS = (HJJ, TQJ)
|
||||
MSV = (RJH, CCJ)
|
||||
CCK = (SQJ, VSJ)
|
||||
QHQ = (SMP, QSP)
|
||||
PKL = (RVD, BDX)
|
||||
JDV = (MGR, GJN)
|
||||
FDX = (JFT, TNX)
|
||||
DJN = (RCB, VRH)
|
||||
XGJ = (CXG, RJM)
|
||||
DJJ = (VKF, GXM)
|
||||
VPR = (VPQ, BQF)
|
||||
PGT = (PFD, DJN)
|
||||
RGR = (RPS, NBT)
|
||||
BRK = (BSP, HJR)
|
||||
KKQ = (LXL, HTJ)
|
||||
VRC = (DTS, KHM)
|
||||
GST = (FJK, PXJ)
|
||||
SLD = (BJQ, LST)
|
||||
GHL = (NRQ, JGF)
|
||||
HQJ = (PML, LBB)
|
||||
BLH = (RNT, JFC)
|
||||
SPV = (GXM, VKF)
|
||||
VPM = (JMF, HFP)
|
||||
RBB = (MLK, NLC)
|
||||
FTT = (PVF, DVS)
|
||||
XRQ = (KCV, JVN)
|
||||
LSB = (VBL, KFF)
|
||||
QMT = (CCK, QRT)
|
||||
FBN = (XNM, BTD)
|
||||
JFT = (TSJ, HCK)
|
||||
HDL = (QHL, XNP)
|
||||
BPC = (FXG, MLP)
|
||||
TVB = (LBT, CBF)
|
||||
KNM = (KNT, DQF)
|
||||
CHN = (QRV, GGH)
|
||||
SRH = (XQN, NNC)
|
||||
LXF = (HXN, HXN)
|
||||
VCC = (SKG, QQR)
|
||||
VMM = (RGK, SXQ)
|
||||
FCD = (LVV, JQN)
|
||||
FMB = (RNT, JFC)
|
||||
CNC = (PTN, XDQ)
|
||||
KCC = (JLL, VFC)
|
||||
CDQ = (VHR, GGM)
|
||||
QFV = (RCX, PQS)
|
||||
XQN = (RHG, TKF)
|
||||
SMJ = (VPK, BBN)
|
||||
SRF = (JDQ, TVG)
|
||||
SKN = (RLS, RHJ)
|
||||
KXX = (KHL, LFJ)
|
||||
GJN = (BRK, FPX)
|
||||
QGV = (VRX, TMB)
|
||||
SXV = (GQM, KJD)
|
||||
VGZ = (CFB, QPH)
|
||||
JQN = (XFN, DSQ)
|
||||
BKT = (CBT, PVD)
|
||||
QJC = (PBJ, TRR)
|
||||
BLP = (JXT, KGR)
|
||||
TTF = (MMV, MFK)
|
||||
PXP = (MMV, MFK)
|
||||
PSK = (KMJ, QQD)
|
||||
VPJ = (HMJ, LJM)
|
||||
RPQ = (CDL, DBH)
|
||||
RPS = (NDR, XPR)
|
||||
QQS = (VDG, XJP)
|
||||
GGH = (PCB, JNV)
|
||||
KHL = (MLT, PSJ)
|
||||
NPG = (QMK, LSL)
|
||||
XDQ = (SRL, FCD)
|
||||
MXJ = (PVF, DVS)
|
||||
VGG = (XLD, NLN)
|
||||
DNP = (TPJ, BTV)
|
||||
XRN = (LRK, QXS)
|
||||
XTS = (NQC, KNM)
|
||||
FJF = (MLR, VTM)
|
||||
MVL = (THG, GPB)
|
||||
TPJ = (GFB, SMX)
|
||||
FJG = (VRN, KNV)
|
||||
NDX = (JDV, LQD)
|
||||
JHR = (MGV, VMC)
|
||||
KNV = (CVH, PLG)
|
||||
NSH = (LMQ, DDF)
|
||||
THG = (CVS, GFD)
|
||||
RDL = (RPB, GGG)
|
||||
BNK = (NJK, FMV)
|
||||
FHG = (THG, GPB)
|
||||
NKX = (RHB, CRV)
|
||||
MMV = (CKS, FRS)
|
||||
RHB = (GSP, SLK)
|
||||
GVH = (QJX, PGN)
|
||||
LFS = (HQB, SSK)
|
||||
SJM = (PQC, PJT)
|
||||
TVH = (CXR, SSB)
|
||||
FKN = (JHF, PDF)
|
||||
KRR = (TNJ, KDS)
|
||||
HPQ = (FJL, NGL)
|
||||
PDG = (FJF, SNL)
|
||||
RRP = (TDR, XHJ)
|
||||
LGX = (XVV, XVV)
|
||||
QKQ = (TDD, TSN)
|
||||
GQM = (GBS, QMT)
|
||||
MQT = (FJG, TKX)
|
||||
HRB = (RGR, DDB)
|
||||
HQS = (DJB, DSD)
|
||||
XMX = (MNL, QTK)
|
||||
LGH = (XNM, BTD)
|
||||
QJX = (PPC, KXX)
|
||||
JBR = (FJL, NGL)
|
||||
FRV = (HGT, MJR)
|
||||
BXN = (QXS, LRK)
|
||||
GFM = (HPQ, JBR)
|
||||
MDV = (VSN, BRN)
|
||||
PPQ = (PDB, CJX)
|
||||
FRH = (PDG, SGF)
|
||||
KBH = (QBX, JDL)
|
||||
LNX = (XTG, MJV)
|
||||
PHD = (XJQ, VGG)
|
||||
DJR = (KCC, CTM)
|
||||
LNK = (RND, CSD)
|
||||
SVX = (HRJ, RPQ)
|
||||
BVZ = (LSR, JBL)
|
||||
STS = (CMQ, MGX)
|
||||
DDF = (VPR, JQD)
|
||||
GHJ = (MBN, VBS)
|
||||
HVX = (CXD, HPR)
|
||||
JBL = (CSS, SRH)
|
||||
HPF = (BNS, QFR)
|
||||
DSR = (THX, HHB)
|
||||
KMJ = (VTT, NLX)
|
||||
GFC = (XGN, HPM)
|
||||
CJX = (FNF, BFS)
|
||||
FKT = (SPB, HKQ)
|
||||
MBN = (PDL, PJH)
|
||||
NLN = (CXL, KNR)
|
||||
GSC = (PVR, NJB)
|
||||
LFJ = (MLT, PSJ)
|
||||
NBT = (NDR, XPR)
|
||||
RLK = (TNX, JFT)
|
||||
SSB = (BXX, STP)
|
||||
FJK = (GBM, BCV)
|
||||
VRX = (CJH, KXH)
|
||||
DJP = (RKK, GGV)
|
||||
HRJ = (CDL, DBH)
|
||||
XHB = (QKQ, KDV)
|
||||
BVL = (HQF, HQF)
|
||||
PVF = (VMM, CNM)
|
||||
GLN = (KFG, FRG)
|
||||
KHM = (BKG, FCS)
|
||||
VHH = (MBJ, PHD)
|
||||
XPV = (DJB, DSD)
|
||||
MJV = (XTL, SVX)
|
||||
BDJ = (VHH, RNS)
|
||||
RLS = (SHN, PNR)
|
||||
CBT = (RQM, JJX)
|
||||
PRR = (JVM, TCJ)
|
||||
DVS = (VMM, CNM)
|
||||
KXH = (QJK, XHB)
|
||||
SHD = (LXF, RHS)
|
||||
GPS = (XSV, HQJ)
|
||||
MGR = (BRK, FPX)
|
||||
BXJ = (LCD, CKD)
|
||||
RBJ = (RVD, BDX)
|
||||
JFC = (KRC, CSV)
|
||||
GDD = (QQD, KMJ)
|
||||
KDS = (TBF, NDX)
|
||||
BRN = (HSS, SHD)
|
||||
QXC = (QJV, GQD)
|
||||
GLG = (STS, SMG)
|
||||
MGX = (QDL, KKL)
|
||||
MLT = (MQT, QPF)
|
||||
HPM = (BLJ, CHN)
|
||||
CKP = (CNC, NHX)
|
||||
KML = (TVG, JDQ)
|
||||
AAA = (PXP, TTF)
|
||||
BPZ = (MNJ, SHP)
|
||||
FPQ = (DDM, KTK)
|
||||
NSR = (CRR, HHM)
|
||||
XLD = (CXL, KNR)
|
||||
PLG = (FFD, RDM)
|
||||
RPM = (BNS, QFR)
|
||||
SGJ = (FVV, TVP)
|
||||
BPL = (PBJ, TRR)
|
||||
RHN = (NHC, CKP)
|
||||
MGB = (XJP, VDG)
|
||||
RJH = (BTK, FBK)
|
||||
VNP = (JGT, SFH)
|
||||
BDX = (SNV, STL)
|
||||
VSN = (HSS, HSS)
|
||||
LCT = (MPP, HJP)
|
||||
NBB = (GJC, BKT)
|
||||
VRS = (GHL, PNM)
|
||||
JJX = (BLB, FBQ)
|
||||
TMB = (KXH, CJH)
|
||||
RLX = (KXB, VVV)
|
||||
NJM = (TGC, ZZZ)
|
||||
VNG = (CMD, FKT)
|
||||
GJJ = (MSV, CKT)
|
||||
CVC = (SNH, TMT)
|
||||
CVS = (DMP, DMP)
|
||||
MFK = (CKS, FRS)
|
||||
XHJ = (DJR, CJQ)
|
||||
FCN = (XVV, BPZ)
|
||||
JVM = (KKX, MTD)
|
||||
RQM = (FBQ, BLB)
|
||||
SLQ = (FXV, SMJ)
|
||||
BNS = (LCT, BLQ)
|
||||
DKD = (FVX, DHF)
|
||||
JHF = (MBD, RSB)
|
||||
FBQ = (GHJ, KQD)
|
||||
KDV = (TSN, TDD)
|
||||
FVL = (HJJ, TQJ)
|
||||
LXL = (PKL, RBJ)
|
||||
VDV = (FQN, DNP)
|
||||
BDM = (HGT, MJR)
|
||||
VDG = (KHJ, SDV)
|
||||
BFG = (DJP, BPJ)
|
||||
PNR = (XPV, HQS)
|
||||
XTL = (RPQ, HRJ)
|
||||
PGN = (PPC, KXX)
|
||||
XNP = (LLV, KRH)
|
||||
VTM = (DNH, SVP)
|
||||
VJJ = (CRJ, SXV)
|
||||
NVQ = (SBM, TPP)
|
||||
RLV = (NGC, KQR)
|
||||
THX = (NKX, PXK)
|
||||
MLP = (GLJ, XBV)
|
||||
MPC = (MNL, QTK)
|
||||
FPX = (BSP, HJR)
|
||||
NHC = (NHX, CNC)
|
||||
CRV = (SLK, GSP)
|
||||
NNC = (RHG, TKF)
|
||||
SNH = (JHH, VRS)
|
||||
KNR = (FVG, JCJ)
|
||||
CRJ = (GQM, KJD)
|
||||
PJT = (SRF, KML)
|
||||
XJP = (KHJ, SDV)
|
||||
BXL = (BSM, MKG)
|
||||
QRB = (RHJ, RLS)
|
||||
SMX = (KCF, KJR)
|
||||
CSM = (FKL, NCM)
|
||||
MGS = (QQR, SKG)
|
||||
RTL = (SGJ, MPT)
|
||||
CND = (NDL, NSD)
|
||||
BTK = (QVS, FVL)
|
||||
TNJ = (TBF, NDX)
|
||||
JFV = (LMT, NBB)
|
||||
CMJ = (XLQ, XLQ)
|
||||
CCJ = (BTK, FBK)
|
||||
SXQ = (FHG, MVL)
|
||||
MLR = (DNH, SVP)
|
||||
PJH = (LNK, DGH)
|
||||
KFG = (QJC, BPL)
|
||||
MRN = (RRP, TSM)
|
||||
LBL = (HNK, STF)
|
||||
NFR = (RBB, NDT)
|
||||
NGR = (RDL, VQX)
|
||||
PVR = (VTH, FSQ)
|
||||
LVV = (XFN, DSQ)
|
||||
RCX = (XVK, LMV)
|
||||
FLV = (NGR, XKM)
|
||||
CRR = (FRV, BDM)
|
||||
BSM = (CND, TSD)
|
||||
FVX = (XRN, BXN)
|
||||
TKF = (XCQ, BGQ)
|
||||
QSQ = (NFR, QNT)
|
||||
XVV = (SHP, MNJ)
|
||||
RVD = (SNV, STL)
|
||||
MKG = (TSD, CND)
|
||||
QCB = (GPP, KRT)
|
||||
NVX = (MSV, CKT)
|
||||
GGV = (VTL, SNM)
|
||||
GJC = (PVD, CBT)
|
||||
QSP = (JGK, GST)
|
||||
VBL = (MFT, NSX)
|
||||
DDB = (RPS, NBT)
|
||||
BKX = (HPR, CXD)
|
||||
FKL = (VPJ, SQN)
|
||||
VRH = (BPN, JXR)
|
||||
QQR = (KBH, LRQ)
|
||||
RSC = (LQB, TNG)
|
||||
NRQ = (DKD, CHG)
|
||||
RHL = (NVQ, NNR)
|
||||
QCH = (MGB, QQS)
|
||||
CTS = (BFG, HDC)
|
||||
KHJ = (NGN, LJC)
|
||||
RGK = (MVL, FHG)
|
||||
CCH = (LKP, TFT)
|
||||
VSL = (FFH, PRR)
|
||||
KQR = (RPT, MGJ)
|
||||
LCN = (XTS, DCF)
|
||||
TJN = (TMT, SNH)
|
||||
CLT = (NBS, VNP)
|
||||
JCJ = (QFS, RSJ)
|
||||
BPN = (TJN, CVC)
|
||||
FXG = (GLJ, XBV)
|
||||
BGQ = (KQB, BLP)
|
||||
RMR = (TVH, JHB)
|
||||
CTM = (JLL, VFC)
|
||||
KCF = (SLQ, FLH)
|
||||
DHF = (XRN, BXN)
|
||||
NDJ = (SSH, FPQ)
|
||||
KSX = (XTS, DCF)
|
||||
RPT = (DPL, QHP)
|
||||
QJV = (TVB, LDC)
|
||||
TNG = (BCT, MMQ)
|
||||
FBK = (FVL, QVS)
|
||||
MBJ = (XJQ, VGG)
|
||||
CHD = (GJF, BPC)
|
||||
LSF = (QHL, XNP)
|
||||
SHN = (HQS, XPV)
|
||||
TQR = (CDR, QGG)
|
||||
GRA = (NNK, VNG)
|
||||
RNS = (MBJ, PHD)
|
||||
VFC = (GTJ, CBN)
|
||||
PPC = (LFJ, KHL)
|
||||
DDT = (STF, HNK)
|
||||
NSD = (TCV, DDV)
|
||||
VMC = (FDX, RLK)
|
||||
QXS = (JPG, BHR)
|
||||
PDF = (MBD, RSB)
|
||||
QRV = (PCB, JNV)
|
||||
QVJ = (KSX, LCN)
|
||||
QDL = (GLH, SPJ)
|
||||
MDJ = (GJJ, NVX)
|
||||
HJP = (FVF, RLX)
|
||||
FRS = (GLT, CDQ)
|
||||
SBM = (FDD, XNG)
|
||||
SMG = (CMQ, MGX)
|
||||
TQJ = (NPH, CQS)
|
||||
RHQ = (MJV, XTG)
|
||||
FFD = (MSN, FKN)
|
||||
CSS = (XQN, NNC)
|
||||
PVD = (RQM, JJX)
|
||||
GBS = (QRT, CCK)
|
||||
JHH = (PNM, GHL)
|
||||
QHL = (LLV, KRH)
|
||||
@@ -0,0 +1,156 @@
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace AOC.Tests.Y2023
|
||||
{
|
||||
[TestFixture, Parallelizable(ParallelScope.All)]
|
||||
public class Day01
|
||||
{
|
||||
protected string GetThisClassName() { return this.GetType().Name; }
|
||||
private string[] realData;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
realData = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, "Y2023", "Data", $"{GetThisClassName()}.dat"));
|
||||
}
|
||||
|
||||
[TestCase(@"1abc2
|
||||
pqr3stu8vwx
|
||||
a1b2c3d4e5f
|
||||
treb7uchet", 142)]
|
||||
[TestCase(null, 53080)] // The actual answer
|
||||
public void Part1(string? input, int? expected)
|
||||
{
|
||||
string[] lines = input != null ? input.Split("\n") : realData;
|
||||
|
||||
int result = 0;
|
||||
|
||||
foreach (string line in lines)
|
||||
{
|
||||
// Get all characters that are digits
|
||||
string digits = new(line.Where(char.IsDigit).ToArray());
|
||||
if (digits.Length == 1)
|
||||
{
|
||||
digits += digits;
|
||||
}
|
||||
else if (digits.Length > 2)
|
||||
{
|
||||
digits = $"{digits[0]}{digits[digits.Length - 1]}";
|
||||
}
|
||||
result += int.Parse(digits);
|
||||
}
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(result, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 1: {result}");
|
||||
}
|
||||
|
||||
[TestCase(@"two1nine
|
||||
eightwothree
|
||||
abcone2threexyz
|
||||
xtwone3four
|
||||
4nineeightseven2
|
||||
zoneight234
|
||||
7pqrstsixteen", 281)]
|
||||
[TestCase("three2six8two5", 35)]
|
||||
[TestCase("eightjzqzhrllg1oneightfck", 88)]
|
||||
[TestCase(null, 53268)] // The actual answer
|
||||
public void Part2(string? input, int? expected)
|
||||
{
|
||||
string[] lines = input != null ? input.Split("\n") : realData;
|
||||
|
||||
int result = 0;
|
||||
foreach (string line in lines)
|
||||
{
|
||||
result += GetNumber(line);
|
||||
}
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(result, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 2: {result}");
|
||||
}
|
||||
|
||||
private record FoundMatch
|
||||
{
|
||||
public string Number { get; set; }
|
||||
public List<int> Indexes { get; set; }
|
||||
};
|
||||
|
||||
private int GetNumber(string input)
|
||||
{
|
||||
// Find every instance of a match for these strings, along with the index of their first character
|
||||
List<string> stringsToMatch = new()
|
||||
{
|
||||
"one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "1", "2", "3", "4", "5", "6", "7", "8", "9"
|
||||
};
|
||||
|
||||
List<FoundMatch> foundMatches = new();
|
||||
|
||||
foreach (string number in stringsToMatch)
|
||||
{
|
||||
if (!input.Contains(number))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
FoundMatch foundMatch = new()
|
||||
{
|
||||
Number = number,
|
||||
Indexes = new(),
|
||||
};
|
||||
|
||||
// Find each instance of the string within the string, and record the index of the first character for each
|
||||
int index = input.IndexOf(number, StringComparison.Ordinal);
|
||||
while (index != -1)
|
||||
{
|
||||
foundMatch.Indexes.Add(index);
|
||||
index = input.IndexOf(number, index + 1, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
foundMatches.Add(foundMatch);
|
||||
}
|
||||
|
||||
// Get the first occuring number in foundMatches, and the last occurring
|
||||
FoundMatch firstMatch = foundMatches.OrderBy(x => x.Indexes[0]).First();
|
||||
FoundMatch lastMatch = foundMatches.OrderBy(x => x.Indexes[^1]).Last();
|
||||
|
||||
Dictionary<string, string> numbersToConvert = new()
|
||||
{
|
||||
{"one", "1"},
|
||||
{"two", "2"},
|
||||
{"three", "3"},
|
||||
{"four", "4"},
|
||||
{"five", "5"},
|
||||
{"six", "6"},
|
||||
{"seven", "7"},
|
||||
{"eight", "8"},
|
||||
{"nine", "9"},
|
||||
};
|
||||
|
||||
// Get the firstDigit and lastDigit as ints, converting any words using the numbersToConvert dictionary
|
||||
string firstDigit = firstMatch.Number;
|
||||
if (numbersToConvert.ContainsKey(firstMatch.Number))
|
||||
{
|
||||
firstDigit = numbersToConvert[firstMatch.Number];
|
||||
}
|
||||
string lastDigit = lastMatch.Number;
|
||||
if (numbersToConvert.ContainsKey(lastMatch.Number))
|
||||
{
|
||||
lastDigit = numbersToConvert[lastMatch.Number];
|
||||
}
|
||||
|
||||
int finalNumber = int.Parse($"{firstDigit}{lastDigit}");
|
||||
Console.WriteLine(finalNumber);
|
||||
|
||||
return finalNumber;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
using System.Reflection;
|
||||
|
||||
namespace AOC.Tests.Y2023
|
||||
{
|
||||
[TestFixture, Parallelizable(ParallelScope.All)]
|
||||
public class Day02
|
||||
{
|
||||
protected string GetThisClassName() { return this.GetType().Name; }
|
||||
private string[] realData;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
realData = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, "Y2023", "Data", $"{GetThisClassName()}.dat"));
|
||||
}
|
||||
|
||||
private record Reveal
|
||||
{
|
||||
public int RedCount { get; set; }
|
||||
public int GreenCount { get; set; }
|
||||
public int BlueCount { get; set; }
|
||||
};
|
||||
|
||||
private record Game
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public List<Reveal> Reveals { get; set; }
|
||||
public int MinimumReds { get; set; }
|
||||
public int MinimumGreens { get; set; }
|
||||
public int MinimumBlues { get; set; }
|
||||
public int Power { get; set; }
|
||||
};
|
||||
|
||||
[TestCase(@"Game 1: 3 blue, 4 red; 1 red, 2 green, 6 blue; 2 green
|
||||
Game 2: 1 blue, 2 green; 3 green, 4 blue, 1 red; 1 green, 1 blue
|
||||
Game 3: 8 green, 6 blue, 20 red; 5 blue, 4 red, 13 green; 5 green, 1 red
|
||||
Game 4: 1 green, 3 red, 6 blue; 3 green, 6 red; 3 green, 15 blue, 14 red
|
||||
Game 5: 6 red, 1 blue, 3 green; 2 blue, 1 red, 2 green", 8)]
|
||||
[TestCase(null, 1734)] // The actual answer
|
||||
public void Part1(string? input, int? expected)
|
||||
{
|
||||
string[] lines = input != null ? input.Split("\n") : realData;
|
||||
|
||||
List<Game> games = new();
|
||||
|
||||
foreach (string line in lines)
|
||||
{
|
||||
// Split up the string "Game 1: 3 blue, 4 red; 1 red, 2 green, 6 blue; 2 green"
|
||||
|
||||
// Get the number after "Game " and before ":"
|
||||
int id = int.Parse(line.Substring(5, line.IndexOf(':') - 5));
|
||||
|
||||
// Get each set of reveals, separated by ";"
|
||||
string[] reveals = line.Substring(line.IndexOf(':') + 2).Split("; ");
|
||||
|
||||
// For each reveal, get the number of each color
|
||||
List<Reveal> revealList = new();
|
||||
foreach (string reveal in reveals)
|
||||
{
|
||||
Reveal r = new();
|
||||
string[] colors = reveal.Split(", ");
|
||||
foreach (string color in colors)
|
||||
{
|
||||
if (color.Contains("red"))
|
||||
{
|
||||
r.RedCount = int.Parse(color.Substring(0, color.IndexOf(' ')));
|
||||
}
|
||||
else if (color.Contains("green"))
|
||||
{
|
||||
r.GreenCount = int.Parse(color.Substring(0, color.IndexOf(' ')));
|
||||
}
|
||||
else if (color.Contains("blue"))
|
||||
{
|
||||
r.BlueCount = int.Parse(color.Substring(0, color.IndexOf(' ')));
|
||||
}
|
||||
}
|
||||
revealList.Add(r);
|
||||
}
|
||||
|
||||
// Add the game to the list
|
||||
games.Add(new Game
|
||||
{
|
||||
Id = id,
|
||||
Reveals = revealList,
|
||||
});
|
||||
}
|
||||
|
||||
// Remove any games with more than 12 red cubes, or 13 green cubes, or 14 blue cubes
|
||||
games.RemoveAll(g => g.Reveals.Any(r => r.RedCount > 12 || r.GreenCount > 13 || r.BlueCount > 14));
|
||||
|
||||
// Add up the ids of the remaining games
|
||||
int result = games.Sum(g => g.Id);
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(result, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 1: {result}");
|
||||
}
|
||||
|
||||
[TestCase(@"Game 1: 3 blue, 4 red; 1 red, 2 green, 6 blue; 2 green
|
||||
Game 2: 1 blue, 2 green; 3 green, 4 blue, 1 red; 1 green, 1 blue
|
||||
Game 3: 8 green, 6 blue, 20 red; 5 blue, 4 red, 13 green; 5 green, 1 red
|
||||
Game 4: 1 green, 3 red, 6 blue; 3 green, 6 red; 3 green, 15 blue, 14 red
|
||||
Game 5: 6 red, 1 blue, 3 green; 2 blue, 1 red, 2 green", 2286)]
|
||||
[TestCase(null, 70387)] // The actual answer
|
||||
public void Part2(string? input, int? expected)
|
||||
{
|
||||
string[] lines = input != null ? input.Split("\n") : realData;
|
||||
|
||||
List<Game> games = new();
|
||||
|
||||
foreach (string line in lines)
|
||||
{
|
||||
// Split up the string "Game 1: 3 blue, 4 red; 1 red, 2 green, 6 blue; 2 green"
|
||||
|
||||
// Get the number after "Game " and before ":"
|
||||
int id = int.Parse(line.Substring(5, line.IndexOf(':') - 5));
|
||||
|
||||
// Get each set of reveals, separated by ";"
|
||||
string[] reveals = line.Substring(line.IndexOf(':') + 2).Split("; ");
|
||||
|
||||
// For each reveal, get the number of each color
|
||||
List<Reveal> revealList = new();
|
||||
foreach (string reveal in reveals)
|
||||
{
|
||||
Reveal r = new();
|
||||
string[] colors = reveal.Split(", ");
|
||||
foreach (string color in colors)
|
||||
{
|
||||
if (color.Contains("red"))
|
||||
{
|
||||
r.RedCount = int.Parse(color.Substring(0, color.IndexOf(' ')));
|
||||
}
|
||||
else if (color.Contains("green"))
|
||||
{
|
||||
r.GreenCount = int.Parse(color.Substring(0, color.IndexOf(' ')));
|
||||
}
|
||||
else if (color.Contains("blue"))
|
||||
{
|
||||
r.BlueCount = int.Parse(color.Substring(0, color.IndexOf(' ')));
|
||||
}
|
||||
}
|
||||
revealList.Add(r);
|
||||
}
|
||||
|
||||
// Get the minimum number of each colour required for each game (i,e. the highest amount of each colour in any reveal
|
||||
int minimumReds = revealList.Max(r => r.RedCount);
|
||||
int minimumGreens = revealList.Max(r => r.GreenCount);
|
||||
int minimumBlues = revealList.Max(r => r.BlueCount);
|
||||
|
||||
int power = minimumReds * minimumGreens * minimumBlues;
|
||||
|
||||
|
||||
// Add the game to the list
|
||||
games.Add(new Game
|
||||
{
|
||||
Id = id,
|
||||
Reveals = revealList,
|
||||
MinimumReds = minimumReds,
|
||||
MinimumGreens = minimumGreens,
|
||||
MinimumBlues = minimumBlues,
|
||||
Power = power,
|
||||
});
|
||||
}
|
||||
|
||||
int result = games.Sum(g => g.Power);
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(result, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 2: {result}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,439 @@
|
||||
namespace AOC.Tests.Y2023;
|
||||
|
||||
[TestFixture]
|
||||
[Parallelizable(ParallelScope.All)]
|
||||
public class Day03
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
realData = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, "Y2023", "Data",
|
||||
$"{GetThisClassName()}.dat"));
|
||||
}
|
||||
|
||||
protected string GetThisClassName() { return GetType().Name; }
|
||||
private string[] realData;
|
||||
|
||||
private bool CheckSurroundingCellsForSymbols(char[,] grid, List<(int, int)> coords, bool isTesting = false)
|
||||
{
|
||||
char[,] grid2 = new char[grid.GetLength(0), grid.GetLength(1)];
|
||||
foreach ((int, int) coord in coords)
|
||||
{
|
||||
int x = coord.Item1;
|
||||
int y = coord.Item2;
|
||||
|
||||
grid2[x, y] = grid[x, y];
|
||||
|
||||
for (int i = x - 1; i <= x + 1; i++)
|
||||
{
|
||||
for (int j = y - 1; j <= y + 1; j++)
|
||||
{
|
||||
if (i >= 0 && i < grid.GetLength(0) && j >= 0 && j < grid.GetLength(1) && !coords.Contains((i, j)))
|
||||
{
|
||||
if (isTesting)
|
||||
{
|
||||
// Console.WriteLine($"{i},{j}");
|
||||
grid2[i, j] = 'b';
|
||||
}
|
||||
|
||||
char cell = grid[i, j];
|
||||
if (!char.IsDigit(cell) && cell != '.')
|
||||
{
|
||||
if (isTesting)
|
||||
{
|
||||
grid2[i, j] = 'a';
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isTesting)
|
||||
{
|
||||
// Print out the grid2
|
||||
for (int i = 0; i < grid2.GetLength(0); i++)
|
||||
{
|
||||
string line = "";
|
||||
for (int j = 0; j < grid2.GetLength(1); j++)
|
||||
{
|
||||
line += grid2[i, j] != '\u0000' ? grid2[i, j] : '.';
|
||||
}
|
||||
|
||||
Console.WriteLine(line);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private List<int> GetAllValidPartNumbers(string[] lines)
|
||||
{
|
||||
// Create a 2D array to represent the grid.
|
||||
int rows = lines.Length;
|
||||
int cols = lines[0].Length;
|
||||
char[,] grid = new char[rows, cols];
|
||||
|
||||
// Populate the grid
|
||||
for (int i = 0; i < rows; i++)
|
||||
{
|
||||
string line = lines[i];
|
||||
for (int j = 0; j < cols; j++)
|
||||
{
|
||||
grid[i, j] = line[j];
|
||||
}
|
||||
}
|
||||
|
||||
List<int> numbers = new();
|
||||
|
||||
// Iterate over each cell in the grid.
|
||||
for (int i = 0; i < rows; i++)
|
||||
{
|
||||
Console.WriteLine($"Line {i + 1}");
|
||||
for (int j = 0; j < cols; j++)
|
||||
{
|
||||
List<(int, int)> numberCoords = new();
|
||||
|
||||
// If the cell contains a digit and it's the start of a number (either the left cell is not a digit or it's the left boundary), start collecting the digits to form a number until you reach a cell that's not a digit.
|
||||
if (char.IsDigit(grid[i, j]) && (j == 0 || !char.IsDigit(grid[i, j - 1])))
|
||||
{
|
||||
// Collect the digits to form a number until you reach a cell that's not a digit.
|
||||
string number = "";
|
||||
|
||||
while (char.IsDigit(grid[i, j]))
|
||||
{
|
||||
number += grid[i, j];
|
||||
numberCoords.Add((i, j));
|
||||
j++;
|
||||
if (j >= cols)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If the number is valid, add it to a list.
|
||||
if (number.Length >= 1)
|
||||
{
|
||||
int formattedNumber = int.Parse(number);
|
||||
|
||||
Console.WriteLine(formattedNumber);
|
||||
|
||||
// Check the eight surrounding cells of each digit in the number.
|
||||
if (numberCoords.Count > 0)
|
||||
{
|
||||
bool isValidPartNumber = CheckSurroundingCellsForSymbols(grid, numberCoords);
|
||||
// If any of the surrounding cells contain a symbol, add the number to a list.
|
||||
if (isValidPartNumber)
|
||||
{
|
||||
Console.WriteLine("Valid part number");
|
||||
numbers.Add(formattedNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Return the list of numbers.
|
||||
return numbers;
|
||||
}
|
||||
|
||||
private int CountNumbers(List<(int, int)> numberCoords)
|
||||
{
|
||||
// Group coordinates by the X-axis and sort each group by the Y-axis
|
||||
IEnumerable<IOrderedEnumerable<(int, int)>> groupedCoords = numberCoords.GroupBy(coord => coord.Item1)
|
||||
.Select(group => group.OrderBy(coord => coord.Item2));
|
||||
|
||||
int numberCount = 0;
|
||||
foreach (IOrderedEnumerable<(int, int)> group in groupedCoords)
|
||||
{
|
||||
int lastY = int.MinValue;
|
||||
foreach ((int, int) coord in group)
|
||||
{
|
||||
// If there is a gap in the Y-axis, increment the number count
|
||||
if (coord.Item2 - lastY > 1)
|
||||
{
|
||||
numberCount++;
|
||||
}
|
||||
|
||||
lastY = coord.Item2;
|
||||
}
|
||||
}
|
||||
|
||||
return numberCount;
|
||||
}
|
||||
|
||||
private List<int> ExtractNumbers(List<(int, int)> numberCoords, char[,] grid)
|
||||
{
|
||||
// Initialize a list to hold the extracted numbers
|
||||
List<int> numbers = new();
|
||||
|
||||
// Sort the coordinates by Y-axis (Item2) then by X-axis (Item1)
|
||||
List<(int, int)> sortedCoords =
|
||||
numberCoords.OrderBy(coord => coord.Item2).ThenBy(coord => coord.Item1).ToList();
|
||||
|
||||
// Create a HashSet to keep track of processed coordinates
|
||||
HashSet<(int, int)> processedCoords = new();
|
||||
|
||||
foreach ((int x, int y) in sortedCoords)
|
||||
{
|
||||
// Skip this coordinate if it has already been processed
|
||||
if (processedCoords.Contains((x, y)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Start from the current coordinate and scan to the left until a non-digit is found or it reaches the beginning of the row
|
||||
int startX = x;
|
||||
while (startX > 0 && char.IsDigit(grid[startX - 1, y]))
|
||||
{
|
||||
startX--;
|
||||
}
|
||||
|
||||
// Build the number by scanning to the right from the startX position
|
||||
string currentNumberStr = "";
|
||||
int currentX = startX;
|
||||
while (currentX < grid.GetLength(0) && char.IsDigit(grid[currentX, y]))
|
||||
{
|
||||
currentNumberStr += grid[currentX, y];
|
||||
// Mark the coordinate as processed
|
||||
processedCoords.Add((currentX, y));
|
||||
currentX++;
|
||||
}
|
||||
|
||||
// If a number is formed, add it to the list
|
||||
if (currentNumberStr.Length > 0)
|
||||
{
|
||||
numbers.Add(int.Parse(currentNumberStr));
|
||||
}
|
||||
}
|
||||
|
||||
// Return the list of extracted numbers
|
||||
return numbers;
|
||||
}
|
||||
|
||||
|
||||
private int GetGearRatioFromExactlyTwoNumbersInSurroundingCells(char[,] grid, (int, int) gearCoord)
|
||||
{
|
||||
List<(int, int)> numberCoords = new();
|
||||
int x = gearCoord.Item1;
|
||||
int y = gearCoord.Item2;
|
||||
int gearRatio = 0;
|
||||
|
||||
// Check the eight surrounding cells of the gear
|
||||
for (int i = x - 1; i <= x + 1; i++)
|
||||
{
|
||||
for (int j = y - 1; j <= y + 1; j++)
|
||||
{
|
||||
if (i >= 0 && i < grid.GetLength(0) && j >= 0 && j < grid.GetLength(1) && (i != x || j != y))
|
||||
{
|
||||
if (char.IsDigit(grid[i, j]))
|
||||
{
|
||||
numberCoords.Add((i, j));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Consider each set of cells in the same x axis with a digit to their immediate right as a single number
|
||||
foreach ((int, int) numberCoord in numberCoords)
|
||||
{
|
||||
Console.WriteLine($"{numberCoord.Item1},{numberCoord.Item2}");
|
||||
}
|
||||
|
||||
Console.WriteLine("---");
|
||||
|
||||
List<int> numbers = ExtractNumbers(numberCoords, grid);
|
||||
|
||||
foreach (int number in numbers)
|
||||
{
|
||||
Console.WriteLine($"Number: {number}");
|
||||
}
|
||||
|
||||
Console.WriteLine("===");
|
||||
|
||||
if (numbers.Count == 2)
|
||||
{
|
||||
// If there are exactly two numbers around the gear, generate the gear ratio
|
||||
gearRatio = numbers[0] * numbers[1];
|
||||
Console.WriteLine($"{numbers[0]} * {numbers[1]} = {gearRatio}");
|
||||
}
|
||||
|
||||
return gearRatio;
|
||||
}
|
||||
|
||||
|
||||
private int GetSumOfAllGearRatios(string[] lines)
|
||||
{
|
||||
// Create a 2D array to represent the grid.
|
||||
int cols = lines[0].Length;
|
||||
int rows = lines.Length;
|
||||
char[,] grid = new char[cols, rows];
|
||||
|
||||
// Populate the grid
|
||||
for (int j = 0; j < rows; j++)
|
||||
{
|
||||
string line = lines[j];
|
||||
for (int i = 0; i < cols; i++)
|
||||
{
|
||||
grid[i, j] = line[i];
|
||||
}
|
||||
}
|
||||
|
||||
List<(int, int)> gearCoords = new();
|
||||
|
||||
// Iterate over each cell in the grid to find all gears
|
||||
for (int i = 0; i < cols; i++)
|
||||
{
|
||||
// Console.WriteLine($"Line {i + 1}");
|
||||
for (int j = 0; j < rows; j++)
|
||||
{
|
||||
if (grid[i, j] == '*')
|
||||
{
|
||||
gearCoords.Add((i, j));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int gearRatios = 0;
|
||||
// Now find all instances where exactly two numbers are adjacent to a gear and sum their gear ratios
|
||||
foreach ((int, int) gear in gearCoords)
|
||||
{
|
||||
gearRatios += GetGearRatioFromExactlyTwoNumbersInSurroundingCells(grid, gear);
|
||||
}
|
||||
|
||||
return gearRatios;
|
||||
}
|
||||
|
||||
|
||||
[TestCase("blah", 1)]
|
||||
public void TestCheckSurroundingCellsForSymbolsFunctionWorksCorrectly(string input, int? expected)
|
||||
{
|
||||
string exampleSchematic = @"467..114..
|
||||
...*......
|
||||
..35..633.
|
||||
......#...
|
||||
617*......
|
||||
.....+.58.
|
||||
..592.....
|
||||
......755.
|
||||
...$.*....
|
||||
.664.598..";
|
||||
string[] lines = exampleSchematic.Split("\n");
|
||||
int rows = lines.Length;
|
||||
int cols = lines[0].Length;
|
||||
char[,] grid = new char[rows, cols];
|
||||
|
||||
for (int i = 0; i < rows; i++)
|
||||
{
|
||||
string line = lines[i];
|
||||
for (int j = 0; j < cols; j++)
|
||||
{
|
||||
grid[i, j] = line[j];
|
||||
}
|
||||
}
|
||||
|
||||
List<(int, int)> coords = new()
|
||||
{
|
||||
(0, 0),
|
||||
(0, 1),
|
||||
(0, 2),
|
||||
(0, 5),
|
||||
(0, 6),
|
||||
(0, 7),
|
||||
(2, 2),
|
||||
(2, 3),
|
||||
(2, 6),
|
||||
(2, 7),
|
||||
(2, 8),
|
||||
(4, 0),
|
||||
(4, 1),
|
||||
(4, 2),
|
||||
(5, 7),
|
||||
(5, 8),
|
||||
(6, 2),
|
||||
(6, 3),
|
||||
(6, 4),
|
||||
(7, 6),
|
||||
(7, 7),
|
||||
(7, 8),
|
||||
(9, 1),
|
||||
(9, 2),
|
||||
(9, 3),
|
||||
(9, 5),
|
||||
(9, 6),
|
||||
(9, 7)
|
||||
};
|
||||
|
||||
CheckSurroundingCellsForSymbols(grid, coords, true);
|
||||
|
||||
//if (expected != null)
|
||||
//{
|
||||
// Assert.That(result, Is.EqualTo(expected.Value));
|
||||
//}
|
||||
|
||||
//Console.WriteLine($"Part 2: {result}");
|
||||
}
|
||||
|
||||
[TestCase(@"467..114..
|
||||
...*......
|
||||
..35..633.
|
||||
......#...
|
||||
617*......
|
||||
.....+.58.
|
||||
..592.....
|
||||
......755.
|
||||
...$.*....
|
||||
.664.598..", 4361)]
|
||||
[TestCase(null, 550934)] // The actual answer
|
||||
public void Part1(string? input, int? expected)
|
||||
{
|
||||
string[] lines = input != null ? input.Split("\n") : realData;
|
||||
|
||||
// any number adjacent to a symbol, even diagonally, is a "part number" and should be included in your sum. (Periods (.) do not count as a symbol.)
|
||||
List<int> validPartNumbers = GetAllValidPartNumbers(lines);
|
||||
|
||||
// The result is the sum of all the valid part numbers
|
||||
int result = validPartNumbers.Sum();
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(result, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 1: {result}");
|
||||
}
|
||||
|
||||
[TestCase(@"467..114..
|
||||
...*......
|
||||
..35..633.
|
||||
......#...
|
||||
617*......
|
||||
.....+.58.
|
||||
..592.....
|
||||
......755.
|
||||
...$.*....
|
||||
.664.598..", 467835)]
|
||||
[TestCase(null, 81997870)] // The actual answer
|
||||
public void Part2(string? input, int? expected)
|
||||
{
|
||||
string[] lines = input != null ? input.Split("\n") : realData;
|
||||
|
||||
// A gear is any * symbol that is adjacent to exactly two part numbers. Its gear ratio is the result of multiplying those two numbers together.
|
||||
int gearRatiosSum = GetSumOfAllGearRatios(lines);
|
||||
|
||||
// The result is the sum of all the gear ratios
|
||||
int result = gearRatiosSum;
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(result, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 2: {result}");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
namespace AOC.Tests.Y2023;
|
||||
|
||||
[TestFixture]
|
||||
[Parallelizable(ParallelScope.All)]
|
||||
public class Day04
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
realData = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, "Y2023", "Data",
|
||||
$"{GetThisClassName()}.dat"));
|
||||
}
|
||||
|
||||
protected string GetThisClassName() { return GetType().Name; }
|
||||
private string[] realData;
|
||||
|
||||
[TestCase(@"Card 1: 41 48 83 86 17 | 83 86 6 31 17 9 48 53
|
||||
Card 2: 13 32 20 16 61 | 61 30 68 82 17 32 24 19
|
||||
Card 3: 1 21 53 59 44 | 69 82 63 72 16 21 14 1
|
||||
Card 4: 41 92 73 84 69 | 59 84 76 51 58 5 54 83
|
||||
Card 5: 87 83 26 28 32 | 88 30 70 12 93 22 82 36
|
||||
Card 6: 31 18 13 56 72 | 74 77 10 23 35 67 36 11", 13)]
|
||||
[TestCase(null, 17782)] // The actual answer
|
||||
public void Part1(string? input, int? expected)
|
||||
{
|
||||
string[] lines = input != null ? input.Split("\n") : realData;
|
||||
|
||||
int totalPoints = 0;
|
||||
|
||||
foreach (string line in lines)
|
||||
{
|
||||
// Given this string "Card 1: 41 48 83 86 17 | 83 86 6 31 17 9 48 53" split it into two lists of numbers divided by |,
|
||||
// ignoring everything before the :
|
||||
|
||||
// Extract substring after colon
|
||||
string numbersPart = line.Substring(line.IndexOf(':') + 1).Trim();
|
||||
|
||||
// Split the string into two parts using '|'
|
||||
string[] parts = numbersPart.Split('|');
|
||||
|
||||
// Convert each part to a list of integers
|
||||
List<int> myNumbers = parts[0].Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(int.Parse).ToList();
|
||||
List<int> winningNumbers = parts[1].Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(int.Parse).ToList();
|
||||
|
||||
// Get all numbers in myNumbers that appear in the winningNumbers
|
||||
List<int> matchingNumbers = myNumbers.Intersect(winningNumbers).ToList();
|
||||
|
||||
Console.WriteLine($"Matches: {matchingNumbers.Count}");
|
||||
|
||||
if (matchingNumbers.Count > 0)
|
||||
{
|
||||
// 1 point for the first match, then doubled for each of the other matches after the first
|
||||
int points = 1; // Start with 1 point for the first match
|
||||
for (int i = 1; i < matchingNumbers.Count; i++)
|
||||
{
|
||||
points *= 2; // Double the points for each subsequent match
|
||||
}
|
||||
|
||||
Console.WriteLine($"Points: {points}");
|
||||
|
||||
totalPoints += points;
|
||||
}
|
||||
}
|
||||
|
||||
int result = totalPoints;
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(result, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 1: {result}");
|
||||
}
|
||||
|
||||
private record Card
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int Matches { get; set; }
|
||||
public int Copies { get; set; }
|
||||
}
|
||||
|
||||
[TestCase(@"Card 1: 41 48 83 86 17 | 83 86 6 31 17 9 48 53
|
||||
Card 2: 13 32 20 16 61 | 61 30 68 82 17 32 24 19
|
||||
Card 3: 1 21 53 59 44 | 69 82 63 72 16 21 14 1
|
||||
Card 4: 41 92 73 84 69 | 59 84 76 51 58 5 54 83
|
||||
Card 5: 87 83 26 28 32 | 88 30 70 12 93 22 82 36
|
||||
Card 6: 31 18 13 56 72 | 74 77 10 23 35 67 36 11", 30)]
|
||||
[TestCase(null, 8477787)] // The actual answer
|
||||
public void Part2(string? input, int? expected)
|
||||
{
|
||||
string[] lines = input != null ? input.Split("\n") : realData;
|
||||
|
||||
int totalCards = 0;
|
||||
|
||||
List<Card> cards = new();
|
||||
|
||||
// Get the data for all the original cards
|
||||
foreach (string line in lines)
|
||||
{
|
||||
// Given this string "Card 1: 41 48 83 86 17 | 83 86 6 31 17 9 48 53" split it into two lists of numbers divided by |,
|
||||
// ignoring everything before the :
|
||||
|
||||
// Get the card number after "Card " and before ":"
|
||||
int cardNumber =
|
||||
int.Parse(line.Substring(line.IndexOf(' ') + 1, line.IndexOf(':') - line.IndexOf(' ') - 1));
|
||||
|
||||
// Extract substring after colon
|
||||
string numbersPart = line.Substring(line.IndexOf(':') + 1).Trim();
|
||||
|
||||
// Split the string into two parts using '|'
|
||||
string[] parts = numbersPart.Split('|');
|
||||
|
||||
// Convert each part to a list of integers
|
||||
List<int> myNumbers = parts[0].Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(int.Parse).ToList();
|
||||
List<int> winningNumbers = parts[1].Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(int.Parse).ToList();
|
||||
|
||||
// Get all numbers in myNumbers that appear in the winningNumbers
|
||||
List<int> matchingNumbers = myNumbers.Intersect(winningNumbers).ToList();
|
||||
|
||||
Card card = new() { Id = cardNumber, Matches = matchingNumbers.Count, Copies = 1 };
|
||||
|
||||
cards.Add(card);
|
||||
}
|
||||
|
||||
// Work out any copies - you win 1 copy of each of the next 4 cards for each matching number
|
||||
foreach (Card card in cards)
|
||||
{
|
||||
if (card.Matches > 0)
|
||||
{
|
||||
// Handle all copies, including the original
|
||||
for (int i = 0; i < card.Copies; i++)
|
||||
{
|
||||
for (int j = 1; j <= card.Matches; j++)
|
||||
{
|
||||
// Increment the number of copies for the relevant card
|
||||
Card cardToCopy = cards.First(c => c.Id == card.Id + j);
|
||||
cardToCopy.Copies += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
totalCards = cards.Sum(c => c.Copies);
|
||||
|
||||
int result = totalCards;
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(result, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 2: {result}");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,246 @@
|
||||
namespace AOC.Tests.Y2023;
|
||||
|
||||
[TestFixture]
|
||||
[Parallelizable(ParallelScope.All)]
|
||||
public class Day05
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
realData = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, "Y2023", "Data",
|
||||
$"{GetThisClassName()}.dat"));
|
||||
}
|
||||
|
||||
protected string GetThisClassName() { return GetType().Name; }
|
||||
private string[] realData;
|
||||
|
||||
private record Map
|
||||
{
|
||||
public long DestinationRangeStart { get; set; }
|
||||
public long SourceRangeStart { get; set; }
|
||||
public long RangeLength { get; set; }
|
||||
}
|
||||
|
||||
private record Almanac
|
||||
{
|
||||
public List<long> SeedsToBePlanted { get; set; }
|
||||
public List<Map> SeedToSoilMap { get; set; }
|
||||
public List<Map> SoilToFertiliserMap { get; set; }
|
||||
public List<Map> FertiliserToWaterMap { get; set; }
|
||||
public List<Map> WaterToLightMap { get; set; }
|
||||
public List<Map> LightToTemperatureMap { get; set; }
|
||||
public List<Map> TemperatureToHumidityMap { get; set; }
|
||||
public List<Map> HumidityToLocationMap { get; set; }
|
||||
}
|
||||
|
||||
private List<Map> GetMap(string[] lines, string mapName)
|
||||
{
|
||||
List<Map> map = new();
|
||||
int lineNumber = 0;
|
||||
while (lines[lineNumber] != mapName)
|
||||
{
|
||||
lineNumber++;
|
||||
}
|
||||
|
||||
lineNumber++;
|
||||
while (lineNumber < lines.Length && lines[lineNumber] != "")
|
||||
{
|
||||
string[] mapLine = lines[lineNumber].Split(" ");
|
||||
map.Add(new Map
|
||||
{
|
||||
DestinationRangeStart = long.Parse(mapLine[0]),
|
||||
SourceRangeStart = long.Parse(mapLine[1]),
|
||||
RangeLength = long.Parse(mapLine[2])
|
||||
});
|
||||
lineNumber++;
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
private long GetValueUsingMaps(List<Map> maps, long sourceValue)
|
||||
{
|
||||
// is the seed number within any of the ranges for the seed to soil map?
|
||||
if (maps.Any(m => m.SourceRangeStart + m.RangeLength >= sourceValue && sourceValue >= m.SourceRangeStart))
|
||||
{
|
||||
Map appropriateMap = maps
|
||||
.OrderBy(m => m.DestinationRangeStart)
|
||||
.First(m =>
|
||||
m.SourceRangeStart + m.RangeLength >= sourceValue && sourceValue >= m.SourceRangeStart);
|
||||
|
||||
// Calculate how far to move from the start of the source range to our seed number
|
||||
long increment = sourceValue - appropriateMap.SourceRangeStart;
|
||||
return appropriateMap.DestinationRangeStart + increment;
|
||||
}
|
||||
|
||||
// Just use the same value as the source
|
||||
return sourceValue;
|
||||
}
|
||||
|
||||
|
||||
[TestCase(@"seeds: 79 14 55 13
|
||||
|
||||
seed-to-soil map:
|
||||
50 98 2
|
||||
52 50 48
|
||||
|
||||
soil-to-fertilizer map:
|
||||
0 15 37
|
||||
37 52 2
|
||||
39 0 15
|
||||
|
||||
fertilizer-to-water map:
|
||||
49 53 8
|
||||
0 11 42
|
||||
42 0 7
|
||||
57 7 4
|
||||
|
||||
water-to-light map:
|
||||
88 18 7
|
||||
18 25 70
|
||||
|
||||
light-to-temperature map:
|
||||
45 77 23
|
||||
81 45 19
|
||||
68 64 13
|
||||
|
||||
temperature-to-humidity map:
|
||||
0 69 1
|
||||
1 0 69
|
||||
|
||||
humidity-to-location map:
|
||||
60 56 37
|
||||
56 93 4", 35)]
|
||||
[TestCase(null, 265018614)] // The actual answer
|
||||
public void Part1(string? input, int? expected)
|
||||
{
|
||||
string[] lines = input != null ? input.Split("\n") : realData;
|
||||
Almanac almanac = new();
|
||||
|
||||
// Get the seeds from the first line
|
||||
almanac.SeedsToBePlanted = lines[0].Split(": ")[1].Split(" ").Select(long.Parse).ToList();
|
||||
|
||||
// Get the maps when we don't know what line number they occur on
|
||||
almanac.SeedToSoilMap = GetMap(lines, "seed-to-soil map:");
|
||||
almanac.SoilToFertiliserMap = GetMap(lines, "soil-to-fertilizer map:");
|
||||
almanac.FertiliserToWaterMap = GetMap(lines, "fertilizer-to-water map:");
|
||||
almanac.WaterToLightMap = GetMap(lines, "water-to-light map:");
|
||||
almanac.LightToTemperatureMap = GetMap(lines, "light-to-temperature map:");
|
||||
almanac.TemperatureToHumidityMap = GetMap(lines, "temperature-to-humidity map:");
|
||||
almanac.HumidityToLocationMap = GetMap(lines, "humidity-to-location map:");
|
||||
|
||||
List<long> locations = new();
|
||||
|
||||
foreach (long seed in almanac.SeedsToBePlanted)
|
||||
{
|
||||
// Get the soil, fertilizer, water, light, temperature, humidity, and location
|
||||
long soil = GetValueUsingMaps(almanac.SeedToSoilMap, seed);
|
||||
long fertiliser = GetValueUsingMaps(almanac.SoilToFertiliserMap, soil);
|
||||
long water = GetValueUsingMaps(almanac.FertiliserToWaterMap, fertiliser);
|
||||
long light = GetValueUsingMaps(almanac.WaterToLightMap, water);
|
||||
long temperature = GetValueUsingMaps(almanac.LightToTemperatureMap, light);
|
||||
long humidity = GetValueUsingMaps(almanac.TemperatureToHumidityMap, temperature);
|
||||
long location = GetValueUsingMaps(almanac.HumidityToLocationMap, humidity);
|
||||
|
||||
Console.WriteLine($"Seed {seed} grows in location {location}");
|
||||
locations.Add(location);
|
||||
}
|
||||
|
||||
long result = locations.Min();
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(result, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 1: {result}");
|
||||
}
|
||||
|
||||
|
||||
[TestCase(@"seeds: 79 14 55 13
|
||||
|
||||
seed-to-soil map:
|
||||
50 98 2
|
||||
52 50 48
|
||||
|
||||
soil-to-fertilizer map:
|
||||
0 15 37
|
||||
37 52 2
|
||||
39 0 15
|
||||
|
||||
fertilizer-to-water map:
|
||||
49 53 8
|
||||
0 11 42
|
||||
42 0 7
|
||||
57 7 4
|
||||
|
||||
water-to-light map:
|
||||
88 18 7
|
||||
18 25 70
|
||||
|
||||
light-to-temperature map:
|
||||
45 77 23
|
||||
81 45 19
|
||||
68 64 13
|
||||
|
||||
temperature-to-humidity map:
|
||||
0 69 1
|
||||
1 0 69
|
||||
|
||||
humidity-to-location map:
|
||||
60 56 37
|
||||
56 93 4", 46)]
|
||||
[TestCase(null, 63179500)] // The actual answer
|
||||
public void Part2(string? input, int? expected)
|
||||
{
|
||||
string[] lines = input != null ? input.Split("\n") : realData;
|
||||
Almanac almanac = new();
|
||||
|
||||
// Get the maps when we don't know what line number they occur on
|
||||
almanac.SeedToSoilMap = GetMap(lines, "seed-to-soil map:");
|
||||
almanac.SoilToFertiliserMap = GetMap(lines, "soil-to-fertilizer map:");
|
||||
almanac.FertiliserToWaterMap = GetMap(lines, "fertilizer-to-water map:");
|
||||
almanac.WaterToLightMap = GetMap(lines, "water-to-light map:");
|
||||
almanac.LightToTemperatureMap = GetMap(lines, "light-to-temperature map:");
|
||||
almanac.TemperatureToHumidityMap = GetMap(lines, "temperature-to-humidity map:");
|
||||
almanac.HumidityToLocationMap = GetMap(lines, "humidity-to-location map:");
|
||||
|
||||
long result = long.MaxValue;
|
||||
object lockObj = new();
|
||||
|
||||
List<long> values = lines[0].Split(": ")[1].Split(" ").Select(long.Parse).ToList();
|
||||
|
||||
Parallel.For(0, values.Count / 2, i =>
|
||||
{
|
||||
long startRange = values[i * 2];
|
||||
long rangeLength = values[i * 2 + 1];
|
||||
|
||||
for (long seed = startRange; seed < startRange + rangeLength; seed++)
|
||||
{
|
||||
// Get the soil, fertilizer, water, light, temperature, humidity, and location
|
||||
long soil = GetValueUsingMaps(almanac.SeedToSoilMap, seed);
|
||||
long fertiliser = GetValueUsingMaps(almanac.SoilToFertiliserMap, soil);
|
||||
long water = GetValueUsingMaps(almanac.FertiliserToWaterMap, fertiliser);
|
||||
long light = GetValueUsingMaps(almanac.WaterToLightMap, water);
|
||||
long temperature = GetValueUsingMaps(almanac.LightToTemperatureMap, light);
|
||||
long humidity = GetValueUsingMaps(almanac.TemperatureToHumidityMap, temperature);
|
||||
long location = GetValueUsingMaps(almanac.HumidityToLocationMap, humidity);
|
||||
|
||||
lock (lockObj)
|
||||
{
|
||||
if (location < result)
|
||||
{
|
||||
result = location;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(result, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 2: {result}");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
namespace AOC.Tests.Y2023;
|
||||
|
||||
[TestFixture]
|
||||
[Parallelizable(ParallelScope.All)]
|
||||
public class Day06
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
realData = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, "Y2023", "Data",
|
||||
$"{GetThisClassName()}.dat"));
|
||||
}
|
||||
|
||||
protected string GetThisClassName() { return GetType().Name; }
|
||||
private string[] realData;
|
||||
|
||||
[TestCase(@"Time: 7 15 30
|
||||
Distance: 9 40 200", 288)]
|
||||
[TestCase(null, 1660968)] // The actual answer
|
||||
public void Part1(string? input, int? expected)
|
||||
{
|
||||
string[] lines = input != null ? input.Split("\n") : realData;
|
||||
|
||||
List<int> times = lines[0].Split(" ").Where(s => int.TryParse(s, out _)).Select(int.Parse).ToList();
|
||||
List<int> distances = lines[1].Split(" ").Where(s => int.TryParse(s, out _)).Select(int.Parse).ToList();
|
||||
List<int> waysToBeatMaxDistance = new();
|
||||
// populate waysToBeatMaxDistance with 0s for the same list length as times
|
||||
for (int i = 0; i < times.Count; i++)
|
||||
{
|
||||
waysToBeatMaxDistance.Add(0);
|
||||
}
|
||||
|
||||
int startingSpeedInMilimetersPerSecond = 0;
|
||||
int amountToIncreaseSpeedPerSecondHoldingTheButtonInMilimetersPerSecond = 1;
|
||||
|
||||
// for each race, determine how many different ways you can beat the maximum distance
|
||||
for (int i = 0; i < times.Count; i++)
|
||||
{
|
||||
int raceTime = times[i];
|
||||
int distanceToBeat = distances[i];
|
||||
|
||||
for (int j = 1; j < raceTime; j++)
|
||||
{
|
||||
// Hold the button for j seconds
|
||||
int speed = startingSpeedInMilimetersPerSecond +
|
||||
amountToIncreaseSpeedPerSecondHoldingTheButtonInMilimetersPerSecond * j;
|
||||
|
||||
// Calculate the distance traveled
|
||||
int distanceTraveled = speed * (raceTime - j);
|
||||
|
||||
// If the distance traveled is greater than the distance to beat, update the count of ways to beat the max distance
|
||||
if (distanceTraveled > distanceToBeat)
|
||||
{
|
||||
Console.WriteLine(
|
||||
$"Can beat race {i} by holding the button for {j} seconds to travel {distanceTraveled}");
|
||||
waysToBeatMaxDistance[i] += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int result = 0;
|
||||
for (int i = 0; i < times.Count; i++)
|
||||
{
|
||||
if (result == 0)
|
||||
{
|
||||
result = waysToBeatMaxDistance[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
result *= waysToBeatMaxDistance[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(result, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 1: {result}");
|
||||
}
|
||||
|
||||
[TestCase(@"Time: 7 15 30
|
||||
Distance: 9 40 200", 71503)]
|
||||
[TestCase(null, 26499773)] // The actual answer
|
||||
public void Part2(string? input, int? expected)
|
||||
{
|
||||
string[] lines = input != null ? input.Split("\n") : realData;
|
||||
|
||||
string realTime = lines[0].Replace("Time:", "").Replace(" ", "");
|
||||
string realDistance = lines[1].Replace("Distance:", "").Replace(" ", "");
|
||||
|
||||
|
||||
List<long> times = new() { long.Parse(realTime) };
|
||||
List<long> distances = new() { long.Parse(realDistance) };
|
||||
List<int> waysToBeatMaxDistance = new();
|
||||
// populate waysToBeatMaxDistance with 0s for the same list length as times
|
||||
for (int i = 0; i < times.Count; i++)
|
||||
{
|
||||
waysToBeatMaxDistance.Add(0);
|
||||
}
|
||||
|
||||
int startingSpeedInMilimetersPerSecond = 0;
|
||||
int amountToIncreaseSpeedPerSecondHoldingTheButtonInMilimetersPerSecond = 1;
|
||||
|
||||
// for each race, determine how many different ways you can beat the maximum distance
|
||||
for (int i = 0; i < times.Count; i++)
|
||||
{
|
||||
long raceTime = times[i];
|
||||
long distanceToBeat = distances[i];
|
||||
|
||||
for (long j = 1; j < raceTime; j++)
|
||||
{
|
||||
// Hold the button for j seconds
|
||||
long speed = startingSpeedInMilimetersPerSecond +
|
||||
amountToIncreaseSpeedPerSecondHoldingTheButtonInMilimetersPerSecond * j;
|
||||
|
||||
// Calculate the distance traveled
|
||||
long distanceTraveled = speed * (raceTime - j);
|
||||
|
||||
// If the distance traveled is greater than the distance to beat, update the count of ways to beat the max distance
|
||||
if (distanceTraveled > distanceToBeat)
|
||||
{
|
||||
// Console.WriteLine($"Can beat race {i} by holding the button for {j} seconds to travel {distanceTraveled}");
|
||||
waysToBeatMaxDistance[i] += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
long result = 0;
|
||||
for (int i = 0; i < times.Count; i++)
|
||||
{
|
||||
if (result == 0)
|
||||
{
|
||||
result = waysToBeatMaxDistance[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
result *= waysToBeatMaxDistance[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(result, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 2: {result}");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,390 @@
|
||||
namespace AOC.Tests.Y2023;
|
||||
|
||||
[TestFixture]
|
||||
[Parallelizable(ParallelScope.All)]
|
||||
public class Day07
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
realData = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, "Y2023", "Data",
|
||||
$"{GetThisClassName()}.dat"));
|
||||
}
|
||||
|
||||
protected string GetThisClassName() { return GetType().Name; }
|
||||
private string[] realData;
|
||||
|
||||
[TestCase(@"32T3K 765
|
||||
T55J5 684
|
||||
KK677 28
|
||||
KTJJT 220
|
||||
QQQJA 483", 6440)]
|
||||
[TestCase(null, 247815719)] // The actual answer
|
||||
public void Part1(string? input, int? expected)
|
||||
{
|
||||
string[] lines = input != null ? input.Split("\n") : realData;
|
||||
|
||||
List<Hand> hands = new();
|
||||
|
||||
foreach (string line in lines)
|
||||
{
|
||||
string[] parts = line.Split(" ");
|
||||
string cards = parts[0];
|
||||
int bid = int.Parse(parts[1]);
|
||||
|
||||
Hand hand = new(cards, bid);
|
||||
hands.Add(hand);
|
||||
}
|
||||
|
||||
ParallelMergeSort.Sort(hands);
|
||||
|
||||
int totalWinnings = 0;
|
||||
int rank = 1;
|
||||
|
||||
foreach (Hand hand in hands)
|
||||
{
|
||||
int handWinnings = hand.Bid * rank;
|
||||
totalWinnings += handWinnings;
|
||||
|
||||
// Console.WriteLine($"Hand: {hand.Cards}, Rank: {rank}, Winnings: {handWinnings}");
|
||||
|
||||
rank++;
|
||||
}
|
||||
|
||||
int result = totalWinnings;
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(result, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 1: {result}");
|
||||
}
|
||||
|
||||
[TestCase(@"32T3K 765
|
||||
T55J5 684
|
||||
KK677 28
|
||||
KTJJT 220
|
||||
QQQJA 483", 5905)]
|
||||
[TestCase(@"2345A 1
|
||||
Q2KJJ 13
|
||||
Q2Q2Q 19
|
||||
T3T3J 17
|
||||
T3Q33 11
|
||||
2345J 3
|
||||
J345A 2
|
||||
32T3K 5
|
||||
T55J5 29
|
||||
KK677 7
|
||||
KTJJT 34
|
||||
QQQJA 31
|
||||
JJJJJ 37
|
||||
JAAAA 43
|
||||
AAAAJ 59
|
||||
AAAAA 61
|
||||
2AAAA 23
|
||||
2JJJJ 53
|
||||
JJJJ2 41", 6839)]
|
||||
[TestCase(null, 248747492)] // The actual answer
|
||||
public void Part2(string? input, int? expected)
|
||||
{
|
||||
string[] lines = input != null ? input.Split("\n") : realData;
|
||||
|
||||
List<Hand> hands = new();
|
||||
|
||||
foreach (string line in lines)
|
||||
{
|
||||
string[] parts = line.Split(" ");
|
||||
string cards = parts[0];
|
||||
int bid = int.Parse(parts[1]);
|
||||
|
||||
Hand hand = new(cards, bid, true);
|
||||
hands.Add(hand);
|
||||
}
|
||||
|
||||
ParallelMergeSort.Sort(hands);
|
||||
|
||||
int totalWinnings = 0;
|
||||
int rank = 1;
|
||||
|
||||
foreach (Hand hand in hands)
|
||||
{
|
||||
int handWinnings = hand.Bid * rank;
|
||||
totalWinnings += handWinnings;
|
||||
|
||||
Console.WriteLine(
|
||||
$"Hand: {hand.Cards}, Type: {hand.Type.ToString()}, Rank: {rank}, Winnings: {handWinnings}");
|
||||
|
||||
rank++;
|
||||
}
|
||||
|
||||
int result = totalWinnings;
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(result, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 2: {result}");
|
||||
}
|
||||
}
|
||||
|
||||
public enum HandType
|
||||
{
|
||||
HighCard,
|
||||
OnePair,
|
||||
TwoPair,
|
||||
ThreeOfAKind,
|
||||
FullHouse,
|
||||
FourOfAKind,
|
||||
FiveOfAKind
|
||||
}
|
||||
|
||||
public class Hand : IComparable<Hand>
|
||||
{
|
||||
private readonly bool _useJokerLogic;
|
||||
|
||||
public Hand(string cards, int bid, bool useJokerLogic = false)
|
||||
{
|
||||
_useJokerLogic = useJokerLogic;
|
||||
Cards = cards;
|
||||
Bid = bid;
|
||||
DetermineHandType();
|
||||
}
|
||||
|
||||
public string Cards { get; }
|
||||
public int Bid { get; }
|
||||
public HandType Type { get; set; }
|
||||
|
||||
public int CompareTo(Hand other)
|
||||
{
|
||||
// First compare based on hand type
|
||||
if (Type != other.Type)
|
||||
{
|
||||
return Type.CompareTo(other.Type);
|
||||
}
|
||||
|
||||
// If types are the same, then compare based on individual card strength
|
||||
// Convert card labels to a list of integers for easier comparison
|
||||
List<int> thisCardStrengths = ConvertToCardStrengths(Cards, _useJokerLogic);
|
||||
List<int> otherCardStrengths = ConvertToCardStrengths(other.Cards, _useJokerLogic);
|
||||
|
||||
for (int i = 0; i < thisCardStrengths.Count; i++)
|
||||
{
|
||||
if (thisCardStrengths[i] != otherCardStrengths[i])
|
||||
{
|
||||
return thisCardStrengths[i].CompareTo(otherCardStrengths[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// If all cards are the same, the hands are equal
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void DetermineHandType()
|
||||
{
|
||||
// Count occurrences of each card
|
||||
Dictionary<char, int> cardCounts = new();
|
||||
int jokers = 0;
|
||||
|
||||
foreach (char card in Cards)
|
||||
{
|
||||
if (_useJokerLogic && card == 'J')
|
||||
{
|
||||
jokers++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (cardCounts.ContainsKey(card))
|
||||
{
|
||||
cardCounts[card]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
cardCounts.Add(card, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (_useJokerLogic && jokers > 0)
|
||||
{
|
||||
ApplyJokerLogic(cardCounts, jokers);
|
||||
}
|
||||
else
|
||||
{
|
||||
DetermineStandardHandType(cardCounts);
|
||||
}
|
||||
}
|
||||
|
||||
private void ApplyJokerLogic(Dictionary<char, int> cardCounts, int jokers)
|
||||
{
|
||||
// Get the maximum amount of any single card in the hand
|
||||
int maxCount = cardCounts.Any() ? cardCounts.Max(c => c.Value) : 0;
|
||||
|
||||
// FiveOfAKind
|
||||
if (maxCount == 5 || maxCount + jokers == 5)
|
||||
{
|
||||
Type = HandType.FiveOfAKind;
|
||||
return;
|
||||
}
|
||||
|
||||
// FourOfAKind
|
||||
if (maxCount == 4 || maxCount + jokers == 4)
|
||||
{
|
||||
Type = HandType.FourOfAKind;
|
||||
return;
|
||||
}
|
||||
|
||||
// FullHouse
|
||||
// if there are 3 of one card and 2 of another
|
||||
// or if there are three of one card and one joker
|
||||
// or if there are two of one card and two jokers
|
||||
if (
|
||||
(cardCounts.Any(c => c.Value == 3) && cardCounts.Any(c => c.Value == 2))
|
||||
|| (cardCounts.Any(c => c.Value == 3) && jokers == 1)
|
||||
|| (cardCounts.Any(c => c.Value == 2) && jokers == 2)
|
||||
|| (cardCounts.Count(c => c.Value == 2) == 2 && jokers == 1)
|
||||
)
|
||||
{
|
||||
Type = HandType.FullHouse;
|
||||
return;
|
||||
}
|
||||
|
||||
// ThreeOfAKind
|
||||
// if there are three of one card
|
||||
// or if there are two of one card and one joker
|
||||
// or if there are two jokers
|
||||
if (cardCounts.Any(c => c.Value == 3)
|
||||
|| (cardCounts.Any(c => c.Value == 2) && jokers == 1)
|
||||
|| jokers == 2)
|
||||
{
|
||||
Type = HandType.ThreeOfAKind;
|
||||
return;
|
||||
}
|
||||
|
||||
// TwoPair
|
||||
// if there are two of two cards
|
||||
// or if there is two of one card and two jokers
|
||||
// or if there are three jokers
|
||||
if (cardCounts.Count(c => c.Value == 2) == 2
|
||||
|| (cardCounts.Any(c => c.Value == 2) && jokers == 1)
|
||||
|| jokers == 3)
|
||||
{
|
||||
Type = HandType.TwoPair;
|
||||
return;
|
||||
}
|
||||
|
||||
// OnePair
|
||||
// if there is two of one card
|
||||
// or if there is one joker
|
||||
if (cardCounts.Count(c => c.Value == 2) == 2 || jokers == 1)
|
||||
{
|
||||
Type = HandType.OnePair;
|
||||
return;
|
||||
}
|
||||
|
||||
// HighCard
|
||||
// If no other hand can be formed, use a high card
|
||||
Type = HandType.HighCard;
|
||||
}
|
||||
|
||||
private void DetermineStandardHandType(Dictionary<char, int> cardCounts)
|
||||
{
|
||||
// Sort counts to help identify patterns like full house or two pairs
|
||||
List<int> sortedCounts = cardCounts.Values.OrderByDescending(count => count).ToList();
|
||||
|
||||
Type = sortedCounts[0] switch
|
||||
{
|
||||
// Determine hand type based on the sorted counts
|
||||
5 => HandType.FiveOfAKind,
|
||||
4 => HandType.FourOfAKind,
|
||||
3 when sortedCounts[1] == 2 => HandType.FullHouse,
|
||||
3 => HandType.ThreeOfAKind,
|
||||
2 when sortedCounts[1] == 2 => HandType.TwoPair,
|
||||
2 => HandType.OnePair,
|
||||
_ => HandType.HighCard
|
||||
};
|
||||
}
|
||||
|
||||
private static List<int> ConvertToCardStrengths(string cards, bool useJokerLogic)
|
||||
{
|
||||
Dictionary<char, int> cardStrength = new()
|
||||
{
|
||||
{ 'A', 14 },
|
||||
{ 'K', 13 },
|
||||
{ 'Q', 12 },
|
||||
{ 'T', 10 },
|
||||
{ '9', 9 },
|
||||
{ '8', 8 },
|
||||
{ '7', 7 },
|
||||
{ '6', 6 },
|
||||
{ '5', 5 },
|
||||
{ '4', 4 },
|
||||
{ '3', 3 },
|
||||
{ '2', 2 },
|
||||
{ 'J', useJokerLogic ? 1 : 11 } // 'J' is weakest if joker logic is enabled
|
||||
};
|
||||
|
||||
return cards.Select(c => cardStrength[c]).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public static class ParallelMergeSort
|
||||
{
|
||||
private const int Threshold = 100;
|
||||
|
||||
public static void Sort(List<Hand> hands)
|
||||
{
|
||||
if (hands.Count <= 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int mid = hands.Count / 2;
|
||||
List<Hand> left = new(hands.GetRange(0, mid));
|
||||
List<Hand> right = new(hands.GetRange(mid, hands.Count - mid));
|
||||
|
||||
if (hands.Count <= Threshold)
|
||||
{
|
||||
// Sequential sort for small lists
|
||||
Sort(left);
|
||||
Sort(right);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Sort in parallel for large lists
|
||||
Task[] tasks = new Task[2];
|
||||
tasks[0] = Task.Factory.StartNew(() => Sort(left));
|
||||
tasks[1] = Task.Factory.StartNew(() => Sort(right));
|
||||
Task.WaitAll(tasks);
|
||||
}
|
||||
|
||||
Merge(hands, left, right);
|
||||
}
|
||||
|
||||
private static void Merge(List<Hand> hands, List<Hand> left, List<Hand> right)
|
||||
{
|
||||
int i = 0, j = 0, k = 0;
|
||||
|
||||
while (i < left.Count && j < right.Count)
|
||||
{
|
||||
if (left[i].CompareTo(right[j]) <= 0)
|
||||
{
|
||||
hands[k++] = left[i++];
|
||||
}
|
||||
else
|
||||
{
|
||||
hands[k++] = right[j++];
|
||||
}
|
||||
}
|
||||
|
||||
while (i < left.Count)
|
||||
{
|
||||
hands[k++] = left[i++];
|
||||
}
|
||||
|
||||
while (j < right.Count)
|
||||
{
|
||||
hands[k++] = right[j++];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
namespace AOC.Tests.Y2023;
|
||||
|
||||
[TestFixture]
|
||||
[Parallelizable(ParallelScope.All)]
|
||||
public class Day08
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
realData = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, "Y2023", "Data",
|
||||
$"{GetThisClassName()}.dat"));
|
||||
}
|
||||
|
||||
protected string GetThisClassName() { return GetType().Name; }
|
||||
private string[] realData;
|
||||
|
||||
[TestCase(@"RL
|
||||
|
||||
AAA = (BBB, CCC)
|
||||
BBB = (DDD, EEE)
|
||||
CCC = (ZZZ, GGG)
|
||||
DDD = (DDD, DDD)
|
||||
EEE = (EEE, EEE)
|
||||
GGG = (GGG, GGG)
|
||||
ZZZ = (ZZZ, ZZZ)", 2)]
|
||||
[TestCase(@"LLR
|
||||
|
||||
AAA = (BBB, BBB)
|
||||
BBB = (AAA, ZZZ)
|
||||
ZZZ = (ZZZ, ZZZ)", 6)]
|
||||
[TestCase(null, 19199)] // The actual answer
|
||||
public void Part1(string? input, int? expected)
|
||||
{
|
||||
string[] lines = input != null ? input.Split("\n") : realData;
|
||||
|
||||
// The first line is a looping list of instructions
|
||||
List<char> instructions = lines[0].ToCharArray().ToList();
|
||||
|
||||
// Every other line (except the second blank line) takes the form "AAA = (BBB, CCC)" where AAA, BBB, and CCC are all strings representing locations, AAA is the current location, and BBB and CCC are the two possible next locations, BBB if the user moves L and CCC if the user moves R
|
||||
Dictionary<string, (string, string)> locations = new();
|
||||
foreach (string line in lines.Skip(2))
|
||||
{
|
||||
string[] parts = line.Split(" = ");
|
||||
Console.WriteLine($"{parts[0]}, {parts[1]}");
|
||||
string location = parts[0];
|
||||
string[] nextLocations = parts[1].Trim('(', ')').Split(", ");
|
||||
locations.Add(location, (nextLocations[0], nextLocations[1]));
|
||||
}
|
||||
|
||||
// The user starts at the first location and follows the instructions, looping until they reach location ZZZ
|
||||
string currentLocation = "AAA";
|
||||
int instructionIndex = 0;
|
||||
int stepsCounter = 0;
|
||||
while (currentLocation != "ZZZ")
|
||||
{
|
||||
char instruction = instructions[instructionIndex];
|
||||
(string left, string right) = locations[currentLocation];
|
||||
currentLocation = instruction switch
|
||||
{
|
||||
'L' => left,
|
||||
'R' => right,
|
||||
_ => throw new Exception($"Unknown instruction: {instruction}")
|
||||
};
|
||||
|
||||
// If we are already at the last instructionIndex, start again from 0, otherwise move to the next index
|
||||
instructionIndex = instructionIndex == instructions.Count - 1 ? 0 : instructionIndex + 1;
|
||||
|
||||
stepsCounter++;
|
||||
}
|
||||
|
||||
int result = stepsCounter;
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(result, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 1: {result}");
|
||||
}
|
||||
|
||||
[TestCase(@"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)", 6)]
|
||||
[TestCase(null, 1783)] // The actual answer
|
||||
public async Task Part2(string? input, int? expected)
|
||||
{
|
||||
string[] lines = input != null ? input.Split("\n") : realData;
|
||||
|
||||
// The first line is a looping list of instructions
|
||||
List<char> instructions = lines[0].ToCharArray().ToList();
|
||||
|
||||
// Every other line (except the second blank line) takes the form "11A = (11B, XXX)" where A11A, 11B, and XXX are all strings representing locations, 11A is the current location, and 11B and XXX are the two possible next locations, 11B if the user moves L and XXX if the user moves R
|
||||
Dictionary<string, (string, string)> locations = new();
|
||||
foreach (string line in lines.Skip(2))
|
||||
{
|
||||
string[] parts = line.Split(" = ");
|
||||
string location = parts[0];
|
||||
string[] nextLocations = parts[1].Trim('(', ')').Split(", ");
|
||||
locations.Add(location, (nextLocations[0], nextLocations[1]));
|
||||
}
|
||||
|
||||
// The user simultaneously starts at all locations that end with "A" and follow all of the paths at the same time until they all simultaneously end up at nodes that end with "Z"
|
||||
List<string> currentLocations = locations.Keys.Where(k => k.EndsWith("A")).ToList();
|
||||
|
||||
// Print out all the starting locations from the currentLocations list as a single string comma separated
|
||||
Console.WriteLine($"Starting locations: {string.Join(", ", currentLocations)}");
|
||||
|
||||
int instructionIndex = 0;
|
||||
int stepsCounter = 0;
|
||||
while (currentLocations.Any(l => !l.EndsWith("Z")))
|
||||
{
|
||||
// Sort in parallel for large lists
|
||||
Task[] tasks = new Task[currentLocations.Count];
|
||||
|
||||
// For each location, follow the instruction
|
||||
for (int i = 0; i < currentLocations.Count; i++)
|
||||
{
|
||||
int localI = i; // Local copy of the loop variable
|
||||
char instruction = instructions[instructionIndex];
|
||||
tasks[localI] = Task.Factory.StartNew(() =>
|
||||
{
|
||||
(string left, string right) = locations[currentLocations[localI]];
|
||||
string newLocation = instruction switch
|
||||
{
|
||||
'L' => left,
|
||||
'R' => right,
|
||||
_ => throw new Exception($"Unknown instruction: {instruction}")
|
||||
};
|
||||
|
||||
// Commented out due to ballooning memory
|
||||
// Console.WriteLine($"Moved {instruction} from {currentLocations[localI]} to {newLocation}");
|
||||
|
||||
// Update the current location
|
||||
currentLocations[localI] = newLocation;
|
||||
});
|
||||
}
|
||||
|
||||
await Task.WhenAll(tasks);
|
||||
|
||||
// If we are already at the last instructionIndex, start again from 0, otherwise move to the next index
|
||||
instructionIndex = instructionIndex == instructions.Count - 1 ? 0 : instructionIndex + 1;
|
||||
|
||||
stepsCounter++;
|
||||
}
|
||||
|
||||
int result = stepsCounter;
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(result, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 2: {result}");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
--- Day 1: Trebuchet?! ---
|
||||
Something is wrong with global snow production, and you've been selected to take a look. The Elves have even given you a map; on it, they've used stars to mark the top fifty locations that are likely to be having problems.
|
||||
|
||||
You've been doing this long enough to know that to restore snow operations, you need to check all fifty stars by December 25th.
|
||||
|
||||
Collect stars by solving puzzles. Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants one star. Good luck!
|
||||
|
||||
You try to ask why they can't just use a weather machine ("not powerful enough") and where they're even sending you ("the sky") and why your map looks mostly blank ("you sure ask a lot of questions") and hang on did you just say the sky ("of course, where do you think snow comes from") when you realize that the Elves are already loading you into a trebuchet ("please hold still, we need to strap you in").
|
||||
|
||||
As they're making the final adjustments, they discover that their calibration document (your puzzle input) has been amended by a very young Elf who was apparently just excited to show off her art skills. Consequently, the Elves are having trouble reading the values on the document.
|
||||
|
||||
The newly-improved calibration document consists of lines of text; each line originally contained a specific calibration value that the Elves now need to recover. On each line, the calibration value can be found by combining the first digit and the last digit (in that order) to form a single two-digit number.
|
||||
|
||||
For example:
|
||||
|
||||
1abc2
|
||||
pqr3stu8vwx
|
||||
a1b2c3d4e5f
|
||||
treb7uchet
|
||||
In this example, the calibration values of these four lines are 12, 38, 15, and 77. Adding these together produces 142.
|
||||
|
||||
Consider your entire calibration document. What is the sum of all of the calibration values?
|
||||
|
||||
--- Part Two ---
|
||||
Your calculation isn't quite right. It looks like some of the digits are actually spelled out with letters: one, two, three, four, five, six, seven, eight, and nine also count as valid "digits".
|
||||
|
||||
Equipped with this new information, you now need to find the real first and last digit on each line. For example:
|
||||
|
||||
two1nine
|
||||
eightwothree
|
||||
abcone2threexyz
|
||||
xtwone3four
|
||||
4nineeightseven2
|
||||
zoneight234
|
||||
7pqrstsixteen
|
||||
In this example, the calibration values are 29, 83, 13, 24, 42, 14, and 76. Adding these together produces 281.
|
||||
|
||||
What is the sum of all of the calibration values?
|
||||
@@ -0,0 +1,46 @@
|
||||
--- Day 2: Cube Conundrum ---
|
||||
You're launched high into the atmosphere! The apex of your trajectory just barely reaches the surface of a large island floating in the sky. You gently land in a fluffy pile of leaves. It's quite cold, but you don't see much snow. An Elf runs over to greet you.
|
||||
|
||||
The Elf explains that you've arrived at Snow Island and apologizes for the lack of snow. He'll be happy to explain the situation, but it's a bit of a walk, so you have some time. They don't get many visitors up here; would you like to play a game in the meantime?
|
||||
|
||||
As you walk, the Elf shows you a small bag and some cubes which are either red, green, or blue. Each time you play this game, he will hide a secret number of cubes of each color in the bag, and your goal is to figure out information about the number of cubes.
|
||||
|
||||
To get information, once a bag has been loaded with cubes, the Elf will reach into the bag, grab a handful of random cubes, show them to you, and then put them back in the bag. He'll do this a few times per game.
|
||||
|
||||
You play several games and record the information from each game (your puzzle input). Each game is listed with its ID number (like the 11 in Game 11: ...) followed by a semicolon-separated list of subsets of cubes that were revealed from the bag (like 3 red, 5 green, 4 blue).
|
||||
|
||||
For example, the record of a few games might look like this:
|
||||
|
||||
Game 1: 3 blue, 4 red; 1 red, 2 green, 6 blue; 2 green
|
||||
Game 2: 1 blue, 2 green; 3 green, 4 blue, 1 red; 1 green, 1 blue
|
||||
Game 3: 8 green, 6 blue, 20 red; 5 blue, 4 red, 13 green; 5 green, 1 red
|
||||
Game 4: 1 green, 3 red, 6 blue; 3 green, 6 red; 3 green, 15 blue, 14 red
|
||||
Game 5: 6 red, 1 blue, 3 green; 2 blue, 1 red, 2 green
|
||||
In game 1, three sets of cubes are revealed from the bag (and then put back again). The first set is 3 blue cubes and 4 red cubes; the second set is 1 red cube, 2 green cubes, and 6 blue cubes; the third set is only 2 green cubes.
|
||||
|
||||
The Elf would first like to know which games would have been possible if the bag contained only 12 red cubes, 13 green cubes, and 14 blue cubes?
|
||||
|
||||
In the example above, games 1, 2, and 5 would have been possible if the bag had been loaded with that configuration. However, game 3 would have been impossible because at one point the Elf showed you 20 red cubes at once; similarly, game 4 would also have been impossible because the Elf showed you 15 blue cubes at once. If you add up the IDs of the games that would have been possible, you get 8.
|
||||
|
||||
Determine which games would have been possible if the bag had been loaded with only 12 red cubes, 13 green cubes, and 14 blue cubes. What is the sum of the IDs of those games?
|
||||
|
||||
--- Part Two ---
|
||||
The Elf says they've stopped producing snow because they aren't getting any water! He isn't sure why the water stopped; however, he can show you how to get to the water source to check it out for yourself. It's just up ahead!
|
||||
|
||||
As you continue your walk, the Elf poses a second question: in each game you played, what is the fewest number of cubes of each color that could have been in the bag to make the game possible?
|
||||
|
||||
Again consider the example games from earlier:
|
||||
|
||||
Game 1: 3 blue, 4 red; 1 red, 2 green, 6 blue; 2 green
|
||||
Game 2: 1 blue, 2 green; 3 green, 4 blue, 1 red; 1 green, 1 blue
|
||||
Game 3: 8 green, 6 blue, 20 red; 5 blue, 4 red, 13 green; 5 green, 1 red
|
||||
Game 4: 1 green, 3 red, 6 blue; 3 green, 6 red; 3 green, 15 blue, 14 red
|
||||
Game 5: 6 red, 1 blue, 3 green; 2 blue, 1 red, 2 green
|
||||
In game 1, the game could have been played with as few as 4 red, 2 green, and 6 blue cubes. If any color had even one fewer cube, the game would have been impossible.
|
||||
Game 2 could have been played with a minimum of 1 red, 3 green, and 4 blue cubes.
|
||||
Game 3 must have been played with at least 20 red, 13 green, and 6 blue cubes.
|
||||
Game 4 required at least 14 red, 3 green, and 15 blue cubes.
|
||||
Game 5 needed no fewer than 6 red, 3 green, and 2 blue cubes in the bag.
|
||||
The power of a set of cubes is equal to the numbers of red, green, and blue cubes multiplied together. The power of the minimum set of cubes in game 1 is 48. In games 2-5 it was 12, 1560, 630, and 36, respectively. Adding up these five powers produces the sum 2286.
|
||||
|
||||
For each game, find the minimum set of cubes that must have been present. What is the sum of the power of these sets?
|
||||
@@ -0,0 +1,55 @@
|
||||
--- Day 3: Gear Ratios ---
|
||||
You and the Elf eventually reach a gondola lift station; he says the gondola lift will take you up to the water source, but this is as far as he can bring you. You go inside.
|
||||
|
||||
It doesn't take long to find the gondolas, but there seems to be a problem: they're not moving.
|
||||
|
||||
"Aaah!"
|
||||
|
||||
You turn around to see a slightly-greasy Elf with a wrench and a look of surprise. "Sorry, I wasn't expecting anyone! The gondola lift isn't working right now; it'll still be a while before I can fix it." You offer to help.
|
||||
|
||||
The engineer explains that an engine part seems to be missing from the engine, but nobody can figure out which one. If you can add up all the part numbers in the engine schematic, it should be easy to work out which part is missing.
|
||||
|
||||
The engine schematic (your puzzle input) consists of a visual representation of the engine. There are lots of numbers and symbols you don't really understand, but apparently any number adjacent to a symbol, even diagonally, is a "part number" and should be included in your sum. (Periods (.) do not count as a symbol.)
|
||||
|
||||
Here is an example engine schematic:
|
||||
|
||||
467..114..
|
||||
...*......
|
||||
..35..633.
|
||||
......#...
|
||||
617*......
|
||||
.....+.58.
|
||||
..592.....
|
||||
......755.
|
||||
...$.*....
|
||||
.664.598..
|
||||
In this schematic, two numbers are not part numbers because they are not adjacent to a symbol: 114 (top right) and 58 (middle right). Every other number is adjacent to a symbol and so is a part number; their sum is 4361.
|
||||
|
||||
Of course, the actual engine schematic is much larger. What is the sum of all of the part numbers in the engine schematic?
|
||||
|
||||
--- Part Two ---
|
||||
The engineer finds the missing part and installs it in the engine! As the engine springs to life, you jump in the closest gondola, finally ready to ascend to the water source.
|
||||
|
||||
You don't seem to be going very fast, though. Maybe something is still wrong? Fortunately, the gondola has a phone labeled "help", so you pick it up and the engineer answers.
|
||||
|
||||
Before you can explain the situation, she suggests that you look out the window. There stands the engineer, holding a phone in one hand and waving with the other. You're going so slowly that you haven't even left the station. You exit the gondola.
|
||||
|
||||
The missing part wasn't the only issue - one of the gears in the engine is wrong. A gear is any * symbol that is adjacent to exactly two part numbers. Its gear ratio is the result of multiplying those two numbers together.
|
||||
|
||||
This time, you need to find the gear ratio of every gear and add them all up so that the engineer can figure out which gear needs to be replaced.
|
||||
|
||||
Consider the same engine schematic again:
|
||||
|
||||
467..114..
|
||||
...*......
|
||||
..35..633.
|
||||
......#...
|
||||
617*......
|
||||
.....+.58.
|
||||
..592.....
|
||||
......755.
|
||||
...$.*....
|
||||
.664.598..
|
||||
In this schematic, there are two gears. The first is in the top left; it has part numbers 467 and 35, so its gear ratio is 16345. The second gear is in the lower right; its gear ratio is 451490. (The * adjacent to 617 is not a gear because it is only adjacent to one part number.) Adding up all of the gear ratios produces 467835.
|
||||
|
||||
What is the sum of all of the gear ratios in your engine schematic?
|
||||
@@ -0,0 +1,62 @@
|
||||
--- Day 4: Scratchcards ---
|
||||
The gondola takes you up. Strangely, though, the ground doesn't seem to be coming with you; you're not climbing a mountain. As the circle of Snow Island recedes below you, an entire new landmass suddenly appears above you! The gondola carries you to the surface of the new island and lurches into the station.
|
||||
|
||||
As you exit the gondola, the first thing you notice is that the air here is much warmer than it was on Snow Island. It's also quite humid. Is this where the water source is?
|
||||
|
||||
The next thing you notice is an Elf sitting on the floor across the station in what seems to be a pile of colorful square cards.
|
||||
|
||||
"Oh! Hello!" The Elf excitedly runs over to you. "How may I be of service?" You ask about water sources.
|
||||
|
||||
"I'm not sure; I just operate the gondola lift. That does sound like something we'd have, though - this is Island Island, after all! I bet the gardener would know. He's on a different island, though - er, the small kind surrounded by water, not the floating kind. We really need to come up with a better naming scheme. Tell you what: if you can help me with something quick, I'll let you borrow my boat and you can go visit the gardener. I got all these scratchcards as a gift, but I can't figure out what I've won."
|
||||
|
||||
The Elf leads you over to the pile of colorful cards. There, you discover dozens of scratchcards, all with their opaque covering already scratched off. Picking one up, it looks like each card has two lists of numbers separated by a vertical bar (|): a list of winning numbers and then a list of numbers you have. You organize the information into a table (your puzzle input).
|
||||
|
||||
As far as the Elf has been able to figure out, you have to figure out which of the numbers you have appear in the list of winning numbers. The first match makes the card worth one point and each match after the first doubles the point value of that card.
|
||||
|
||||
For example:
|
||||
|
||||
Card 1: 41 48 83 86 17 | 83 86 6 31 17 9 48 53
|
||||
Card 2: 13 32 20 16 61 | 61 30 68 82 17 32 24 19
|
||||
Card 3: 1 21 53 59 44 | 69 82 63 72 16 21 14 1
|
||||
Card 4: 41 92 73 84 69 | 59 84 76 51 58 5 54 83
|
||||
Card 5: 87 83 26 28 32 | 88 30 70 12 93 22 82 36
|
||||
Card 6: 31 18 13 56 72 | 74 77 10 23 35 67 36 11
|
||||
In the above example, card 1 has five winning numbers (41, 48, 83, 86, and 17) and eight numbers you have (83, 86, 6, 31, 17, 9, 48, and 53). Of the numbers you have, four of them (48, 83, 17, and 86) are winning numbers! That means card 1 is worth 8 points (1 for the first match, then doubled three times for each of the three matches after the first).
|
||||
|
||||
Card 2 has two winning numbers (32 and 61), so it is worth 2 points.
|
||||
Card 3 has two winning numbers (1 and 21), so it is worth 2 points.
|
||||
Card 4 has one winning number (84), so it is worth 1 point.
|
||||
Card 5 has no winning numbers, so it is worth no points.
|
||||
Card 6 has no winning numbers, so it is worth no points.
|
||||
So, in this example, the Elf's pile of scratchcards is worth 13 points.
|
||||
|
||||
Take a seat in the large pile of colorful cards. How many points are they worth in total?
|
||||
|
||||
--- Part Two ---
|
||||
Just as you're about to report your findings to the Elf, one of you realizes that the rules have actually been printed on the back of every card this whole time.
|
||||
|
||||
There's no such thing as "points". Instead, scratchcards only cause you to win more scratchcards equal to the number of winning numbers you have.
|
||||
|
||||
Specifically, you win copies of the scratchcards below the winning card equal to the number of matches. So, if card 10 were to have 5 matching numbers, you would win one copy each of cards 11, 12, 13, 14, and 15.
|
||||
|
||||
Copies of scratchcards are scored like normal scratchcards and have the same card number as the card they copied. So, if you win a copy of card 10 and it has 5 matching numbers, it would then win a copy of the same cards that the original card 10 won: cards 11, 12, 13, 14, and 15. This process repeats until none of the copies cause you to win any more cards. (Cards will never make you copy a card past the end of the table.)
|
||||
|
||||
This time, the above example goes differently:
|
||||
|
||||
Card 1: 41 48 83 86 17 | 83 86 6 31 17 9 48 53
|
||||
Card 2: 13 32 20 16 61 | 61 30 68 82 17 32 24 19
|
||||
Card 3: 1 21 53 59 44 | 69 82 63 72 16 21 14 1
|
||||
Card 4: 41 92 73 84 69 | 59 84 76 51 58 5 54 83
|
||||
Card 5: 87 83 26 28 32 | 88 30 70 12 93 22 82 36
|
||||
Card 6: 31 18 13 56 72 | 74 77 10 23 35 67 36 11
|
||||
Card 1 has four matching numbers, so you win one copy each of the next four cards: cards 2, 3, 4, and 5.
|
||||
Your original card 2 has two matching numbers, so you win one copy each of cards 3 and 4.
|
||||
Your copy of card 2 also wins one copy each of cards 3 and 4.
|
||||
Your four instances of card 3 (one original and three copies) have two matching numbers, so you win four copies each of cards 4 and 5.
|
||||
Your eight instances of card 4 (one original and seven copies) have one matching number, so you win eight copies of card 5.
|
||||
Your fourteen instances of card 5 (one original and thirteen copies) have no matching numbers and win no more cards.
|
||||
Your one instance of card 6 (one original) has no matching numbers and wins no more cards.
|
||||
Once all of the originals and copies have been processed, you end up with 1 instance of card 1, 2 instances of card 2, 4 instances of card 3, 8 instances of card 4, 14 instances of card 5, and 1 instance of card 6. In total, this example pile of scratchcards causes you to ultimately have 30 scratchcards!
|
||||
|
||||
Process all of the original and copied scratchcards until no more scratchcards are won. Including the original set of scratchcards, how many total scratchcards do you end up with?
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
--- Day 5: If You Give A Seed A Fertilizer ---
|
||||
You take the boat and find the gardener right where you were told he would be: managing a giant "garden" that looks more to you like a farm.
|
||||
|
||||
"A water source? Island Island is the water source!" You point out that Snow Island isn't receiving any water.
|
||||
|
||||
"Oh, we had to stop the water because we ran out of sand to filter it with! Can't make snow with dirty water. Don't worry, I'm sure we'll get more sand soon; we only turned off the water a few days... weeks... oh no." His face sinks into a look of horrified realization.
|
||||
|
||||
"I've been so busy making sure everyone here has food that I completely forgot to check why we stopped getting more sand! There's a ferry leaving soon that is headed over in that direction - it's much faster than your boat. Could you please go check it out?"
|
||||
|
||||
You barely have time to agree to this request when he brings up another. "While you wait for the ferry, maybe you can help us with our food production problem. The latest Island Island Almanac just arrived and we're having trouble making sense of it."
|
||||
|
||||
The almanac (your puzzle input) lists all of the seeds that need to be planted. It also lists what type of soil to use with each kind of seed, what type of fertilizer to use with each kind of soil, what type of water to use with each kind of fertilizer, and so on. Every type of seed, soil, fertilizer and so on is identified with a number, but numbers are reused by each category - that is, soil 123 and fertilizer 123 aren't necessarily related to each other.
|
||||
|
||||
For example:
|
||||
|
||||
seeds: 79 14 55 13
|
||||
|
||||
seed-to-soil map:
|
||||
50 98 2
|
||||
52 50 48
|
||||
|
||||
soil-to-fertilizer map:
|
||||
0 15 37
|
||||
37 52 2
|
||||
39 0 15
|
||||
|
||||
fertilizer-to-water map:
|
||||
49 53 8
|
||||
0 11 42
|
||||
42 0 7
|
||||
57 7 4
|
||||
|
||||
water-to-light map:
|
||||
88 18 7
|
||||
18 25 70
|
||||
|
||||
light-to-temperature map:
|
||||
45 77 23
|
||||
81 45 19
|
||||
68 64 13
|
||||
|
||||
temperature-to-humidity map:
|
||||
0 69 1
|
||||
1 0 69
|
||||
|
||||
humidity-to-location map:
|
||||
60 56 37
|
||||
56 93 4
|
||||
The almanac starts by listing which seeds need to be planted: seeds 79, 14, 55, and 13.
|
||||
|
||||
The rest of the almanac contains a list of maps which describe how to convert numbers from a source category into numbers in a destination category. That is, the section that starts with seed-to-soil map: describes how to convert a seed number (the source) to a soil number (the destination). This lets the gardener and his team know which soil to use with which seeds, which water to use with which fertilizer, and so on.
|
||||
|
||||
Rather than list every source number and its corresponding destination number one by one, the maps describe entire ranges of numbers that can be converted. Each line within a map contains three numbers: the destination range start, the source range start, and the range length.
|
||||
|
||||
Consider again the example seed-to-soil map:
|
||||
|
||||
50 98 2
|
||||
52 50 48
|
||||
The first line has a destination range start of 50, a source range start of 98, and a range length of 2. This line means that the source range starts at 98 and contains two values: 98 and 99. The destination range is the same length, but it starts at 50, so its two values are 50 and 51. With this information, you know that seed number 98 corresponds to soil number 50 and that seed number 99 corresponds to soil number 51.
|
||||
|
||||
The second line means that the source range starts at 50 and contains 48 values: 50, 51, ..., 96, 97. This corresponds to a destination range starting at 52 and also containing 48 values: 52, 53, ..., 98, 99. So, seed number 53 corresponds to soil number 55.
|
||||
|
||||
Any source numbers that aren't mapped correspond to the same destination number. So, seed number 10 corresponds to soil number 10.
|
||||
|
||||
So, the entire list of seed numbers and their corresponding soil numbers looks like this:
|
||||
|
||||
seed soil
|
||||
0 0
|
||||
1 1
|
||||
... ...
|
||||
48 48
|
||||
49 49
|
||||
50 52
|
||||
51 53
|
||||
... ...
|
||||
96 98
|
||||
97 99
|
||||
98 50
|
||||
99 51
|
||||
With this map, you can look up the soil number required for each initial seed number:
|
||||
|
||||
Seed number 79 corresponds to soil number 81.
|
||||
Seed number 14 corresponds to soil number 14.
|
||||
Seed number 55 corresponds to soil number 57.
|
||||
Seed number 13 corresponds to soil number 13.
|
||||
The gardener and his team want to get started as soon as possible, so they'd like to know the closest location that needs a seed. Using these maps, find the lowest location number that corresponds to any of the initial seeds. To do this, you'll need to convert each seed number through other categories until you can find its corresponding location number. In this example, the corresponding types are:
|
||||
|
||||
Seed 79, soil 81, fertilizer 81, water 81, light 74, temperature 78, humidity 78, location 82.
|
||||
Seed 14, soil 14, fertilizer 53, water 49, light 42, temperature 42, humidity 43, location 43.
|
||||
Seed 55, soil 57, fertilizer 57, water 53, light 46, temperature 82, humidity 82, location 86.
|
||||
Seed 13, soil 13, fertilizer 52, water 41, light 34, temperature 34, humidity 35, location 35.
|
||||
So, the lowest location number in this example is 35.
|
||||
|
||||
What is the lowest location number that corresponds to any of the initial seed numbers?
|
||||
|
||||
--- Part Two ---
|
||||
Everyone will starve if you only plant such a small number of seeds. Re-reading the almanac, it looks like the seeds: line actually describes ranges of seed numbers.
|
||||
|
||||
The values on the initial seeds: line come in pairs. Within each pair, the first value is the start of the range and the second value is the length of the range. So, in the first line of the example above:
|
||||
|
||||
seeds: 79 14 55 13
|
||||
This line describes two ranges of seed numbers to be planted in the garden. The first range starts with seed number 79 and contains 14 values: 79, 80, ..., 91, 92. The second range starts with seed number 55 and contains 13 values: 55, 56, ..., 66, 67.
|
||||
|
||||
Now, rather than considering four seed numbers, you need to consider a total of 27 seed numbers.
|
||||
|
||||
In the above example, the lowest location number can be obtained from seed number 82, which corresponds to soil 84, fertilizer 84, water 84, light 77, temperature 45, humidity 46, and location 46. So, the lowest location number is 46.
|
||||
|
||||
Consider all of the initial seed numbers listed in the ranges on the first line of the almanac. What is the lowest location number that corresponds to any of the initial seed numbers?
|
||||
@@ -0,0 +1,57 @@
|
||||
--- Day 6: Wait For It ---
|
||||
The ferry quickly brings you across Island Island. After asking around, you discover that there is indeed normally a large pile of sand somewhere near here, but you don't see anything besides lots of water and the small island where the ferry has docked.
|
||||
|
||||
As you try to figure out what to do next, you notice a poster on a wall near the ferry dock. "Boat races! Open to the public! Grand prize is an all-expenses-paid trip to Desert Island!" That must be where the sand comes from! Best of all, the boat races are starting in just a few minutes.
|
||||
|
||||
You manage to sign up as a competitor in the boat races just in time. The organizer explains that it's not really a traditional race - instead, you will get a fixed amount of time during which your boat has to travel as far as it can, and you win if your boat goes the farthest.
|
||||
|
||||
As part of signing up, you get a sheet of paper (your puzzle input) that lists the time allowed for each race and also the best distance ever recorded in that race. To guarantee you win the grand prize, you need to make sure you go farther in each race than the current record holder.
|
||||
|
||||
The organizer brings you over to the area where the boat races are held. The boats are much smaller than you expected - they're actually toy boats, each with a big button on top. Holding down the button charges the boat, and releasing the button allows the boat to move. Boats move faster if their button was held longer, but time spent holding the button counts against the total race time. You can only hold the button at the start of the race, and boats don't move until the button is released.
|
||||
|
||||
For example:
|
||||
|
||||
Time: 7 15 30
|
||||
Distance: 9 40 200
|
||||
This document describes three races:
|
||||
|
||||
The first race lasts 7 milliseconds. The record distance in this race is 9 millimeters.
|
||||
The second race lasts 15 milliseconds. The record distance in this race is 40 millimeters.
|
||||
The third race lasts 30 milliseconds. The record distance in this race is 200 millimeters.
|
||||
Your toy boat has a starting speed of zero millimeters per millisecond. For each whole millisecond you spend at the beginning of the race holding down the button, the boat's speed increases by one millimeter per millisecond.
|
||||
|
||||
So, because the first race lasts 7 milliseconds, you only have a few options:
|
||||
|
||||
Don't hold the button at all (that is, hold it for 0 milliseconds) at the start of the race. The boat won't move; it will have traveled 0 millimeters by the end of the race.
|
||||
Hold the button for 1 millisecond at the start of the race. Then, the boat will travel at a speed of 1 millimeter per millisecond for 6 milliseconds, reaching a total distance traveled of 6 millimeters.
|
||||
Hold the button for 2 milliseconds, giving the boat a speed of 2 millimeters per millisecond. It will then get 5 milliseconds to move, reaching a total distance of 10 millimeters.
|
||||
Hold the button for 3 milliseconds. After its remaining 4 milliseconds of travel time, the boat will have gone 12 millimeters.
|
||||
Hold the button for 4 milliseconds. After its remaining 3 milliseconds of travel time, the boat will have gone 12 millimeters.
|
||||
Hold the button for 5 milliseconds, causing the boat to travel a total of 10 millimeters.
|
||||
Hold the button for 6 milliseconds, causing the boat to travel a total of 6 millimeters.
|
||||
Hold the button for 7 milliseconds. That's the entire duration of the race. You never let go of the button. The boat can't move until you let go of the button. Please make sure you let go of the button so the boat gets to move. 0 millimeters.
|
||||
Since the current record for this race is 9 millimeters, there are actually 4 different ways you could win: you could hold the button for 2, 3, 4, or 5 milliseconds at the start of the race.
|
||||
|
||||
In the second race, you could hold the button for at least 4 milliseconds and at most 11 milliseconds and beat the record, a total of 8 different ways to win.
|
||||
|
||||
In the third race, you could hold the button for at least 11 milliseconds and no more than 19 milliseconds and still beat the record, a total of 9 ways you could win.
|
||||
|
||||
To see how much margin of error you have, determine the number of ways you can beat the record in each race; in this example, if you multiply these values together, you get 288 (4 * 8 * 9).
|
||||
|
||||
Determine the number of ways you could beat the record in each race. What do you get if you multiply these numbers together?
|
||||
|
||||
--- Part Two ---
|
||||
As the race is about to start, you realize the piece of paper with race times and record distances you got earlier actually just has very bad kerning. There's really only one race - ignore the spaces between the numbers on each line.
|
||||
|
||||
So, the example from before:
|
||||
|
||||
Time: 7 15 30
|
||||
Distance: 9 40 200
|
||||
...now instead means this:
|
||||
|
||||
Time: 71530
|
||||
Distance: 940200
|
||||
Now, you have to figure out how many ways there are to win this single race. In this example, the race lasts for 71530 milliseconds and the record distance you need to beat is 940200 millimeters. You could hold the button anywhere from 14 to 71516 milliseconds and beat the record, a total of 71503 ways!
|
||||
|
||||
How many ways can you beat the record in this one much longer race?
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
--- Day 7: Camel Cards ---
|
||||
Your all-expenses-paid trip turns out to be a one-way, five-minute ride in an airship. (At least it's a cool airship!) It drops you off at the edge of a vast desert and descends back to Island Island.
|
||||
|
||||
"Did you bring the parts?"
|
||||
|
||||
You turn around to see an Elf completely covered in white clothing, wearing goggles, and riding a large camel.
|
||||
|
||||
"Did you bring the parts?" she asks again, louder this time. You aren't sure what parts she's looking for; you're here to figure out why the sand stopped.
|
||||
|
||||
"The parts! For the sand, yes! Come with me; I will show you." She beckons you onto the camel.
|
||||
|
||||
After riding a bit across the sands of Desert Island, you can see what look like very large rocks covering half of the horizon. The Elf explains that the rocks are all along the part of Desert Island that is directly above Island Island, making it hard to even get there. Normally, they use big machines to move the rocks and filter the sand, but the machines have broken down because Desert Island recently stopped receiving the parts they need to fix the machines.
|
||||
|
||||
You've already assumed it'll be your job to figure out why the parts stopped when she asks if you can help. You agree automatically.
|
||||
|
||||
Because the journey will take a few days, she offers to teach you the game of Camel Cards. Camel Cards is sort of similar to poker except it's designed to be easier to play while riding a camel.
|
||||
|
||||
In Camel Cards, you get a list of hands, and your goal is to order them based on the strength of each hand. A hand consists of five cards labeled one of A, K, Q, J, T, 9, 8, 7, 6, 5, 4, 3, or 2. The relative strength of each card follows this order, where A is the highest and 2 is the lowest.
|
||||
|
||||
Every hand is exactly one type. From strongest to weakest, they are:
|
||||
|
||||
Five of a kind, where all five cards have the same label: AAAAA
|
||||
Four of a kind, where four cards have the same label and one card has a different label: AA8AA
|
||||
Full house, where three cards have the same label, and the remaining two cards share a different label: 23332
|
||||
Three of a kind, where three cards have the same label, and the remaining two cards are each different from any other card in the hand: TTT98
|
||||
Two pair, where two cards share one label, two other cards share a second label, and the remaining card has a third label: 23432
|
||||
One pair, where two cards share one label, and the other three cards have a different label from the pair and each other: A23A4
|
||||
High card, where all cards' labels are distinct: 23456
|
||||
Hands are primarily ordered based on type; for example, every full house is stronger than any three of a kind.
|
||||
|
||||
If two hands have the same type, a second ordering rule takes effect. Start by comparing the first card in each hand. If these cards are different, the hand with the stronger first card is considered stronger. If the first card in each hand have the same label, however, then move on to considering the second card in each hand. If they differ, the hand with the higher second card wins; otherwise, continue with the third card in each hand, then the fourth, then the fifth.
|
||||
|
||||
So, 33332 and 2AAAA are both four of a kind hands, but 33332 is stronger because its first card is stronger. Similarly, 77888 and 77788 are both a full house, but 77888 is stronger because its third card is stronger (and both hands have the same first and second card).
|
||||
|
||||
To play Camel Cards, you are given a list of hands and their corresponding bid (your puzzle input). For example:
|
||||
|
||||
32T3K 765
|
||||
T55J5 684
|
||||
KK677 28
|
||||
KTJJT 220
|
||||
QQQJA 483
|
||||
This example shows five hands; each hand is followed by its bid amount. Each hand wins an amount equal to its bid multiplied by its rank, where the weakest hand gets rank 1, the second-weakest hand gets rank 2, and so on up to the strongest hand. Because there are five hands in this example, the strongest hand will have rank 5 and its bid will be multiplied by 5.
|
||||
|
||||
So, the first step is to put the hands in order of strength:
|
||||
|
||||
32T3K is the only one pair and the other hands are all a stronger type, so it gets rank 1.
|
||||
KK677 and KTJJT are both two pair. Their first cards both have the same label, but the second card of KK677 is stronger (K vs T), so KTJJT gets rank 2 and KK677 gets rank 3.
|
||||
T55J5 and QQQJA are both three of a kind. QQQJA has a stronger first card, so it gets rank 5 and T55J5 gets rank 4.
|
||||
Now, you can determine the total winnings of this set of hands by adding up the result of multiplying each hand's bid with its rank (765 * 1 + 220 * 2 + 28 * 3 + 684 * 4 + 483 * 5). So the total winnings in this example are 6440.
|
||||
|
||||
Find the rank of every hand in your set. What are the total winnings?
|
||||
|
||||
--- Part Two ---
|
||||
To make things a little more interesting, the Elf introduces one additional rule. Now, J cards are jokers - wildcards that can act like whatever card would make the hand the strongest type possible.
|
||||
|
||||
To balance this, J cards are now the weakest individual cards, weaker even than 2. The other cards stay in the same order: A, K, Q, T, 9, 8, 7, 6, 5, 4, 3, 2, J.
|
||||
|
||||
J cards can pretend to be whatever card is best for the purpose of determining hand type; for example, QJJQ2 is now considered four of a kind. However, for the purpose of breaking ties between two hands of the same type, J is always treated as J, not the card it's pretending to be: JKKK2 is weaker than QQQQ2 because J is weaker than Q.
|
||||
|
||||
Now, the above example goes very differently:
|
||||
|
||||
32T3K 765
|
||||
T55J5 684
|
||||
KK677 28
|
||||
KTJJT 220
|
||||
QQQJA 483
|
||||
32T3K is still the only one pair; it doesn't contain any jokers, so its strength doesn't increase.
|
||||
KK677 is now the only two pair, making it the second-weakest hand.
|
||||
T55J5, KTJJT, and QQQJA are now all four of a kind! T55J5 gets rank 3, QQQJA gets rank 4, and KTJJT gets rank 5.
|
||||
With the new joker rule, the total winnings in this example are 5905.
|
||||
|
||||
Using the new joker rule, find the rank of every hand in your set. What are the new total winnings?
|
||||
@@ -0,0 +1,62 @@
|
||||
--- 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?
|
||||
|
||||
--- Part Two ---
|
||||
The sandstorm is upon you and you aren't any closer to escaping the wasteland. You had the camel follow the instructions, but you've barely left your starting position. It's going to take significantly more steps to escape!
|
||||
|
||||
What if the map isn't for people - what if the map is for ghosts? Are ghosts even bound by the laws of spacetime? Only one way to find out.
|
||||
|
||||
After examining the maps a bit longer, your attention is drawn to a curious fact: the number of nodes with names ending in A is equal to the number ending in Z! If you were a ghost, you'd probably just start at every node that ends with A and follow all of the paths at the same time until they all simultaneously end up at nodes that end with Z.
|
||||
|
||||
For example:
|
||||
|
||||
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)
|
||||
Here, there are two starting nodes, 11A and 22A (because they both end with A). As you follow each left/right instruction, use that instruction to simultaneously navigate away from both nodes you're currently on. Repeat this process until all of the nodes you're currently on end with Z. (If only some of the nodes you're on end with Z, they act like any other node and you continue as normal.) In this example, you would proceed as follows:
|
||||
|
||||
Step 0: You are at 11A and 22A.
|
||||
Step 1: You choose all of the left paths, leading you to 11B and 22B.
|
||||
Step 2: You choose all of the right paths, leading you to 11Z and 22C.
|
||||
Step 3: You choose all of the left paths, leading you to 11B and 22Z.
|
||||
Step 4: You choose all of the right paths, leading you to 11Z and 22B.
|
||||
Step 5: You choose all of the left paths, leading you to 11B and 22C.
|
||||
Step 6: You choose all of the right paths, leading you to 11Z and 22Z.
|
||||
So, in this example, you end up entirely on nodes that end in Z after 6 steps.
|
||||
|
||||
Simultaneously start on every node that ends with A. How many steps does it take before you're only on nodes that end with Z?
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,101 @@
|
||||
namespace AOC.Tests.Y2024;
|
||||
|
||||
[TestFixture]
|
||||
[Parallelizable(ParallelScope.All)]
|
||||
public class Day01
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
realData = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, "Y2024", "Data",
|
||||
$"{GetThisClassName()}.dat"));
|
||||
}
|
||||
|
||||
protected string GetThisClassName() { return GetType().Name; }
|
||||
private string[] realData;
|
||||
|
||||
[TestCase(@"3 4
|
||||
4 3
|
||||
2 5
|
||||
1 3
|
||||
3 9
|
||||
3 3", 11)]
|
||||
[TestCase(null, 2000468)] // The actual answer
|
||||
public void Part1(string? input, int? expected)
|
||||
{
|
||||
// string[] lines = input != null ? new[] { input } : realData;
|
||||
string[] lines = input != null ? input.Split("\n") : realData;
|
||||
|
||||
List<int> left = new();
|
||||
List<int> right = new();
|
||||
|
||||
for (int i = 0; i < lines.Length; i++)
|
||||
{
|
||||
string leftString = lines[i].Split(" ")[0];
|
||||
string rightString = lines[i].Split(" ")[1];
|
||||
|
||||
left.Add(int.Parse(leftString));
|
||||
right.Add(int.Parse(rightString));
|
||||
}
|
||||
|
||||
int totalDistance = 0;
|
||||
|
||||
left = left.Order().ToList();
|
||||
right = right.Order().ToList();
|
||||
|
||||
for (int i = 0; i < left.Count; i++)
|
||||
{
|
||||
// Get the difference between left and right at this index
|
||||
totalDistance += Math.Abs(left[i] - right[i]);
|
||||
}
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(totalDistance, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 1: {totalDistance}");
|
||||
}
|
||||
|
||||
[TestCase(@"3 4
|
||||
4 3
|
||||
2 5
|
||||
1 3
|
||||
3 9
|
||||
3 3", 31)]
|
||||
[TestCase(null, 18567089)] // The actual answer
|
||||
public void Part2(string? input, int? expected)
|
||||
{
|
||||
//string[] lines = input != null ? new[] { input } : realData;
|
||||
string[] lines = input != null ? input.Split("\n") : realData;
|
||||
|
||||
List<int> left = new();
|
||||
List<int> right = new();
|
||||
|
||||
for (int i = 0; i < lines.Length; i++)
|
||||
{
|
||||
string leftString = lines[i].Split(" ")[0];
|
||||
string rightString = lines[i].Split(" ")[1];
|
||||
|
||||
left.Add(int.Parse(leftString));
|
||||
right.Add(int.Parse(rightString));
|
||||
}
|
||||
|
||||
int similarityScore = 0;
|
||||
|
||||
for (int i = 0; i < left.Count; i++)
|
||||
{
|
||||
int count = right.Count(x => x == left[i]);
|
||||
|
||||
similarityScore += left[i] * count;
|
||||
}
|
||||
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(similarityScore, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 2: {similarityScore}");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
--- Day 1: Historian Hysteria ---
|
||||
The Chief Historian is always present for the big Christmas sleigh launch, but nobody has seen him in months! Last anyone heard, he was visiting locations that are historically significant to the North Pole; a group of Senior Historians has asked you to accompany them as they check the places they think he was most likely to visit.
|
||||
|
||||
As each location is checked, they will mark it on their list with a star. They figure the Chief Historian must be in one of the first fifty places they'll look, so in order to save Christmas, you need to help them get fifty stars on their list before Santa takes off on December 25th.
|
||||
|
||||
Collect stars by solving puzzles. Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants one star. Good luck!
|
||||
|
||||
You haven't even left yet and the group of Elvish Senior Historians has already hit a problem: their list of locations to check is currently empty. Eventually, someone decides that the best place to check first would be the Chief Historian's office.
|
||||
|
||||
Upon pouring into the office, everyone confirms that the Chief Historian is indeed nowhere to be found. Instead, the Elves discover an assortment of notes and lists of historically significant locations! This seems to be the planning the Chief Historian was doing before he left. Perhaps these notes can be used to determine which locations to search?
|
||||
|
||||
Throughout the Chief's office, the historically significant locations are listed not by name but by a unique number called the location ID. To make sure they don't miss anything, The Historians split into two groups, each searching the office and trying to create their own complete list of location IDs.
|
||||
|
||||
There's just one problem: by holding the two lists up side by side (your puzzle input), it quickly becomes clear that the lists aren't very similar. Maybe you can help The Historians reconcile their lists?
|
||||
|
||||
For example:
|
||||
|
||||
3 4
|
||||
4 3
|
||||
2 5
|
||||
1 3
|
||||
3 9
|
||||
3 3
|
||||
Maybe the lists are only off by a small amount! To find out, pair up the numbers and measure how far apart they are. Pair up the smallest number in the left list with the smallest number in the right list, then the second-smallest left number with the second-smallest right number, and so on.
|
||||
|
||||
Within each pair, figure out how far apart the two numbers are; you'll need to add up all of those distances. For example, if you pair up a 3 from the left list with a 7 from the right list, the distance apart is 4; if you pair up a 9 with a 3, the distance apart is 6.
|
||||
|
||||
In the example list above, the pairs and distances would be as follows:
|
||||
|
||||
The smallest number in the left list is 1, and the smallest number in the right list is 3. The distance between them is 2.
|
||||
The second-smallest number in the left list is 2, and the second-smallest number in the right list is another 3. The distance between them is 1.
|
||||
The third-smallest number in both lists is 3, so the distance between them is 0.
|
||||
The next numbers to pair up are 3 and 4, a distance of 1.
|
||||
The fifth-smallest numbers in each list are 3 and 5, a distance of 2.
|
||||
Finally, the largest number in the left list is 4, while the largest number in the right list is 9; these are a distance 5 apart.
|
||||
To find the total distance between the left list and the right list, add up the distances between all of the pairs you found. In the example above, this is 2 + 1 + 0 + 1 + 2 + 5, a total distance of 11!
|
||||
|
||||
Your actual left and right lists contain many location IDs. What is the total distance between your lists?
|
||||
|
||||
--- Part Two ---
|
||||
Your analysis only confirmed what everyone feared: the two lists of location IDs are indeed very different.
|
||||
|
||||
Or are they?
|
||||
|
||||
The Historians can't agree on which group made the mistakes or how to read most of the Chief's handwriting, but in the commotion you notice an interesting detail: a lot of location IDs appear in both lists! Maybe the other numbers aren't location IDs at all but rather misinterpreted handwriting.
|
||||
|
||||
This time, you'll need to figure out exactly how often each number from the left list appears in the right list. Calculate a total similarity score by adding up each number in the left list after multiplying it by the number of times that number appears in the right list.
|
||||
|
||||
Here are the same example lists again:
|
||||
|
||||
3 4
|
||||
4 3
|
||||
2 5
|
||||
1 3
|
||||
3 9
|
||||
3 3
|
||||
For these example lists, here is the process of finding the similarity score:
|
||||
|
||||
The first number in the left list is 3. It appears in the right list three times, so the similarity score increases by 3 * 3 = 9.
|
||||
The second number in the left list is 4. It appears in the right list once, so the similarity score increases by 4 * 1 = 4.
|
||||
The third number in the left list is 2. It does not appear in the right list, so the similarity score does not increase (2 * 0 = 0).
|
||||
The fourth number, 1, also does not appear in the right list.
|
||||
The fifth number, 3, appears in the right list three times; the similarity score increases by 9.
|
||||
The last number, 3, appears in the right list three times; the similarity score again increases by 9.
|
||||
So, for these example lists, the similarity score at the end of this process is 31 (9 + 4 + 0 + 0 + 9 + 9).
|
||||
|
||||
Once again consider your left and right lists. What is their similarity score?
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.3.32922.545
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AOC.Tests", "AOC.Tests\AOC.Tests.csproj", "{2E0193E1-5DD3-40A6-A07B-C6E58341ACA0}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DayCreator", "DayCreator\DayCreator.csproj", "{BBA91797-9C84-4A8D-9C12-9AE4D3C3EF83}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{2E0193E1-5DD3-40A6-A07B-C6E58341ACA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2E0193E1-5DD3-40A6-A07B-C6E58341ACA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2E0193E1-5DD3-40A6-A07B-C6E58341ACA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2E0193E1-5DD3-40A6-A07B-C6E58341ACA0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BBA91797-9C84-4A8D-9C12-9AE4D3C3EF83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BBA91797-9C84-4A8D-9C12-9AE4D3C3EF83}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BBA91797-9C84-4A8D-9C12-9AE4D3C3EF83}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BBA91797-9C84-4A8D-9C12-9AE4D3C3EF83}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {65F1D061-1249-4BFA-92B8-E0072972D0EF}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,6 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
|
||||
|
||||
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=8ddce0d5_002Db323_002D41bb_002Da920_002D6cc320742199/@EntryIndexedValue"><SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from Y2024" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session">
|
||||
<ProjectFolder>2E0193E1-5DD3-40A6-A07B-C6E58341ACA0/d:Y2024</ProjectFolder>
|
||||
</SessionState></s:String></wpf:ResourceDictionary>
|
||||
@@ -0,0 +1,21 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="DayX.cs"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="DayX.cs">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,46 @@
|
||||
namespace AOC.Tests.YX;
|
||||
|
||||
[TestFixture]
|
||||
[Parallelizable(ParallelScope.All)]
|
||||
public class DayX
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
realData = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, "YX", "Data",
|
||||
$"{GetThisClassName()}.dat"));
|
||||
}
|
||||
|
||||
protected string GetThisClassName() { return GetType().Name; }
|
||||
private string[] realData;
|
||||
|
||||
[TestCase("blah", 0)]
|
||||
[TestCase(null, 232)] // The actual answer
|
||||
public void Part1(string? input, int? expected)
|
||||
{
|
||||
string[] lines = input != null ? new[] { input } : realData;
|
||||
// string[] lines = input != null ? input.Split("\n") : realData;
|
||||
|
||||
//if (expected != null)
|
||||
//{
|
||||
// Assert.That(result, Is.EqualTo(expected.Value));
|
||||
//}
|
||||
|
||||
//Console.WriteLine($"Part 1: {result}");
|
||||
}
|
||||
|
||||
[TestCase("blah", 1)]
|
||||
[TestCase(null, 1783)] // The actual answer
|
||||
public void Part2(string? input, int? expected)
|
||||
{
|
||||
//string[] lines = input != null ? new[] { input } : realData;
|
||||
// string[] lines = input != null ? input.Split("\n") : realData;
|
||||
|
||||
//if (expected != null)
|
||||
//{
|
||||
// Assert.That(result, Is.EqualTo(expected.Value));
|
||||
//}
|
||||
|
||||
//Console.WriteLine($"Part 2: {result}");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
Console.Write("Year: ");
|
||||
var year = Console.ReadLine();
|
||||
|
||||
Console.Write("Day: ");
|
||||
var day = Console.ReadLine().PadLeft(2, '0'); ;
|
||||
|
||||
var currentLocation = System.Reflection.Assembly.GetExecutingAssembly().Location;
|
||||
int ix = currentLocation.IndexOf("DayCreator");
|
||||
var newPathBase = currentLocation.Substring(0, ix - 1);
|
||||
var newDayCreatorBase = currentLocation.Substring(0, ix + "DayCreator".Length);
|
||||
|
||||
string yearPath = Path.GetFullPath(Path.Combine(newPathBase, "AOC.Tests", $"Y{year}"));
|
||||
string dataPath = Path.GetFullPath(Path.Combine(yearPath, "Data", $"Day{day}.dat"));
|
||||
string tasksPath = Path.GetFullPath(Path.Combine(yearPath, "Tasks", $"Day{day}.txt"));
|
||||
|
||||
// Check and create missing directories
|
||||
if (!Directory.Exists(yearPath))
|
||||
{
|
||||
Directory.CreateDirectory(yearPath);
|
||||
}
|
||||
|
||||
if (!Directory.Exists(Path.Combine(yearPath, "Data")))
|
||||
{
|
||||
Directory.CreateDirectory(Path.Combine(yearPath, "Data"));
|
||||
}
|
||||
|
||||
if (!Directory.Exists(Path.Combine(yearPath, "Tasks")))
|
||||
{
|
||||
Directory.CreateDirectory(Path.Combine(yearPath, "Tasks"));
|
||||
}
|
||||
|
||||
// Create data file
|
||||
using (FileStream fs = File.Create(dataPath));
|
||||
|
||||
// Create task file
|
||||
using (FileStream fs = File.Create(tasksPath));
|
||||
|
||||
// Create code file
|
||||
var dayXPath = Path.GetFullPath(Path.Combine(newDayCreatorBase, "DayX.cs"));
|
||||
string text = File.ReadAllText(dayXPath);
|
||||
text = text.Replace("YX", $"Y{year}");
|
||||
text = text.Replace("DayX", $"Day{day}");
|
||||
var writePath = Path.GetFullPath(Path.Combine(yearPath, $"Day{day}.cs"));
|
||||
File.WriteAllText(writePath, text);
|
||||
@@ -0,0 +1,5 @@
|
||||
# Advent Of Code
|
||||
|
||||
To create a new day's files, run the DayCreator project and specify the year (e.g. `2015`) and the day (e.g. `1` for Day01). This can be done in vscode by running `dotnet run --project "DayCreator"` in the terminal.
|
||||
|
||||
The solutions to both parts of each day of each year can be executed using the Test Explorer.
|
||||
Reference in New Issue
Block a user