parent
d782c02ec8
commit
661a6268b8
@ -0,0 +1,138 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<ItemGroup Label="ProjectConfigurations"> |
||||
<ProjectConfiguration Include="Debug|Win32"> |
||||
<Configuration>Debug</Configuration> |
||||
<Platform>Win32</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Release|Win32"> |
||||
<Configuration>Release</Configuration> |
||||
<Platform>Win32</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Debug|x64"> |
||||
<Configuration>Debug</Configuration> |
||||
<Platform>x64</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Release|x64"> |
||||
<Configuration>Release</Configuration> |
||||
<Platform>x64</Platform> |
||||
</ProjectConfiguration> |
||||
</ItemGroup> |
||||
<PropertyGroup Label="Globals"> |
||||
<VCProjectVersion>16.0</VCProjectVersion> |
||||
<Keyword>Win32Proj</Keyword> |
||||
<ProjectGuid>{c7fb2186-6ce5-4b24-b1f7-a3501061560c}</ProjectGuid> |
||||
<RootNamespace>Day_5</RootNamespace> |
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> |
||||
</PropertyGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> |
||||
<ConfigurationType>Application</ConfigurationType> |
||||
<UseDebugLibraries>true</UseDebugLibraries> |
||||
<PlatformToolset>v143</PlatformToolset> |
||||
<CharacterSet>Unicode</CharacterSet> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |
||||
<ConfigurationType>Application</ConfigurationType> |
||||
<UseDebugLibraries>false</UseDebugLibraries> |
||||
<PlatformToolset>v143</PlatformToolset> |
||||
<WholeProgramOptimization>true</WholeProgramOptimization> |
||||
<CharacterSet>Unicode</CharacterSet> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> |
||||
<ConfigurationType>Application</ConfigurationType> |
||||
<UseDebugLibraries>true</UseDebugLibraries> |
||||
<PlatformToolset>v143</PlatformToolset> |
||||
<CharacterSet>Unicode</CharacterSet> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> |
||||
<ConfigurationType>Application</ConfigurationType> |
||||
<UseDebugLibraries>false</UseDebugLibraries> |
||||
<PlatformToolset>v143</PlatformToolset> |
||||
<WholeProgramOptimization>true</WholeProgramOptimization> |
||||
<CharacterSet>Unicode</CharacterSet> |
||||
</PropertyGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
||||
<ImportGroup Label="ExtensionSettings"> |
||||
</ImportGroup> |
||||
<ImportGroup Label="Shared"> |
||||
</ImportGroup> |
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||
</ImportGroup> |
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||
</ImportGroup> |
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||
</ImportGroup> |
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||
</ImportGroup> |
||||
<PropertyGroup Label="UserMacros" /> |
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||
<ClCompile> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<SDLCheck>true</SDLCheck> |
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<ConformanceMode>true</ConformanceMode> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||
<ClCompile> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||
<SDLCheck>true</SDLCheck> |
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<ConformanceMode>true</ConformanceMode> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||
<OptimizeReferences>true</OptimizeReferences> |
||||
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
||||
<ClCompile> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<SDLCheck>true</SDLCheck> |
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<ConformanceMode>true</ConformanceMode> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
||||
<ClCompile> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||
<SDLCheck>true</SDLCheck> |
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<ConformanceMode>true</ConformanceMode> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||
<OptimizeReferences>true</OptimizeReferences> |
||||
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
<ItemGroup> |
||||
<ClInclude Include="olcPixelGameEngine.h" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ClCompile Include="main.cpp" /> |
||||
</ItemGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
||||
<ImportGroup Label="ExtensionTargets"> |
||||
</ImportGroup> |
||||
</Project> |
@ -0,0 +1,33 @@ |
||||
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 |
@ -0,0 +1,237 @@ |
||||
seeds: 41218238 421491713 1255413673 350530906 944138913 251104806 481818804 233571979 2906248740 266447632 3454130719 50644329 1920342932 127779721 2109326496 538709762 3579244700 267233350 4173137165 60179884 |
||||
|
||||
seed-to-soil map: |
||||
1389477588 1222450723 86190269 |
||||
2369327568 3429737174 127508203 |
||||
88123474 1366319913 182655004 |
||||
1475667857 405321476 41320497 |
||||
1258939826 536917987 41172751 |
||||
1924266396 3404859218 24877956 |
||||
1762699703 957158780 33280161 |
||||
3452528837 3222194776 182664442 |
||||
2196573512 1924266396 172754056 |
||||
433176947 990438941 6166389 |
||||
4047092335 2681059373 30705388 |
||||
439343336 1626695089 181842577 |
||||
1949144352 2940939059 125726128 |
||||
979719551 446641973 90276014 |
||||
2184073848 2711764761 12499664 |
||||
4077797723 2605613670 27940277 |
||||
2074870480 4240432416 54534880 |
||||
3048538268 3066665187 104068222 |
||||
621185913 1124514126 97936597 |
||||
1157547656 773812762 84277017 |
||||
1300112577 20266514 6655368 |
||||
1151949413 1808537666 5598243 |
||||
3435484067 2724264425 17044770 |
||||
380487497 1308640992 52689450 |
||||
1644897150 26921882 117802553 |
||||
1516988354 996605330 127908796 |
||||
1241824673 858089779 17115153 |
||||
3932455534 2269053207 114636801 |
||||
3319415958 3854507632 116068109 |
||||
2129405360 4237225295 3207121 |
||||
2729160001 2097020452 172032755 |
||||
3635193279 3557245377 297262255 |
||||
1795979864 578090738 107598550 |
||||
2901192756 3970575741 147345512 |
||||
4105738000 2416384374 189229296 |
||||
0 685689288 88123474 |
||||
1903578414 0 20266514 |
||||
719122510 144724435 260597041 |
||||
2132612481 3170733409 51461367 |
||||
2496835771 2741309195 199629864 |
||||
1306767945 1548974917 77720172 |
||||
3200111916 4117921253 119304042 |
||||
1069995565 875204932 81953848 |
||||
3152606490 2633553947 47505426 |
||||
270778478 1814135909 109709019 |
||||
1384488117 1361330442 4989471 |
||||
2696465635 2383690008 32694366 |
||||
|
||||
soil-to-fertilizer map: |
||||
1796371314 958475699 90518367 |
||||
4004397333 4049196179 245771117 |
||||
2175877891 3813840430 96544159 |
||||
1966430612 3997904997 51291182 |
||||
3155151482 799623922 79310846 |
||||
4250168450 2358444962 15280909 |
||||
4265449359 3910384589 29517937 |
||||
3087542169 2534702057 67609313 |
||||
1202725381 3631683738 113825873 |
||||
852357580 2833874802 40691288 |
||||
1452732352 2128818900 25726830 |
||||
291197164 3745509611 68330819 |
||||
1316551254 2602311370 60535393 |
||||
2017721794 2764291908 69582894 |
||||
498502503 445768845 353855077 |
||||
3367678481 1860885729 203469524 |
||||
3845535174 1124639771 94398512 |
||||
1041749195 2373725871 160976186 |
||||
2330424521 2874566090 757117648 |
||||
1478459182 127856713 317912132 |
||||
3234462328 1680414394 31771008 |
||||
359527983 1219038283 138974520 |
||||
893048868 1712185402 148700327 |
||||
3571148005 1406027225 274387169 |
||||
3939933686 2064355253 64463647 |
||||
3266233336 2662846763 101445145 |
||||
1886889681 878934768 79540931 |
||||
87297932 2154545730 203899232 |
||||
39283510 1358012803 48014422 |
||||
2272422050 3939902526 58002471 |
||||
1377086647 1048994066 75645705 |
||||
2087304688 39283510 88573203 |
||||
|
||||
fertilizer-to-water map: |
||||
3988818582 3038666130 306148714 |
||||
2927763871 3008779749 29886381 |
||||
124309691 99049201 282856506 |
||||
99049201 381905707 25260490 |
||||
407166197 2131018623 602068357 |
||||
3442767659 4213146266 81821030 |
||||
2957650252 3344814844 485117407 |
||||
3907802704 2927763871 81015878 |
||||
1009234554 407166197 1723852426 |
||||
3524588689 3829932251 383214015 |
||||
|
||||
water-to-light map: |
||||
1071892650 2651787028 57679970 |
||||
1129572620 3396952543 81593150 |
||||
1240611714 2163493623 488293405 |
||||
0 2068015044 95478579 |
||||
1211165770 3074252590 29445944 |
||||
2592854025 0 138938366 |
||||
2523843782 1948369545 69010243 |
||||
924090948 883610805 76353493 |
||||
2022159128 174281796 501684654 |
||||
1000444441 2923208140 71448209 |
||||
95478579 959964298 268093632 |
||||
684655532 1228057930 239435416 |
||||
3410916028 2709466998 213741142 |
||||
363572211 1627286224 321083321 |
||||
3324937342 2017379788 50635256 |
||||
3183141431 3068711832 5540758 |
||||
2939436746 3478545693 243704685 |
||||
3624657170 2994656349 74055483 |
||||
1728905119 3103698534 293254009 |
||||
3930463154 3978112708 316854588 |
||||
2731792391 675966450 207644355 |
||||
3375572598 138938366 35343430 |
||||
4247317742 3967989739 10122969 |
||||
4257440711 3930463154 37526585 |
||||
3188682189 3722250378 136255153 |
||||
3698712653 1467493346 159792878 |
||||
|
||||
light-to-temperature map: |
||||
4148509456 1952010509 126270832 |
||||
856886372 936932802 97162803 |
||||
829640090 282271594 27246282 |
||||
244444108 1274282332 107584318 |
||||
1528329058 3192525971 211478915 |
||||
2566760651 2178128911 792500107 |
||||
478140779 1162859130 51849897 |
||||
4274780288 1528329058 20187008 |
||||
352028426 265852816 16418778 |
||||
1739807973 2970629018 221896953 |
||||
188336830 840381853 56107278 |
||||
529990676 0 265852816 |
||||
2424714410 1911677980 40332529 |
||||
795843492 896489131 33796598 |
||||
969062248 324530949 412804402 |
||||
954049175 309517876 15013073 |
||||
3359260758 3868594872 426372424 |
||||
2465046939 3404004886 101713712 |
||||
375094277 737335351 103046502 |
||||
0 1214709027 59573305 |
||||
2324866840 2078281341 99847570 |
||||
1961704926 1548516066 247670884 |
||||
2209375810 1796186950 115491030 |
||||
59573305 1034095605 128763525 |
||||
3785633182 3505718598 362876274 |
||||
368447204 930285729 6647073 |
||||
|
||||
temperature-to-humidity map: |
||||
645925588 927807414 87140162 |
||||
0 398577479 157531253 |
||||
1936153073 3766846194 135269565 |
||||
3964800672 3492411188 1957783 |
||||
3660032389 3460150664 32260524 |
||||
1374126579 1182630672 364804866 |
||||
2334938774 2586583717 132274954 |
||||
3729993364 4148156458 139151684 |
||||
2071422638 2398735028 187848689 |
||||
461859499 894601505 33205909 |
||||
1128085880 3902115759 246040699 |
||||
3966758455 1609937892 328208841 |
||||
733065750 1045187965 45230417 |
||||
3692292913 2718858671 37700451 |
||||
1738931445 2854070578 51145436 |
||||
3869145048 2758414954 95655624 |
||||
446537472 670580619 15322027 |
||||
3468753739 2905216014 191278650 |
||||
1790076881 1547435538 62502354 |
||||
3103241907 3096494664 363656000 |
||||
778296167 1014947576 30240389 |
||||
2467213728 3653280748 113565446 |
||||
2739690951 1959797890 363550956 |
||||
430471457 878535490 16066015 |
||||
934173831 836762826 41772664 |
||||
272165118 90734051 80200203 |
||||
2259271327 1128614382 54016290 |
||||
1852579235 2323348846 75386182 |
||||
808536556 272940204 125637275 |
||||
1927965417 4287308142 7659154 |
||||
1935624571 1128085880 528502 |
||||
352365321 194834068 72750816 |
||||
495065408 685902646 150860180 |
||||
248265304 170934254 23899814 |
||||
975946495 556108732 114471887 |
||||
157531253 0 90734051 |
||||
3466897907 2756559122 1855832 |
||||
2580779174 3494368971 158911777 |
||||
425116137 267584884 5355320 |
||||
2313287617 1938146733 21651157 |
||||
|
||||
humidity-to-location map: |
||||
2297594568 1304834363 199636291 |
||||
964984478 962777545 102011627 |
||||
3376226732 2612009119 78542873 |
||||
3210191679 3257561655 73324720 |
||||
960734175 2732971245 4250303 |
||||
3552752951 3643184542 128526794 |
||||
1654967093 1268999863 35834500 |
||||
2805486965 2087320949 359714826 |
||||
72263011 1608745500 171195806 |
||||
4225512580 3861994731 69454716 |
||||
1240952852 431398165 68767410 |
||||
3695056291 298067962 76655045 |
||||
1309720262 500165575 32124036 |
||||
2768212426 260793423 37274539 |
||||
258896561 532289611 263781213 |
||||
1967976997 1084282606 71977571 |
||||
2255175315 2690551992 42419253 |
||||
1514000396 0 28227011 |
||||
0 2539746108 72263011 |
||||
3283516399 2447035775 92710333 |
||||
1233825691 3330886375 7127161 |
||||
614836670 2866104927 345897505 |
||||
1341844298 88637325 172156098 |
||||
2039954568 1779941306 215220747 |
||||
3861994731 3931449447 363517849 |
||||
1950982711 414403879 16994286 |
||||
3454769605 3219988623 37573032 |
||||
1690801593 3433704416 164490238 |
||||
1855291831 3338013536 95690880 |
||||
1195879484 1080226916 4055690 |
||||
522677774 1995162053 92158896 |
||||
2601505705 796070824 166706721 |
||||
2497230859 1504470654 104274846 |
||||
1199935174 380513362 33890517 |
||||
3492342637 28227011 60410314 |
||||
1066996105 2737221548 128883379 |
||||
243458817 1064789172 15437744 |
||||
3165201791 3598194654 44989888 |
||||
3689265936 374723007 5790355 |
||||
3681279745 3212002432 7986191 |
||||
1542227407 1156260177 112739686 |
@ -0,0 +1,176 @@ |
||||
#pragma region Hidden Setup Stuff |
||||
#define OLC_PGE_APPLICATION |
||||
#include "olcPixelGameEngine.h" |
||||
|
||||
using namespace olc; |
||||
|
||||
enum Run{ |
||||
FILE1, |
||||
FILE2 |
||||
}; |
||||
|
||||
// Override base class with your custom functionality
|
||||
class AoC2023 : public olc::PixelGameEngine |
||||
{ |
||||
std::vector<std::string>lines; |
||||
bool waitForRender=false; |
||||
|
||||
void wait(int pauseMs=0){ |
||||
waitForRender=true; |
||||
while(waitForRender); |
||||
std::this_thread::sleep_for(std::chrono::milliseconds(pauseMs)); |
||||
} |
||||
|
||||
#pragma endregion |
||||
|
||||
const int DAY = 5; |
||||
Run runInput=FILE1; |
||||
|
||||
struct Seed{ |
||||
long long val; |
||||
long long range; |
||||
bool found=false; |
||||
}; |
||||
|
||||
struct Transform{ |
||||
long long source; |
||||
long long range; |
||||
long long dest; |
||||
}; |
||||
|
||||
|
||||
void doStuff(){ |
||||
while(true){ //lines is accessible as a global.
|
||||
long long smallest=0; |
||||
bool firstLine=true; |
||||
std::vector<Seed>seeds; |
||||
std::vector<std::vector<Transform>>transforms; |
||||
bool newTransform=false; |
||||
for(std::string&line:lines){ |
||||
if(firstLine){ |
||||
firstLine=false; |
||||
bool IsNumber=true; |
||||
std::string seedNumbers=line.substr(6); |
||||
while(seedNumbers.find(' ',1)!=std::string::npos){ |
||||
size_t spacePos=seedNumbers.find(' ',1); |
||||
long long numb=atoll(seedNumbers.substr(1,spacePos).c_str()); |
||||
if(IsNumber){ |
||||
seeds.push_back({numb}); |
||||
}else{ |
||||
Seed&prevSeed=seeds[seeds.size()-1]; |
||||
prevSeed.range=numb; |
||||
if(prevSeed.val+prevSeed.range-1>smallest)smallest=prevSeed.val+prevSeed.range-1; |
||||
} |
||||
IsNumber=!IsNumber; |
||||
seedNumbers=seedNumbers.substr(spacePos); |
||||
} |
||||
long long numb=atoll(seedNumbers.substr(1).c_str()); |
||||
if(IsNumber){ |
||||
seeds.push_back({numb}); |
||||
}else{ |
||||
Seed&prevSeed=seeds[seeds.size()-1]; |
||||
prevSeed.range=numb; |
||||
if(prevSeed.val+prevSeed.range-1>smallest)smallest=prevSeed.val+prevSeed.range-1; |
||||
} |
||||
}else |
||||
if(line.length()>0){ |
||||
if(newTransform&&line[0]>='0'&&line[0]<='9'){//This is a conversion
|
||||
std::vector<Transform>¤tTransform=transforms[transforms.size()-1]; |
||||
size_t spacePos=line.find(' '); |
||||
long long dest=atoll(line.substr(0,spacePos).c_str()); |
||||
size_t prevSpacePos=spacePos; |
||||
spacePos=line.find(' ',prevSpacePos+1); |
||||
long long source=atoll(line.substr(prevSpacePos+1,spacePos).c_str()); |
||||
prevSpacePos=spacePos; |
||||
spacePos=line.find(' ',prevSpacePos+1); |
||||
long long distance=atoll(line.substr(prevSpacePos+1,spacePos).c_str()); |
||||
currentTransform.push_back({source,distance,dest}); |
||||
}else{ |
||||
//No-op, skip non-number line.
|
||||
/*for(Seed&seed:seeds){
|
||||
std::cout<<seed.val<<' '; |
||||
} |
||||
std::cout<<std::endl<<std::endl;*/ |
||||
transforms.push_back({}); |
||||
newTransform=true; |
||||
for(Seed&seed:seeds){ |
||||
seed.found=false; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
for(Seed&seed:seeds){ |
||||
for(long long seedNumb=seed.val;seedNumb<seed.val+seed.range;seedNumb++){ |
||||
std::cout<<"Initial Number: "<<seedNumb<<' '; |
||||
for(std::vector<Transform>&transformList:transforms){ |
||||
for(Transform&transform:transformList){ |
||||
if(seedNumb>=transform.source&&seedNumb<transform.source+transform.range){ |
||||
seedNumb+=transform.dest-transform.source; |
||||
continue; |
||||
} |
||||
} |
||||
} |
||||
std::cout<<"Number Out: "<<seedNumb<<std::endl; |
||||
if(seedNumb<smallest)seedNumb=smallest; |
||||
} |
||||
} |
||||
std::cout<<smallest<<std::endl; |
||||
break; |
||||
//wait(0); //Wait for 0ms and render the screen (calls draw())
|
||||
} |
||||
} |
||||
|
||||
void draw(){ //Only use Sprites! If using decals, you must reference global variables!
|
||||
Clear(BLACK); |
||||
int count=0; |
||||
for(std::string&line:lines){ |
||||
DrawString({0,count*32},line,WHITE,4); |
||||
count++; |
||||
} |
||||
} |
||||
|
||||
#pragma region Hidden Engine Stuff |
||||
public: |
||||
AoC2023() |
||||
{ |
||||
// Name your application
|
||||
std::string fileName="day"+std::to_string(DAY)+"_1.txt"; |
||||
if(runInput==FILE2){fileName="day"+std::to_string(DAY)+"_2.txt";} |
||||
std::ifstream file(fileName); |
||||
while(file.good()){ |
||||
std::string line; |
||||
std::getline(file,line); |
||||
lines.push_back(line); |
||||
} |
||||
|
||||
sAppName = "Advent of Code 2023 - Day "+std::to_string(DAY); |
||||
} |
||||
|
||||
public: |
||||
bool OnUserCreate() override |
||||
{ |
||||
|
||||
return true; |
||||
} |
||||
|
||||
bool OnUserUpdate(float fElapsedTime) override |
||||
{ |
||||
static std::thread aocSolver(&AoC2023::doStuff,this); |
||||
|
||||
if(waitForRender){ |
||||
draw(); |
||||
waitForRender=false; |
||||
} |
||||
return true; |
||||
} |
||||
}; |
||||
|
||||
int main() |
||||
{ |
||||
AoC2023 game; |
||||
if (game.Construct(640, 480, 2,2)) |
||||
game.Start(); |
||||
return 0; |
||||
} |
||||
#pragma endregion |
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue