Best JavaScript code snippet using stryker-parent
day2.js
Source:day2.js
1let input = [2 ["forward", 4],3 ["down", 9],4 ["forward", 2],5 ["forward", 2],6 ["down", 7],7 ["up", 2],8 ["down", 9],9 ["up", 8],10 ["down", 7],11 ["down", 9],12 ["forward", 4],13 ["up", 6],14 ["down", 2],15 ["down", 5],16 ["down", 1],17 ["down", 5],18 ["forward", 2],19 ["up", 4],20 ["forward", 2],21 ["forward", 3],22 ["up", 2],23 ["forward", 6],24 ["up", 8],25 ["forward", 8],26 ["down", 8],27 ["up", 8],28 ["down", 7],29 ["down", 2],30 ["down", 9],31 ["forward", 2],32 ["forward", 9],33 ["down", 4],34 ["forward", 8],35 ["up", 6],36 ["down", 3],37 ["up", 9],38 ["forward", 1],39 ["forward", 6],40 ["up", 3],41 ["forward", 8],42 ["up", 9],43 ["forward", 1],44 ["down", 9],45 ["down", 3],46 ["down", 7],47 ["up", 2],48 ["up", 7],49 ["down", 5],50 ["forward", 3],51 ["down", 1],52 ["up", 6],53 ["down", 2],54 ["forward", 4],55 ["down", 6],56 ["down", 8],57 ["forward", 2],58 ["down", 5],59 ["forward", 6],60 ["down", 5],61 ["down", 7],62 ["forward", 8],63 ["forward", 2],64 ["down", 9],65 ["up", 4],66 ["forward", 6],67 ["forward", 4],68 ["up", 6],69 ["down", 9],70 ["down", 7],71 ["down", 9],72 ["forward", 9],73 ["forward", 8],74 ["down", 7],75 ["up", 7],76 ["forward", 9],77 ["forward", 8],78 ["up", 1],79 ["up", 4],80 ["down", 3],81 ["forward", 6],82 ["up", 6],83 ["down", 2],84 ["up", 3],85 ["down", 6],86 ["down", 5],87 ["forward", 8],88 ["forward", 3],89 ["forward", 8],90 ["down", 4],91 ["down", 4],92 ["down", 5],93 ["forward", 6],94 ["down", 5],95 ["forward", 6],96 ["down", 2],97 ["down", 5],98 ["up", 4],99 ["down", 8],100 ["up", 5],101 ["forward", 5],102 ["forward", 6],103 ["down", 9],104 ["up", 5],105 ["down", 2],106 ["forward", 5],107 ["down", 7],108 ["up", 7],109 ["down", 9],110 ["forward", 2],111 ["down", 3],112 ["down", 3],113 ["forward", 8],114 ["up", 5],115 ["up", 1],116 ["forward", 1],117 ["forward", 3],118 ["down", 5],119 ["forward", 8],120 ["forward", 7],121 ["forward", 8],122 ["down", 5],123 ["down", 8],124 ["up", 2],125 ["forward", 8],126 ["forward", 8],127 ["down", 7],128 ["forward", 1],129 ["forward", 7],130 ["down", 6],131 ["up", 4],132 ["forward", 7],133 ["forward", 7],134 ["down", 3],135 ["up", 7],136 ["forward", 2],137 ["down", 7],138 ["down", 4],139 ["forward", 5],140 ["down", 8],141 ["forward", 9],142 ["down", 7],143 ["forward", 5],144 ["up", 6],145 ["up", 6],146 ["down", 8],147 ["down", 3],148 ["forward", 5],149 ["forward", 3],150 ["down", 8],151 ["up", 7],152 ["forward", 8],153 ["up", 6],154 ["down", 2],155 ["forward", 4],156 ["up", 3],157 ["up", 3],158 ["down", 9],159 ["down", 9],160 ["up", 1],161 ["up", 7],162 ["forward", 2],163 ["down", 1],164 ["forward", 9],165 ["up", 7],166 ["up", 6],167 ["down", 2],168 ["down", 3],169 ["forward", 4],170 ["down", 3],171 ["down", 3],172 ["down", 1],173 ["forward", 4],174 ["forward", 8],175 ["forward", 6],176 ["forward", 3],177 ["up", 4],178 ["up", 5],179 ["up", 4],180 ["forward", 1],181 ["up", 3],182 ["down", 9],183 ["up", 6],184 ["forward", 2],185 ["down", 5],186 ["down", 1],187 ["forward", 8],188 ["forward", 2],189 ["down", 6],190 ["up", 5],191 ["up", 3],192 ["forward", 7],193 ["forward", 2],194 ["forward", 7],195 ["up", 9],196 ["forward", 3],197 ["up", 9],198 ["forward", 1],199 ["down", 9],200 ["forward", 9],201 ["down", 3],202 ["down", 3],203 ["down", 2],204 ["forward", 9],205 ["forward", 2],206 ["up", 3],207 ["forward", 3],208 ["down", 7],209 ["down", 3],210 ["forward", 2],211 ["forward", 1],212 ["forward", 6],213 ["up", 9],214 ["forward", 4],215 ["down", 9],216 ["down", 8],217 ["up", 3],218 ["up", 5],219 ["forward", 8],220 ["down", 9],221 ["forward", 5],222 ["forward", 4],223 ["down", 5],224 ["up", 4],225 ["forward", 7],226 ["forward", 3],227 ["down", 9],228 ["forward", 7],229 ["down", 2],230 ["down", 7],231 ["forward", 3],232 ["up", 3],233 ["forward", 7],234 ["down", 9],235 ["down", 4],236 ["down", 8],237 ["forward", 8],238 ["down", 6],239 ["forward", 9],240 ["forward", 4],241 ["up", 9],242 ["down", 9],243 ["down", 6],244 ["up", 7],245 ["up", 2],246 ["forward", 2],247 ["forward", 7],248 ["down", 7],249 ["forward", 9],250 ["down", 6],251 ["down", 2],252 ["forward", 4],253 ["forward", 8],254 ["down", 4],255 ["forward", 4],256 ["forward", 4],257 ["forward", 6],258 ["up", 6],259 ["down", 9],260 ["down", 3],261 ["down", 7],262 ["up", 2],263 ["up", 2],264 ["forward", 4],265 ["down", 4],266 ["forward", 6],267 ["down", 2],268 ["down", 2],269 ["forward", 1],270 ["down", 1],271 ["forward", 7],272 ["up", 5],273 ["forward", 9],274 ["forward", 8],275 ["down", 4],276 ["forward", 8],277 ["down", 5],278 ["up", 4],279 ["down", 8],280 ["forward", 4],281 ["forward", 7],282 ["down", 9],283 ["down", 3],284 ["forward", 6],285 ["down", 6],286 ["forward", 6],287 ["down", 9],288 ["down", 6],289 ["forward", 5],290 ["forward", 5],291 ["up", 9],292 ["down", 9],293 ["down", 9],294 ["down", 1],295 ["down", 5],296 ["forward", 5],297 ["down", 7],298 ["forward", 3],299 ["down", 6],300 ["forward", 5],301 ["forward", 8],302 ["down", 6],303 ["forward", 7],304 ["down", 5],305 ["forward", 4],306 ["down", 4],307 ["down", 9],308 ["forward", 3],309 ["down", 9],310 ["down", 9],311 ["down", 1],312 ["up", 7],313 ["forward", 4],314 ["up", 1],315 ["up", 1],316 ["forward", 1],317 ["down", 9],318 ["up", 8],319 ["down", 8],320 ["down", 3],321 ["down", 7],322 ["forward", 4],323 ["down", 5],324 ["down", 5],325 ["forward", 7],326 ["forward", 7],327 ["forward", 6],328 ["up", 2],329 ["down", 4],330 ["forward", 8],331 ["forward", 3],332 ["forward", 3],333 ["forward", 2],334 ["forward", 4],335 ["up", 9],336 ["up", 1],337 ["forward", 2],338 ["forward", 2],339 ["forward", 6],340 ["down", 9],341 ["up", 8],342 ["forward", 4],343 ["forward", 5],344 ["forward", 4],345 ["down", 4],346 ["down", 8],347 ["forward", 6],348 ["down", 8],349 ["forward", 9],350 ["forward", 8],351 ["down", 1],352 ["down", 2],353 ["forward", 2],354 ["up", 4],355 ["up", 7],356 ["forward", 5],357 ["down", 7],358 ["down", 5],359 ["down", 3],360 ["up", 7],361 ["down", 4],362 ["forward", 8],363 ["up", 8],364 ["down", 1],365 ["down", 2],366 ["up", 6],367 ["up", 8],368 ["forward", 9],369 ["down", 5],370 ["down", 2],371 ["forward", 5],372 ["forward", 4],373 ["up", 6],374 ["forward", 7],375 ["down", 3],376 ["up", 5],377 ["up", 9],378 ["forward", 5],379 ["forward", 1],380 ["down", 6],381 ["down", 7],382 ["forward", 9],383 ["down", 8],384 ["down", 2],385 ["forward", 9],386 ["forward", 2],387 ["down", 3],388 ["forward", 9],389 ["down", 3],390 ["down", 9],391 ["up", 3],392 ["forward", 7],393 ["up", 2],394 ["up", 5],395 ["forward", 3],396 ["down", 9],397 ["up", 1],398 ["down", 2],399 ["down", 4],400 ["down", 6],401 ["forward", 5],402 ["forward", 5],403 ["up", 7],404 ["up", 3],405 ["down", 1],406 ["down", 1],407 ["up", 8],408 ["down", 4],409 ["forward", 1],410 ["down", 4],411 ["down", 5],412 ["down", 9],413 ["forward", 7],414 ["up", 2],415 ["up", 1],416 ["down", 7],417 ["forward", 9],418 ["forward", 9],419 ["forward", 8],420 ["forward", 9],421 ["down", 5],422 ["forward", 9],423 ["forward", 9],424 ["up", 9],425 ["down", 7],426 ["down", 8],427 ["forward", 2],428 ["forward", 9],429 ["down", 1],430 ["forward", 3],431 ["forward", 8],432 ["up", 4],433 ["down", 4],434 ["forward", 4],435 ["forward", 3],436 ["down", 7],437 ["down", 3],438 ["forward", 6],439 ["forward", 9],440 ["forward", 1],441 ["down", 2],442 ["up", 3],443 ["down", 9],444 ["forward", 5],445 ["forward", 6],446 ["forward", 8],447 ["up", 2],448 ["up", 1],449 ["down", 3],450 ["up", 4],451 ["forward", 1],452 ["up", 9],453 ["forward", 4],454 ["down", 1],455 ["up", 2],456 ["down", 8],457 ["down", 9],458 ["forward", 3],459 ["down", 2],460 ["up", 5],461 ["forward", 2],462 ["down", 6],463 ["down", 5],464 ["down", 8],465 ["down", 3],466 ["down", 7],467 ["down", 2],468 ["forward", 8],469 ["down", 9],470 ["up", 7],471 ["down", 7],472 ["down", 7],473 ["down", 7],474 ["forward", 4],475 ["forward", 1],476 ["forward", 9],477 ["up", 9],478 ["forward", 5],479 ["forward", 8],480 ["forward", 7],481 ["forward", 7],482 ["down", 1],483 ["forward", 3],484 ["down", 7],485 ["forward", 2],486 ["forward", 4],487 ["up", 7],488 ["forward", 1],489 ["down", 5],490 ["forward", 5],491 ["forward", 1],492 ["down", 8],493 ["forward", 7],494 ["forward", 2],495 ["up", 3],496 ["down", 1],497 ["up", 7],498 ["down", 1],499 ["down", 2],500 ["forward", 9],501 ["forward", 6],502 ["forward", 3],503 ["forward", 2],504 ["down", 4],505 ["forward", 7],506 ["forward", 7],507 ["forward", 5],508 ["forward", 7],509 ["forward", 2],510 ["down", 9],511 ["down", 8],512 ["forward", 8],513 ["forward", 9],514 ["down", 3],515 ["up", 7],516 ["up", 1],517 ["down", 4],518 ["forward", 2],519 ["forward", 7],520 ["forward", 3],521 ["forward", 9],522 ["up", 2],523 ["down", 3],524 ["forward", 4],525 ["down", 8],526 ["down", 6],527 ["down", 4],528 ["down", 6],529 ["down", 7],530 ["forward", 9],531 ["down", 9],532 ["forward", 8],533 ["down", 1],534 ["down", 1],535 ["forward", 1],536 ["forward", 1],537 ["down", 7],538 ["down", 3],539 ["down", 3],540 ["forward", 2],541 ["down", 7],542 ["forward", 8],543 ["up", 7],544 ["down", 5],545 ["forward", 7],546 ["forward", 9],547 ["down", 2],548 ["forward", 9],549 ["forward", 3],550 ["forward", 9],551 ["forward", 9],552 ["down", 3],553 ["forward", 1],554 ["forward", 7],555 ["up", 8],556 ["forward", 7],557 ["forward", 4],558 ["forward", 5],559 ["forward", 6],560 ["down", 4],561 ["up", 3],562 ["down", 5],563 ["up", 8],564 ["up", 5],565 ["up", 6],566 ["forward", 1],567 ["down", 1],568 ["up", 8],569 ["down", 8],570 ["down", 5],571 ["forward", 8],572 ["up", 9],573 ["down", 8],574 ["forward", 2],575 ["up", 6],576 ["forward", 3],577 ["down", 3],578 ["down", 8],579 ["down", 4],580 ["forward", 6],581 ["forward", 2],582 ["down", 9],583 ["up", 9],584 ["down", 2],585 ["down", 9],586 ["up", 1],587 ["down", 6],588 ["up", 2],589 ["down", 9],590 ["forward", 8],591 ["forward", 3],592 ["forward", 6],593 ["down", 6],594 ["up", 9],595 ["up", 8],596 ["forward", 4],597 ["down", 2],598 ["forward", 5],599 ["up", 4],600 ["up", 4],601 ["down", 5],602 ["down", 9],603 ["forward", 3],604 ["down", 1],605 ["forward", 1],606 ["forward", 6],607 ["forward", 2],608 ["down", 7],609 ["forward", 7],610 ["up", 5],611 ["forward", 2],612 ["down", 8],613 ["forward", 5],614 ["down", 1],615 ["down", 7],616 ["forward", 7],617 ["down", 4],618 ["forward", 7],619 ["forward", 2],620 ["down", 6],621 ["forward", 9],622 ["forward", 4],623 ["up", 3],624 ["forward", 8],625 ["forward", 2],626 ["up", 6],627 ["up", 3],628 ["forward", 9],629 ["forward", 4],630 ["down", 2],631 ["forward", 6],632 ["down", 1],633 ["forward", 5],634 ["down", 2],635 ["up", 1],636 ["down", 1],637 ["forward", 2],638 ["forward", 4],639 ["down", 7],640 ["up", 6],641 ["forward", 4],642 ["forward", 7],643 ["up", 8],644 ["forward", 3],645 ["down", 8],646 ["forward", 7],647 ["down", 2],648 ["down", 5],649 ["forward", 3],650 ["forward", 7],651 ["down", 5],652 ["forward", 2],653 ["forward", 8],654 ["up", 6],655 ["forward", 8],656 ["down", 7],657 ["up", 3],658 ["down", 2],659 ["forward", 2],660 ["down", 8],661 ["down", 2],662 ["up", 5],663 ["up", 1],664 ["forward", 6],665 ["down", 1],666 ["forward", 2],667 ["down", 1],668 ["forward", 6],669 ["forward", 9],670 ["down", 9],671 ["down", 8],672 ["down", 3],673 ["forward", 5],674 ["forward", 3],675 ["down", 3],676 ["down", 1],677 ["forward", 4],678 ["forward", 8],679 ["forward", 2],680 ["down", 7],681 ["forward", 9],682 ["forward", 4],683 ["down", 4],684 ["forward", 6],685 ["down", 4],686 ["forward", 8],687 ["down", 8],688 ["down", 2],689 ["up", 7],690 ["down", 9],691 ["down", 5],692 ["up", 4],693 ["down", 3],694 ["up", 5],695 ["forward", 8],696 ["down", 4],697 ["down", 6],698 ["forward", 1],699 ["up", 2],700 ["down", 6],701 ["forward", 4],702 ["down", 8],703 ["forward", 1],704 ["up", 7],705 ["forward", 6],706 ["up", 2],707 ["forward", 1],708 ["down", 8],709 ["down", 2],710 ["forward", 3],711 ["down", 3],712 ["down", 2],713 ["up", 9],714 ["down", 3],715 ["down", 4],716 ["down", 3],717 ["forward", 9],718 ["down", 6],719 ["forward", 8],720 ["forward", 8],721 ["down", 1],722 ["forward", 8],723 ["down", 5],724 ["up", 9],725 ["up", 5],726 ["up", 5],727 ["forward", 5],728 ["forward", 4],729 ["down", 7],730 ["down", 6],731 ["forward", 9],732 ["up", 4],733 ["forward", 7],734 ["up", 5],735 ["forward", 7],736 ["down", 5],737 ["down", 3],738 ["forward", 5],739 ["down", 8],740 ["up", 3],741 ["forward", 4],742 ["up", 2],743 ["down", 1],744 ["down", 6],745 ["down", 6],746 ["up", 3],747 ["forward", 5],748 ["forward", 8],749 ["down", 2],750 ["forward", 6],751 ["down", 5],752 ["down", 4],753 ["forward", 9],754 ["down", 6],755 ["forward", 6],756 ["up", 5],757 ["forward", 4],758 ["forward", 5],759 ["forward", 1],760 ["up", 6],761 ["up", 2],762 ["down", 8],763 ["up", 4],764 ["up", 2],765 ["down", 3],766 ["forward", 4],767 ["down", 5],768 ["forward", 8],769 ["up", 5],770 ["forward", 6],771 ["forward", 9],772 ["down", 6],773 ["down", 3],774 ["up", 3],775 ["down", 2],776 ["up", 9],777 ["forward", 5],778 ["up", 5],779 ["forward", 3],780 ["forward", 2],781 ["down", 5],782 ["up", 2],783 ["down", 5],784 ["forward", 8],785 ["forward", 2],786 ["down", 1],787 ["up", 2],788 ["down", 6],789 ["up", 8],790 ["down", 3],791 ["down", 2],792 ["forward", 2],793 ["down", 1],794 ["forward", 8],795 ["forward", 2],796 ["up", 6],797 ["forward", 6],798 ["up", 3],799 ["up", 8],800 ["up", 2],801 ["up", 4],802 ["down", 7],803 ["forward", 6],804 ["down", 3],805 ["down", 2],806 ["forward", 5],807 ["down", 7],808 ["down", 6],809 ["forward", 1],810 ["down", 4],811 ["forward", 4],812 ["up", 1],813 ["down", 3],814 ["up", 3],815 ["down", 4],816 ["forward", 1],817 ["down", 2],818 ["forward", 6],819 ["down", 7],820 ["forward", 3],821 ["forward", 1],822 ["forward", 5],823 ["down", 7],824 ["down", 9],825 ["forward", 7],826 ["forward", 2],827 ["forward", 7],828 ["forward", 8],829 ["down", 1],830 ["down", 1],831 ["up", 6],832 ["forward", 2],833 ["up", 7],834 ["down", 9],835 ["up", 4],836 ["up", 9],837 ["forward", 9],838 ["forward", 6],839 ["down", 3],840 ["down", 9],841 ["forward", 1],842 ["forward", 1],843 ["up", 8],844 ["forward", 6],845 ["forward", 1],846 ["forward", 9],847 ["down", 2],848 ["down", 1],849 ["forward", 2],850 ["forward", 9],851 ["down", 9],852 ["down", 6],853 ["forward", 5],854 ["down", 6],855 ["forward", 4],856 ["down", 3],857 ["forward", 1],858 ["down", 4],859 ["up", 5],860 ["forward", 6],861 ["forward", 3],862 ["down", 2],863 ["up", 3],864 ["down", 9],865 ["down", 2],866 ["forward", 1],867 ["down", 4],868 ["up", 2],869 ["down", 6],870 ["forward", 6],871 ["forward", 7],872 ["forward", 3],873 ["forward", 9],874 ["up", 7],875 ["up", 2],876 ["forward", 2],877 ["up", 2],878 ["forward", 1],879 ["up", 2],880 ["forward", 8],881 ["forward", 5],882 ["down", 6],883 ["up", 7],884 ["down", 4],885 ["down", 1],886 ["up", 8],887 ["forward", 1],888 ["down", 3],889 ["up", 8],890 ["forward", 8],891 ["down", 6],892 ["down", 1],893 ["down", 6],894 ["forward", 1],895 ["forward", 7],896 ["up", 3],897 ["forward", 6],898 ["forward", 1],899 ["up", 3],900 ["down", 5],901 ["down", 1],902 ["forward", 5],903 ["down", 5],904 ["up", 7],905 ["up", 3],906 ["down", 6],907 ["forward", 6],908 ["up", 7],909 ["forward", 5],910 ["forward", 2],911 ["forward", 1],912 ["down", 8],913 ["forward", 3],914 ["down", 3],915 ["forward", 5],916 ["down", 4],917 ["up", 4],918 ["down", 8],919 ["down", 7],920 ["down", 7],921 ["up", 9],922 ["up", 2],923 ["down", 4],924 ["down", 1],925 ["down", 4],926 ["forward", 9],927 ["up", 8],928 ["up", 4],929 ["down", 2],930 ["forward", 8],931 ["forward", 1],932 ["down", 2],933 ["up", 5],934 ["down", 3],935 ["down", 8],936 ["down", 8],937 ["down", 6],938 ["down", 5],939 ["forward", 7],940 ["down", 3],941 ["forward", 5],942 ["down", 6],943 ["down", 9],944 ["down", 2],945 ["forward", 8],946 ["down", 4],947 ["up", 2],948 ["forward", 4],949 ["down", 8],950 ["down", 5],951 ["down", 4],952 ["forward", 2],953 ["up", 3],954 ["forward", 4],955 ["up", 3],956 ["down", 8],957 ["down", 2],958 ["up", 8],959 ["forward", 4],960 ["forward", 6],961 ["down", 3],962 ["forward", 9],963 ["forward", 6],964 ["forward", 8],965 ["forward", 5],966 ["forward", 1],967 ["forward", 5],968 ["down", 3],969 ["up", 2],970 ["forward", 4],971 ["down", 4],972 ["down", 3],973 ["forward", 1],974 ["forward", 3],975 ["forward", 7],976 ["forward", 9],977 ["down", 2],978 ["up", 4],979 ["down", 3],980 ["up", 8],981 ["forward", 9],982 ["down", 5],983 ["up", 9],984 ["down", 1],985 ["up", 4],986 ["forward", 7],987 ["forward", 2],988 ["forward", 4],989 ["up", 8],990 ["down", 4],991 ["down", 1],992 ["forward", 8],993 ["down", 4],994 ["down", 7],995 ["up", 1],996 ["down", 3],997 ["down", 2],998 ["forward", 5],999 ["up", 6],1000 ["down", 7],1001 ["forward", 2],1002];1003let horizontal = 0;1004let vertical = 0;1005for (const command of input) {1006 const [direction, value] = command;1007 if (direction === "forward") {1008 horizontal = horizontal + value;1009 }1010 if (direction === "up") {1011 vertical = vertical - value;1012 }1013 if (direction === "down") {1014 vertical = vertical + value;1015 }1016}1017console.log("Part 1", horizontal * vertical);1018horizontal = 0;1019vertical = 0;1020aim = 0;1021for (const command of input) {1022 const [direction, value] = command;1023 if (direction === "forward") {1024 horizontal = horizontal + value;1025 vertical = vertical + aim * value;1026 }1027 if (direction === "up") {1028 aim = aim - value;1029 }1030 if (direction === "down") {1031 aim = aim + value;1032 }1033}...
day_two.js
Source:day_two.js
1// QUESTION https://adventofcode.com/2021/day/22let coords = new Array(3 ["forward", 6],4 ["forward", 8],5 ["down", 6],6 ["down", 6],7 ["forward", 9],8 ["down", 7],9 ["down", 3],10 ["forward", 4],11 ["forward", 7],12 ["up", 3],13 ["forward", 9],14 ["up", 4],15 ["forward", 4],16 ["down", 3],17 ["up", 2],18 ["forward", 2],19 ["down", 4],20 ["forward", 9],21 ["up", 4],22 ["forward", 8],23 ["up", 9],24 ["forward", 3],25 ["down", 7],26 ["down", 4],27 ["down", 7],28 ["up", 5],29 ["down", 5],30 ["down", 5],31 ["forward", 5],32 ["up", 9],33 ["down", 5],34 ["down", 3],35 ["up", 3],36 ["forward", 2],37 ["forward", 2],38 ["down", 2],39 ["forward", 1],40 ["down", 4],41 ["down", 1],42 ["down", 6],43 ["down", 9],44 ["forward", 4],45 ["forward", 7],46 ["down", 4],47 ["up", 7],48 ["forward", 8],49 ["down", 3],50 ["down", 6],51 ["down", 5],52 ["down", 2],53 ["down", 1],54 ["up", 9],55 ["forward", 2],56 ["forward", 3],57 ["up", 3],58 ["forward", 5],59 ["down", 4],60 ["up", 3],61 ["up", 9],62 ["forward", 6],63 ["up", 5],64 ["up", 8],65 ["up", 8],66 ["forward", 6],67 ["up", 1],68 ["forward", 4],69 ["down", 4],70 ["forward", 9],71 ["down", 9],72 ["down", 7],73 ["forward", 5],74 ["down", 7],75 ["forward", 7],76 ["up", 2],77 ["down", 9],78 ["down", 2],79 ["forward", 8],80 ["forward", 9],81 ["down", 4],82 ["down", 4],83 ["down", 7],84 ["down", 4],85 ["down", 8],86 ["forward", 4],87 ["down", 9],88 ["down", 6],89 ["forward", 8],90 ["down", 8],91 ["down", 8],92 ["forward", 7],93 ["up", 9],94 ["forward", 7],95 ["up", 3],96 ["down", 5],97 ["forward", 9],98 ["down", 7],99 ["down", 5],100 ["down", 8],101 ["forward", 5],102 ["down", 1],103 ["down", 5],104 ["down", 5],105 ["forward", 8],106 ["down", 8],107 ["up", 8],108 ["down", 6],109 ["down", 3],110 ["forward", 1],111 ["down", 2],112 ["down", 3],113 ["up", 4],114 ["forward", 8],115 ["down", 6],116 ["up", 8],117 ["forward", 2],118 ["forward", 8],119 ["forward", 9],120 ["forward", 5],121 ["forward", 5],122 ["forward", 2],123 ["forward", 1],124 ["down", 8],125 ["forward", 8],126 ["forward", 9],127 ["up", 8],128 ["up", 8],129 ["down", 7],130 ["down", 5],131 ["forward", 1],132 ["forward", 1],133 ["up", 9],134 ["up", 3],135 ["forward", 5],136 ["down", 8],137 ["down", 4],138 ["up", 2],139 ["down", 7],140 ["down", 4],141 ["down", 3],142 ["forward", 3],143 ["forward", 7],144 ["forward", 3],145 ["forward", 1],146 ["forward", 8],147 ["down", 9],148 ["up", 4],149 ["down", 8],150 ["down", 3],151 ["down", 9],152 ["up", 8],153 ["up", 6],154 ["up", 9],155 ["up", 2],156 ["down", 9],157 ["down", 9],158 ["down", 6],159 ["up", 3],160 ["down", 4],161 ["down", 3],162 ["down", 9],163 ["forward", 2],164 ["forward", 2],165 ["forward", 7],166 ["forward", 9],167 ["up", 5],168 ["up", 8],169 ["forward", 8],170 ["down", 8],171 ["up", 7],172 ["forward", 4],173 ["up", 7],174 ["up", 7],175 ["down", 9],176 ["down", 7],177 ["down", 1],178 ["forward", 4],179 ["forward", 6],180 ["up", 4],181 ["forward", 7],182 ["up", 4],183 ["down", 6],184 ["forward", 2],185 ["up", 4],186 ["forward", 2],187 ["up", 2],188 ["down", 4],189 ["down", 2],190 ["forward", 4],191 ["forward", 8],192 ["down", 9],193 ["up", 7],194 ["forward", 3],195 ["down", 5],196 ["down", 2],197 ["down", 7],198 ["up", 9],199 ["down", 2],200 ["up", 5],201 ["down", 9],202 ["down", 4],203 ["forward", 8],204 ["forward", 9],205 ["down", 7],206 ["up", 3],207 ["down", 4],208 ["up", 3],209 ["down", 3],210 ["down", 3],211 ["up", 5],212 ["forward", 7],213 ["down", 8],214 ["down", 1],215 ["up", 7],216 ["forward", 8],217 ["forward", 9],218 ["forward", 3],219 ["forward", 1],220 ["up", 4],221 ["forward", 4],222 ["down", 6],223 ["forward", 3],224 ["down", 9],225 ["forward", 2],226 ["up", 8],227 ["down", 4],228 ["forward", 7],229 ["forward", 1],230 ["up", 9],231 ["forward", 6],232 ["down", 1],233 ["down", 8],234 ["forward", 7],235 ["forward", 8],236 ["forward", 2],237 ["up", 6],238 ["forward", 3],239 ["forward", 2],240 ["forward", 7],241 ["down", 6],242 ["up", 8],243 ["down", 2],244 ["down", 8],245 ["forward", 6],246 ["forward", 1],247 ["up", 9],248 ["down", 8],249 ["down", 4],250 ["forward", 3],251 ["down", 2],252 ["forward", 1],253 ["forward", 8],254 ["down", 9],255 ["down", 9],256 ["forward", 3],257 ["down", 5],258 ["down", 5],259 ["down", 1],260 ["down", 3],261 ["up", 3],262 ["down", 6],263 ["forward", 9],264 ["forward", 7],265 ["up", 5],266 ["forward", 8],267 ["up", 1],268 ["up", 4],269 ["down", 8],270 ["up", 3],271 ["forward", 1],272 ["up", 9],273 ["forward", 5],274 ["down", 8],275 ["down", 1],276 ["up", 3],277 ["down", 1],278 ["down", 7],279 ["forward", 2],280 ["down", 9],281 ["forward", 3],282 ["down", 2],283 ["up", 5],284 ["down", 5],285 ["forward", 9],286 ["down", 2],287 ["down", 3],288 ["forward", 4],289 ["forward", 2],290 ["down", 5],291 ["forward", 9],292 ["down", 5],293 ["forward", 9],294 ["down", 9],295 ["down", 8],296 ["forward", 8],297 ["forward", 9],298 ["down", 2],299 ["forward", 4],300 ["forward", 9],301 ["up", 1],302 ["down", 2],303 ["down", 5],304 ["forward", 8],305 ["forward", 5],306 ["up", 5],307 ["forward", 2],308 ["up", 8],309 ["forward", 3],310 ["down", 2],311 ["forward", 1],312 ["forward", 7],313 ["forward", 7],314 ["forward", 1],315 ["up", 9],316 ["down", 5],317 ["down", 3],318 ["down", 7],319 ["forward", 2],320 ["up", 5],321 ["forward", 1],322 ["forward", 7],323 ["up", 7],324 ["down", 3],325 ["up", 5],326 ["down", 1],327 ["forward", 9],328 ["down", 7],329 ["forward", 4],330 ["forward", 5],331 ["down", 1],332 ["down", 5],333 ["up", 7],334 ["forward", 1],335 ["down", 4],336 ["down", 8],337 ["down", 6],338 ["forward", 8],339 ["forward", 4],340 ["forward", 2],341 ["up", 8],342 ["down", 5],343 ["down", 2],344 ["forward", 2],345 ["down", 1],346 ["down", 8],347 ["down", 5],348 ["forward", 5],349 ["forward", 8],350 ["down", 9],351 ["forward", 1],352 ["forward", 3],353 ["down", 3],354 ["down", 1],355 ["down", 5],356 ["forward", 6],357 ["forward", 6],358 ["down", 3],359 ["forward", 5],360 ["forward", 8],361 ["down", 9],362 ["down", 9],363 ["forward", 4],364 ["forward", 4],365 ["forward", 1],366 ["forward", 7],367 ["down", 6],368 ["up", 2],369 ["down", 2],370 ["up", 6],371 ["forward", 7],372 ["forward", 8],373 ["up", 3],374 ["down", 7],375 ["up", 9],376 ["down", 5],377 ["down", 7],378 ["down", 7],379 ["forward", 3],380 ["down", 3],381 ["up", 9],382 ["up", 5],383 ["forward", 4],384 ["down", 7],385 ["down", 7],386 ["forward", 1],387 ["down", 1],388 ["down", 2],389 ["forward", 8],390 ["down", 9],391 ["down", 2],392 ["forward", 3],393 ["forward", 5],394 ["down", 4],395 ["up", 7],396 ["forward", 1],397 ["forward", 4],398 ["forward", 7],399 ["forward", 1],400 ["up", 1],401 ["down", 6],402 ["forward", 2],403 ["down", 1],404 ["forward", 2],405 ["forward", 7],406 ["forward", 7],407 ["up", 3],408 ["down", 8],409 ["forward", 6],410 ["forward", 1],411 ["down", 6],412 ["down", 8],413 ["down", 1],414 ["up", 3],415 ["up", 6],416 ["down", 6],417 ["down", 1],418 ["up", 8],419 ["forward", 6],420 ["up", 6],421 ["forward", 5],422 ["up", 4],423 ["up", 7],424 ["up", 4],425 ["down", 5],426 ["forward", 2],427 ["forward", 7],428 ["down", 1],429 ["forward", 6],430 ["down", 5],431 ["up", 3],432 ["up", 4],433 ["forward", 1],434 ["up", 4],435 ["forward", 7],436 ["up", 5],437 ["up", 1],438 ["up", 2],439 ["forward", 4],440 ["forward", 2],441 ["forward", 7],442 ["down", 6],443 ["forward", 1],444 ["up", 5],445 ["up", 2],446 ["down", 8],447 ["forward", 5],448 ["up", 2],449 ["down", 9],450 ["up", 4],451 ["down", 2],452 ["down", 1],453 ["forward", 8],454 ["down", 2],455 ["up", 8],456 ["down", 8],457 ["up", 7],458 ["up", 4],459 ["up", 2],460 ["forward", 8],461 ["up", 1],462 ["up", 6],463 ["forward", 8],464 ["forward", 8],465 ["forward", 2],466 ["down", 5],467 ["up", 2],468 ["down", 1],469 ["forward", 2],470 ["up", 5],471 ["forward", 4],472 ["forward", 9],473 ["down", 1],474 ["down", 6],475 ["forward", 4],476 ["down", 3],477 ["down", 7],478 ["down", 5],479 ["down", 6],480 ["up", 6],481 ["forward", 4],482 ["down", 2],483 ["down", 4],484 ["down", 3],485 ["forward", 3],486 ["forward", 2],487 ["up", 7],488 ["forward", 7],489 ["forward", 6],490 ["forward", 3],491 ["forward", 1],492 ["forward", 8],493 ["forward", 3],494 ["forward", 2],495 ["forward", 3],496 ["forward", 9],497 ["down", 3],498 ["forward", 9],499 ["up", 9],500 ["up", 1],501 ["down", 8],502 ["down", 2],503 ["up", 9],504 ["down", 8],505 ["forward", 5],506 ["down", 8],507 ["up", 8],508 ["down", 3],509 ["up", 7],510 ["down", 3],511 ["down", 7],512 ["up", 9],513 ["up", 8],514 ["down", 5],515 ["down", 1],516 ["forward", 1],517 ["down", 9],518 ["forward", 5],519 ["down", 1],520 ["forward", 5],521 ["forward", 6],522 ["up", 2],523 ["forward", 5],524 ["down", 2],525 ["up", 3],526 ["forward", 8],527 ["forward", 9],528 ["down", 1],529 ["up", 9],530 ["forward", 6],531 ["down", 9],532 ["down", 2],533 ["forward", 2],534 ["forward", 4],535 ["forward", 9],536 ["forward", 3],537 ["down", 6],538 ["down", 9],539 ["forward", 8],540 ["forward", 3],541 ["down", 9],542 ["up", 6],543 ["forward", 5],544 ["forward", 8],545 ["down", 7],546 ["forward", 9],547 ["forward", 5],548 ["forward", 4],549 ["forward", 3],550 ["down", 9],551 ["forward", 7],552 ["forward", 7],553 ["forward", 8],554 ["down", 7],555 ["down", 3],556 ["up", 5],557 ["forward", 2],558 ["up", 6],559 ["down", 6],560 ["down", 5],561 ["up", 2],562 ["down", 1],563 ["forward", 7],564 ["forward", 3],565 ["down", 2],566 ["up", 4],567 ["forward", 8],568 ["down", 8],569 ["down", 2],570 ["forward", 8],571 ["up", 8],572 ["forward", 1],573 ["forward", 1],574 ["down", 1],575 ["forward", 4],576 ["forward", 7],577 ["forward", 2],578 ["forward", 6],579 ["down", 9],580 ["down", 2],581 ["up", 7],582 ["up", 5],583 ["forward", 4],584 ["down", 3],585 ["down", 4],586 ["up", 7],587 ["forward", 7],588 ["up", 6],589 ["forward", 6],590 ["up", 4],591 ["forward", 5],592 ["forward", 7],593 ["forward", 3],594 ["down", 2],595 ["forward", 2],596 ["forward", 2],597 ["up", 1],598 ["down", 8],599 ["up", 7],600 ["down", 4],601 ["down", 9],602 ["forward", 2],603 ["forward", 9],604 ["down", 7],605 ["down", 4],606 ["down", 8],607 ["forward", 9],608 ["up", 1],609 ["forward", 6],610 ["forward", 7],611 ["down", 3],612 ["forward", 9],613 ["forward", 3],614 ["down", 3],615 ["up", 2],616 ["down", 8],617 ["down", 7],618 ["forward", 1],619 ["down", 9],620 ["up", 3],621 ["forward", 6],622 ["forward", 1],623 ["forward", 7],624 ["down", 3],625 ["forward", 2],626 ["forward", 1],627 ["down", 8],628 ["down", 7],629 ["forward", 1],630 ["forward", 5],631 ["down", 7],632 ["up", 7],633 ["forward", 4],634 ["down", 3],635 ["forward", 7],636 ["forward", 2],637 ["up", 2],638 ["forward", 1],639 ["up", 2],640 ["up", 6],641 ["forward", 3],642 ["forward", 2],643 ["down", 3],644 ["down", 7],645 ["down", 2],646 ["down", 9],647 ["down", 6],648 ["forward", 8],649 ["down", 4],650 ["forward", 6],651 ["up", 7],652 ["down", 8],653 ["up", 5],654 ["down", 8],655 ["up", 6],656 ["down", 2],657 ["down", 1],658 ["forward", 9],659 ["forward", 8],660 ["down", 6],661 ["down", 3],662 ["up", 8],663 ["down", 1],664 ["forward", 2],665 ["down", 6],666 ["forward", 4],667 ["forward", 9],668 ["forward", 6],669 ["down", 2],670 ["down", 9],671 ["up", 3],672 ["forward", 8],673 ["forward", 1],674 ["forward", 6],675 ["forward", 8],676 ["forward", 4],677 ["forward", 8],678 ["up", 7],679 ["down", 7],680 ["forward", 7],681 ["down", 6],682 ["forward", 1],683 ["down", 9],684 ["forward", 5],685 ["down", 3],686 ["down", 6],687 ["down", 6],688 ["down", 9],689 ["forward", 8],690 ["forward", 5],691 ["down", 4],692 ["forward", 1],693 ["down", 8],694 ["down", 5],695 ["down", 5],696 ["down", 9],697 ["forward", 1],698 ["forward", 1],699 ["forward", 9],700 ["forward", 5],701 ["down", 4],702 ["forward", 3],703 ["down", 2],704 ["forward", 3],705 ["up", 7],706 ["down", 2],707 ["down", 5],708 ["down", 4],709 ["up", 2],710 ["forward", 7],711 ["down", 3],712 ["down", 4],713 ["down", 8],714 ["down", 2],715 ["forward", 3],716 ["up", 8],717 ["down", 9],718 ["down", 1],719 ["down", 2],720 ["forward", 3],721 ["down", 1],722 ["down", 7],723 ["down", 9],724 ["forward", 9],725 ["forward", 7],726 ["down", 2],727 ["down", 5],728 ["up", 8],729 ["forward", 1],730 ["forward", 2],731 ["forward", 6],732 ["up", 3],733 ["forward", 3],734 ["down", 6],735 ["forward", 1],736 ["up", 8],737 ["down", 3],738 ["down", 1],739 ["forward", 6],740 ["up", 7],741 ["forward", 3],742 ["down", 5],743 ["down", 5],744 ["up", 8],745 ["down", 4],746 ["forward", 1],747 ["up", 5],748 ["down", 4],749 ["forward", 5],750 ["up", 6],751 ["forward", 2],752 ["up", 4],753 ["forward", 9],754 ["forward", 1],755 ["forward", 9],756 ["forward", 5],757 ["forward", 9],758 ["up", 2],759 ["forward", 8],760 ["forward", 6],761 ["down", 5],762 ["forward", 9],763 ["forward", 7],764 ["down", 1],765 ["forward", 7],766 ["forward", 7],767 ["forward", 3],768 ["up", 9],769 ["down", 2],770 ["up", 7],771 ["down", 1],772 ["up", 7],773 ["forward", 6],774 ["forward", 2],775 ["forward", 5],776 ["forward", 6],777 ["down", 4],778 ["down", 8],779 ["forward", 6],780 ["down", 1],781 ["forward", 7],782 ["up", 8],783 ["forward", 7],784 ["up", 5],785 ["down", 2],786 ["forward", 9],787 ["forward", 7],788 ["forward", 8],789 ["up", 2],790 ["down", 9],791 ["forward", 5],792 ["forward", 8],793 ["forward", 5],794 ["forward", 7],795 ["down", 8],796 ["down", 8],797 ["up", 4],798 ["down", 8],799 ["up", 2],800 ["up", 6],801 ["down", 2],802 ["forward", 2],803 ["forward", 9],804 ["forward", 8],805 ["forward", 3],806 ["up", 3],807 ["up", 1],808 ["down", 3],809 ["forward", 7],810 ["down", 2],811 ["up", 2],812 ["forward", 5],813 ["down", 3],814 ["forward", 2],815 ["forward", 4],816 ["up", 2],817 ["down", 1],818 ["down", 5],819 ["up", 6],820 ["down", 7],821 ["up", 7],822 ["up", 6],823 ["forward", 5],824 ["down", 7],825 ["forward", 9],826 ["forward", 2],827 ["up", 8],828 ["down", 1],829 ["down", 6],830 ["forward", 9],831 ["down", 8],832 ["up", 7],833 ["down", 6],834 ["forward", 9],835 ["forward", 2],836 ["down", 1],837 ["up", 4],838 ["up", 7],839 ["down", 7],840 ["up", 6],841 ["forward", 4],842 ["up", 1],843 ["forward", 5],844 ["forward", 9],845 ["down", 3],846 ["up", 2],847 ["down", 3],848 ["up", 7],849 ["down", 8],850 ["forward", 1],851 ["down", 9],852 ["down", 1],853 ["down", 9],854 ["forward", 8],855 ["down", 4],856 ["down", 7],857 ["down", 7],858 ["forward", 4],859 ["up", 5],860 ["forward", 1],861 ["forward", 7],862 ["down", 9],863 ["forward", 6],864 ["up", 8],865 ["down", 5],866 ["down", 8],867 ["up", 9],868 ["forward", 6],869 ["down", 1],870 ["forward", 8],871 ["up", 8],872 ["up", 1],873 ["up", 7],874 ["down", 9],875 ["forward", 8],876 ["down", 8],877 ["forward", 4],878 ["down", 1],879 ["down", 5],880 ["forward", 9],881 ["down", 7],882 ["forward", 3],883 ["forward", 1],884 ["forward", 2],885 ["down", 9],886 ["up", 2],887 ["up", 1],888 ["forward", 6],889 ["up", 1],890 ["down", 3],891 ["forward", 3],892 ["down", 7],893 ["down", 4],894 ["forward", 2],895 ["forward", 8],896 ["forward", 7],897 ["down", 6],898 ["up", 1],899 ["forward", 8],900 ["down", 8],901 ["forward", 5],902 ["down", 4],903 ["forward", 2],904 ["up", 8],905 ["down", 5],906 ["down", 9],907 ["forward", 1],908 ["down", 8],909 ["down", 5],910 ["forward", 6],911 ["down", 1],912 ["down", 6],913 ["up", 5],914 ["up", 8],915 ["forward", 7],916 ["forward", 4],917 ["down", 5],918 ["down", 1],919 ["forward", 4],920 ["up", 9],921 ["forward", 9],922 ["up", 7],923 ["down", 4],924 ["forward", 8],925 ["forward", 5],926 ["up", 8],927 ["down", 9],928 ["up", 8],929 ["forward", 7],930 ["down", 8],931 ["forward", 4],932 ["down", 8],933 ["up", 7],934 ["forward", 4],935 ["down", 9],936 ["forward", 5],937 ["up", 7],938 ["forward", 5],939 ["forward", 9],940 ["down", 6],941 ["up", 6],942 ["forward", 2],943 ["down", 4],944 ["down", 8],945 ["forward", 9],946 ["forward", 4],947 ["forward", 6],948 ["up", 6],949 ["down", 6],950 ["forward", 6],951 ["forward", 7],952 ["forward", 5],953 ["forward", 3],954 ["forward", 7],955 ["up", 3],956 ["down", 6],957 ["forward", 2],958 ["down", 9],959 ["up", 8],960 ["down", 2],961 ["forward", 7],962 ["down", 9],963 ["down", 3],964 ["up", 9],965 ["up", 6],966 ["down", 6],967 ["forward", 8],968 ["up", 2],969 ["up", 1],970 ["down", 5],971 ["forward", 4],972 ["down", 2],973 ["up", 2],974 ["forward", 2],975 ["forward", 3],976 ["up", 5],977 ["down", 6],978 ["forward", 9],979 ["up", 3],980 ["forward", 6],981 ["forward", 4],982 ["down", 3],983 ["up", 9],984 ["forward", 1],985 ["up", 6],986 ["down", 9],987 ["down", 7],988 ["forward", 5],989 ["down", 2],990 ["down", 6],991 ["forward", 5],992 ["forward", 1],993 ["forward", 5],994 ["forward", 8],995 ["up", 2],996 ["forward", 9],997 ["down", 8],998 ["forward", 2],999 ["down", 6],1000 ["down", 1],1001 ["down", 9],1002 ["forward", 6]1003);1004let coordSample = [1005 ["forward", 5],1006 ["down", 5],1007 ["forward", 8],1008 ["up", 3],1009 ["down", 8],1010 ["forward", 2],1011];1012// down X increases your aim by X units.1013// up X decreases your aim by X units.1014// forward X does two things:1015// It increases your horizontal position by X units.1016// It increases your depth by your aim multiplied by X.1017let depth = 0;1018let hor = 0;1019let aim = 0;1020for (let [k, v] of coords) {1021 if (k === "down") aim += v;1022 if (k === "up") aim -= v;1023 if (k === "forward") {1024 hor += v;1025 depth += aim * v;1026 }1027}...
input.js
Source:input.js
1const input = [2 'forward 8',3 'down 9',4 'up 1',5 'forward 2',6 'down 6',7 'forward 6',8 'down 5',9 'down 4',10 'down 2',11 'forward 3',12 'forward 8',13 'down 6',14 'up 3',15 'up 3',16 'down 5',17 'up 8',18 'forward 8',19 'up 6',20 'forward 4',21 'down 8',22 'up 2',23 'up 6',24 'forward 7',25 'up 6',26 'down 6',27 'down 1',28 'forward 8',29 'up 7',30 'forward 9',31 'forward 5',32 'forward 8',33 'forward 5',34 'down 3',35 'forward 5',36 'up 1',37 'forward 6',38 'forward 3',39 'forward 3',40 'down 2',41 'forward 4',42 'down 3',43 'forward 6',44 'forward 2',45 'forward 1',46 'down 2',47 'forward 1',48 'down 1',49 'up 8',50 'down 4',51 'forward 3',52 'up 3',53 'down 5',54 'down 2',55 'forward 7',56 'forward 1',57 'down 9',58 'up 1',59 'down 1',60 'forward 2',61 'forward 1',62 'forward 1',63 'forward 7',64 'up 5',65 'forward 2',66 'down 6',67 'down 7',68 'down 3',69 'down 1',70 'forward 4',71 'forward 5',72 'down 3',73 'forward 4',74 'down 5',75 'forward 3',76 'forward 4',77 'forward 2',78 'up 8',79 'down 7',80 'up 3',81 'forward 2',82 'down 5',83 'forward 9',84 'forward 5',85 'up 1',86 'down 5',87 'down 6',88 'forward 2',89 'forward 5',90 'down 6',91 'down 1',92 'up 8',93 'up 9',94 'down 7',95 'down 5',96 'forward 2',97 'forward 7',98 'forward 7',99 'up 6',100 'down 4',101 'up 6',102 'forward 2',103 'down 4',104 'down 3',105 'down 4',106 'forward 2',107 'down 2',108 'down 1',109 'down 4',110 'up 4',111 'forward 7',112 'forward 6',113 'forward 2',114 'forward 5',115 'forward 1',116 'forward 7',117 'forward 2',118 'down 3',119 'forward 7',120 'forward 2',121 'up 4',122 'up 5',123 'down 1',124 'down 2',125 'down 3',126 'down 7',127 'up 8',128 'forward 4',129 'down 5',130 'down 4',131 'forward 3',132 'down 6',133 'forward 5',134 'up 5',135 'forward 6',136 'down 1',137 'down 7',138 'forward 1',139 'forward 6',140 'up 9',141 'forward 2',142 'down 1',143 'forward 5',144 'forward 2',145 'forward 6',146 'forward 8',147 'forward 6',148 'down 8',149 'forward 3',150 'down 9',151 'up 8',152 'forward 9',153 'down 7',154 'down 6',155 'down 1',156 'up 5',157 'down 6',158 'forward 7',159 'up 9',160 'forward 8',161 'forward 3',162 'forward 3',163 'forward 2',164 'down 6',165 'up 1',166 'up 5',167 'forward 7',168 'down 2',169 'down 5',170 'down 1',171 'down 4',172 'forward 8',173 'forward 2',174 'forward 8',175 'up 5',176 'forward 7',177 'up 7',178 'forward 6',179 'forward 9',180 'up 1',181 'down 4',182 'forward 8',183 'forward 4',184 'down 9',185 'up 6',186 'down 8',187 'up 9',188 'down 2',189 'down 2',190 'down 9',191 'up 3',192 'down 7',193 'down 2',194 'up 9',195 'forward 9',196 'down 5',197 'forward 2',198 'forward 1',199 'forward 2',200 'down 4',201 'forward 4',202 'down 2',203 'forward 8',204 'up 3',205 'forward 6',206 'up 7',207 'up 9',208 'forward 4',209 'up 9',210 'down 5',211 'forward 5',212 'up 6',213 'down 2',214 'down 4',215 'forward 1',216 'down 2',217 'forward 3',218 'down 7',219 'down 1',220 'down 5',221 'forward 5',222 'up 5',223 'forward 3',224 'down 5',225 'forward 7',226 'down 3',227 'down 2',228 'up 9',229 'down 4',230 'forward 4',231 'down 4',232 'forward 1',233 'up 9',234 'down 8',235 'forward 2',236 'down 7',237 'forward 8',238 'down 5',239 'up 2',240 'down 9',241 'down 2',242 'up 4',243 'up 2',244 'forward 8',245 'forward 3',246 'forward 4',247 'down 1',248 'down 3',249 'forward 3',250 'down 8',251 'forward 7',252 'down 7',253 'forward 5',254 'forward 5',255 'up 3',256 'down 6',257 'forward 1',258 'down 4',259 'forward 2',260 'down 4',261 'up 2',262 'down 3',263 'forward 4',264 'forward 6',265 'up 7',266 'down 3',267 'forward 7',268 'forward 1',269 'down 1',270 'up 3',271 'down 7',272 'up 3',273 'up 8',274 'up 7',275 'up 7',276 'forward 7',277 'down 2',278 'forward 6',279 'forward 7',280 'up 3',281 'down 3',282 'up 9',283 'down 6',284 'down 7',285 'down 7',286 'up 5',287 'forward 6',288 'forward 2',289 'up 9',290 'forward 2',291 'down 3',292 'down 3',293 'forward 5',294 'forward 3',295 'forward 6',296 'forward 6',297 'down 7',298 'forward 2',299 'down 3',300 'up 4',301 'forward 1',302 'forward 5',303 'down 5',304 'up 1',305 'down 9',306 'forward 3',307 'up 6',308 'forward 5',309 'down 4',310 'forward 9',311 'up 5',312 'forward 7',313 'up 7',314 'forward 9',315 'forward 2',316 'forward 6',317 'forward 3',318 'forward 3',319 'up 7',320 'down 1',321 'down 1',322 'forward 1',323 'down 8',324 'down 2',325 'forward 4',326 'up 7',327 'forward 7',328 'down 5',329 'down 7',330 'up 6',331 'down 4',332 'forward 4',333 'forward 4',334 'up 7',335 'down 9',336 'forward 6',337 'forward 1',338 'down 7',339 'forward 5',340 'forward 2',341 'forward 1',342 'up 7',343 'down 9',344 'forward 2',345 'down 7',346 'up 8',347 'forward 1',348 'forward 4',349 'up 4',350 'forward 1',351 'down 9',352 'down 5',353 'down 8',354 'forward 8',355 'forward 8',356 'down 8',357 'down 3',358 'down 5',359 'down 6',360 'up 9',361 'forward 1',362 'down 1',363 'forward 1',364 'forward 1',365 'down 6',366 'forward 3',367 'down 1',368 'forward 9',369 'forward 3',370 'up 7',371 'down 9',372 'forward 5',373 'down 4',374 'up 9',375 'down 2',376 'down 5',377 'down 6',378 'forward 1',379 'up 2',380 'forward 9',381 'up 7',382 'forward 2',383 'forward 8',384 'down 5',385 'down 6',386 'down 8',387 'forward 4',388 'down 4',389 'forward 9',390 'forward 3',391 'forward 6',392 'forward 9',393 'up 2',394 'down 8',395 'up 2',396 'up 6',397 'up 5',398 'down 5',399 'down 7',400 'forward 1',401 'up 6',402 'forward 9',403 'up 4',404 'forward 4',405 'up 2',406 'forward 3',407 'down 8',408 'down 1',409 'up 5',410 'forward 5',411 'down 3',412 'down 4',413 'down 1',414 'forward 3',415 'up 2',416 'forward 3',417 'down 1',418 'forward 8',419 'up 3',420 'forward 4',421 'down 3',422 'forward 6',423 'down 9',424 'down 7',425 'forward 3',426 'forward 5',427 'forward 1',428 'forward 3',429 'up 8',430 'forward 2',431 'forward 2',432 'forward 7',433 'up 9',434 'forward 4',435 'down 1',436 'down 6',437 'forward 8',438 'forward 5',439 'up 4',440 'up 5',441 'up 9',442 'forward 9',443 'up 8',444 'down 3',445 'up 5',446 'forward 1',447 'forward 5',448 'up 9',449 'forward 8',450 'forward 4',451 'forward 3',452 'forward 1',453 'forward 6',454 'down 2',455 'up 8',456 'down 7',457 'down 1',458 'down 5',459 'up 1',460 'forward 9',461 'down 2',462 'down 4',463 'forward 3',464 'forward 1',465 'down 7',466 'up 9',467 'up 7',468 'down 2',469 'down 4',470 'down 1',471 'forward 9',472 'up 4',473 'down 9',474 'down 9',475 'down 4',476 'down 9',477 'forward 1',478 'down 2',479 'forward 8',480 'up 4',481 'up 3',482 'forward 4',483 'down 5',484 'forward 8',485 'forward 2',486 'forward 4',487 'up 3',488 'up 2',489 'up 3',490 'forward 4',491 'forward 4',492 'forward 6',493 'down 7',494 'down 8',495 'up 3',496 'down 9',497 'down 5',498 'up 7',499 'up 1',500 'down 3',501 'down 4',502 'up 5',503 'up 9',504 'down 2',505 'up 8',506 'forward 9',507 'down 3',508 'forward 4',509 'down 5',510 'down 1',511 'forward 9',512 'forward 2',513 'up 3',514 'down 9',515 'down 8',516 'up 7',517 'forward 2',518 'down 9',519 'up 8',520 'up 2',521 'down 3',522 'forward 3',523 'forward 3',524 'forward 3',525 'forward 4',526 'down 7',527 'up 2',528 'forward 3',529 'forward 7',530 'forward 5',531 'forward 7',532 'down 6',533 'down 9',534 'down 6',535 'down 8',536 'up 4',537 'down 4',538 'down 2',539 'up 1',540 'down 3',541 'forward 7',542 'forward 5',543 'down 7',544 'forward 1',545 'up 7',546 'forward 9',547 'down 8',548 'down 1',549 'down 3',550 'down 1',551 'up 8',552 'forward 7',553 'up 5',554 'forward 6',555 'down 1',556 'down 8',557 'up 1',558 'up 9',559 'forward 7',560 'down 9',561 'forward 3',562 'forward 8',563 'forward 7',564 'down 3',565 'down 5',566 'up 3',567 'up 7',568 'up 3',569 'up 6',570 'up 8',571 'down 3',572 'forward 7',573 'down 7',574 'forward 9',575 'up 9',576 'down 1',577 'down 3',578 'down 8',579 'down 6',580 'forward 1',581 'up 6',582 'down 1',583 'up 4',584 'down 2',585 'forward 9',586 'up 8',587 'up 2',588 'down 6',589 'down 1',590 'forward 2',591 'forward 6',592 'forward 1',593 'forward 2',594 'up 6',595 'down 7',596 'down 8',597 'forward 9',598 'up 2',599 'down 6',600 'down 8',601 'down 5',602 'up 6',603 'forward 6',604 'down 5',605 'forward 4',606 'forward 2',607 'down 1',608 'down 4',609 'up 5',610 'down 5',611 'down 1',612 'down 9',613 'down 1',614 'down 1',615 'forward 1',616 'forward 5',617 'up 4',618 'down 5',619 'down 3',620 'down 2',621 'down 7',622 'forward 5',623 'forward 6',624 'forward 2',625 'up 9',626 'up 3',627 'forward 6',628 'down 4',629 'forward 8',630 'forward 4',631 'forward 9',632 'down 6',633 'down 9',634 'down 1',635 'forward 6',636 'down 8',637 'down 7',638 'forward 5',639 'down 4',640 'forward 5',641 'forward 5',642 'up 3',643 'down 1',644 'down 4',645 'forward 1',646 'forward 7',647 'down 5',648 'down 4',649 'forward 7',650 'forward 3',651 'forward 4',652 'down 4',653 'forward 8',654 'up 2',655 'up 6',656 'down 9',657 'up 1',658 'down 8',659 'up 2',660 'up 6',661 'forward 5',662 'forward 7',663 'up 4',664 'down 4',665 'down 8',666 'forward 5',667 'up 4',668 'down 6',669 'forward 9',670 'up 4',671 'forward 7',672 'up 7',673 'down 3',674 'down 2',675 'down 2',676 'down 6',677 'down 4',678 'forward 4',679 'down 3',680 'down 4',681 'down 4',682 'down 8',683 'up 2',684 'down 3',685 'forward 5',686 'forward 5',687 'up 5',688 'forward 1',689 'down 7',690 'forward 5',691 'forward 7',692 'forward 9',693 'forward 4',694 'down 1',695 'down 1',696 'up 5',697 'down 6',698 'down 8',699 'down 9',700 'down 9',701 'forward 7',702 'down 6',703 'forward 3',704 'down 7',705 'up 3',706 'forward 5',707 'forward 5',708 'up 6',709 'down 5',710 'down 8',711 'down 5',712 'down 1',713 'down 7',714 'forward 8',715 'up 9',716 'forward 2',717 'up 1',718 'down 9',719 'down 2',720 'forward 7',721 'up 1',722 'down 5',723 'forward 3',724 'up 6',725 'forward 9',726 'up 9',727 'down 3',728 'forward 2',729 'up 6',730 'down 6',731 'up 8',732 'down 3',733 'up 5',734 'forward 9',735 'up 3',736 'forward 4',737 'forward 6',738 'down 3',739 'forward 4',740 'down 5',741 'down 7',742 'down 7',743 'forward 9',744 'forward 6',745 'down 9',746 'up 1',747 'forward 2',748 'down 8',749 'down 7',750 'up 7',751 'forward 6',752 'up 5',753 'down 6',754 'forward 6',755 'down 3',756 'forward 2',757 'down 7',758 'forward 2',759 'down 3',760 'down 8',761 'forward 4',762 'up 8',763 'forward 7',764 'down 4',765 'forward 3',766 'down 3',767 'forward 6',768 'down 7',769 'down 7',770 'forward 8',771 'forward 9',772 'down 8',773 'down 4',774 'forward 5',775 'down 1',776 'forward 9',777 'down 7',778 'up 3',779 'down 6',780 'down 4',781 'down 9',782 'forward 3',783 'down 1',784 'forward 1',785 'down 5',786 'forward 1',787 'forward 9',788 'down 9',789 'forward 5',790 'down 1',791 'up 9',792 'down 3',793 'down 2',794 'up 6',795 'forward 4',796 'down 6',797 'down 2',798 'forward 5',799 'up 8',800 'down 7',801 'up 6',802 'down 1',803 'forward 3',804 'forward 4',805 'down 9',806 'down 2',807 'forward 5',808 'forward 8',809 'up 2',810 'forward 9',811 'up 5',812 'down 1',813 'forward 1',814 'forward 6',815 'forward 9',816 'forward 2',817 'down 8',818 'forward 1',819 'up 8',820 'forward 1',821 'forward 8',822 'up 5',823 'forward 3',824 'down 4',825 'up 8',826 'down 6',827 'up 1',828 'forward 2',829 'forward 4',830 'up 6',831 'forward 1',832 'forward 4',833 'up 6',834 'down 8',835 'up 7',836 'forward 5',837 'up 7',838 'down 9',839 'down 2',840 'up 5',841 'forward 2',842 'down 7',843 'forward 1',844 'forward 1',845 'forward 3',846 'down 6',847 'forward 7',848 'up 2',849 'up 1',850 'forward 1',851 'up 5',852 'down 1',853 'forward 7',854 'up 9',855 'forward 7',856 'down 6',857 'up 4',858 'down 5',859 'up 2',860 'down 4',861 'up 3',862 'down 6',863 'down 7',864 'down 7',865 'up 1',866 'forward 4',867 'forward 1',868 'up 2',869 'down 7',870 'down 5',871 'forward 7',872 'forward 5',873 'forward 2',874 'down 4',875 'down 6',876 'down 8',877 'forward 9',878 'forward 8',879 'up 9',880 'forward 6',881 'down 6',882 'down 6',883 'down 8',884 'up 5',885 'forward 6',886 'down 6',887 'forward 5',888 'down 4',889 'down 6',890 'down 2',891 'up 3',892 'forward 1',893 'forward 8',894 'down 2',895 'forward 9',896 'forward 7',897 'forward 8',898 'forward 1',899 'down 8',900 'forward 1',901 'down 1',902 'forward 6',903 'forward 4',904 'forward 5',905 'up 9',906 'up 1',907 'down 7',908 'up 8',909 'down 5',910 'down 2',911 'forward 9',912 'up 2',913 'forward 6',914 'down 7',915 'down 7',916 'down 2',917 'down 6',918 'down 7',919 'forward 9',920 'up 2',921 'down 6',922 'forward 8',923 'forward 1',924 'down 3',925 'down 2',926 'forward 3',927 'forward 7',928 'down 3',929 'down 1',930 'down 4',931 'down 9',932 'forward 1',933 'down 6',934 'down 8',935 'down 4',936 'down 5',937 'down 5',938 'up 9',939 'forward 7',940 'down 9',941 'up 3',942 'up 5',943 'up 1',944 'forward 2',945 'forward 9',946 'down 3',947 'forward 1',948 'up 3',949 'forward 6',950 'up 2',951 'forward 7',952 'forward 5',953 'forward 8',954 'forward 7',955 'forward 8',956 'down 5',957 'up 3',958 'forward 5',959 'forward 8',960 'forward 1',961 'forward 5',962 'forward 7',963 'forward 2',964 'down 6',965 'down 6',966 'down 6',967 'down 2',968 'down 2',969 'up 1',970 'down 1',971 'forward 5',972 'forward 7',973 'down 4',974 'forward 4',975 'up 1',976 'forward 7',977 'forward 8',978 'down 5',979 'down 2',980 'down 2',981 'down 5',982 'forward 3',983 'forward 7',984 'down 5',985 'forward 2',986 'forward 8',987 'down 3',988 'forward 6',989 'up 1',990 'forward 7',991 'forward 4',992 'forward 1',993 'forward 9',994 'forward 2',995 'down 1',996 'down 1',997 'down 8',998 'forward 4',999 'down 6',1000 'forward 7',1001 'forward 2'1002]...
data.js
Source:data.js
1const data = [2 "forward 4",3 "down 9",4 "forward 2",5 "forward 2",6 "down 7",7 "up 2",8 "down 9",9 "up 8",10 "down 7",11 "down 9",12 "forward 4",13 "up 6",14 "down 2",15 "down 5",16 "down 1",17 "down 5",18 "forward 2",19 "up 4",20 "forward 2",21 "forward 3",22 "up 2",23 "forward 6",24 "up 8",25 "forward 8",26 "down 8",27 "up 8",28 "down 7",29 "down 2",30 "down 9",31 "forward 2",32 "forward 9",33 "down 4",34 "forward 8",35 "up 6",36 "down 3",37 "up 9",38 "forward 1",39 "forward 6",40 "up 3",41 "forward 8",42 "up 9",43 "forward 1",44 "down 9",45 "down 3",46 "down 7",47 "up 2",48 "up 7",49 "down 5",50 "forward 3",51 "down 1",52 "up 6",53 "down 2",54 "forward 4",55 "down 6",56 "down 8",57 "forward 2",58 "down 5",59 "forward 6",60 "down 5",61 "down 7",62 "forward 8",63 "forward 2",64 "down 9",65 "up 4",66 "forward 6",67 "forward 4",68 "up 6",69 "down 9",70 "down 7",71 "down 9",72 "forward 9",73 "forward 8",74 "down 7",75 "up 7",76 "forward 9",77 "forward 8",78 "up 1",79 "up 4",80 "down 3",81 "forward 6",82 "up 6",83 "down 2",84 "up 3",85 "down 6",86 "down 5",87 "forward 8",88 "forward 3",89 "forward 8",90 "down 4",91 "down 4",92 "down 5",93 "forward 6",94 "down 5",95 "forward 6",96 "down 2",97 "down 5",98 "up 4",99 "down 8",100 "up 5",101 "forward 5",102 "forward 6",103 "down 9",104 "up 5",105 "down 2",106 "forward 5",107 "down 7",108 "up 7",109 "down 9",110 "forward 2",111 "down 3",112 "down 3",113 "forward 8",114 "up 5",115 "up 1",116 "forward 1",117 "forward 3",118 "down 5",119 "forward 8",120 "forward 7",121 "forward 8",122 "down 5",123 "down 8",124 "up 2",125 "forward 8",126 "forward 8",127 "down 7",128 "forward 1",129 "forward 7",130 "down 6",131 "up 4",132 "forward 7",133 "forward 7",134 "down 3",135 "up 7",136 "forward 2",137 "down 7",138 "down 4",139 "forward 5",140 "down 8",141 "forward 9",142 "down 7",143 "forward 5",144 "up 6",145 "up 6",146 "down 8",147 "down 3",148 "forward 5",149 "forward 3",150 "down 8",151 "up 7",152 "forward 8",153 "up 6",154 "down 2",155 "forward 4",156 "up 3",157 "up 3",158 "down 9",159 "down 9",160 "up 1",161 "up 7",162 "forward 2",163 "down 1",164 "forward 9",165 "up 7",166 "up 6",167 "down 2",168 "down 3",169 "forward 4",170 "down 3",171 "down 3",172 "down 1",173 "forward 4",174 "forward 8",175 "forward 6",176 "forward 3",177 "up 4",178 "up 5",179 "up 4",180 "forward 1",181 "up 3",182 "down 9",183 "up 6",184 "forward 2",185 "down 5",186 "down 1",187 "forward 8",188 "forward 2",189 "down 6",190 "up 5",191 "up 3",192 "forward 7",193 "forward 2",194 "forward 7",195 "up 9",196 "forward 3",197 "up 9",198 "forward 1",199 "down 9",200 "forward 9",201 "down 3",202 "down 3",203 "down 2",204 "forward 9",205 "forward 2",206 "up 3",207 "forward 3",208 "down 7",209 "down 3",210 "forward 2",211 "forward 1",212 "forward 6",213 "up 9",214 "forward 4",215 "down 9",216 "down 8",217 "up 3",218 "up 5",219 "forward 8",220 "down 9",221 "forward 5",222 "forward 4",223 "down 5",224 "up 4",225 "forward 7",226 "forward 3",227 "down 9",228 "forward 7",229 "down 2",230 "down 7",231 "forward 3",232 "up 3",233 "forward 7",234 "down 9",235 "down 4",236 "down 8",237 "forward 8",238 "down 6",239 "forward 9",240 "forward 4",241 "up 9",242 "down 9",243 "down 6",244 "up 7",245 "up 2",246 "forward 2",247 "forward 7",248 "down 7",249 "forward 9",250 "down 6",251 "down 2",252 "forward 4",253 "forward 8",254 "down 4",255 "forward 4",256 "forward 4",257 "forward 6",258 "up 6",259 "down 9",260 "down 3",261 "down 7",262 "up 2",263 "up 2",264 "forward 4",265 "down 4",266 "forward 6",267 "down 2",268 "down 2",269 "forward 1",270 "down 1",271 "forward 7",272 "up 5",273 "forward 9",274 "forward 8",275 "down 4",276 "forward 8",277 "down 5",278 "up 4",279 "down 8",280 "forward 4",281 "forward 7",282 "down 9",283 "down 3",284 "forward 6",285 "down 6",286 "forward 6",287 "down 9",288 "down 6",289 "forward 5",290 "forward 5",291 "up 9",292 "down 9",293 "down 9",294 "down 1",295 "down 5",296 "forward 5",297 "down 7",298 "forward 3",299 "down 6",300 "forward 5",301 "forward 8",302 "down 6",303 "forward 7",304 "down 5",305 "forward 4",306 "down 4",307 "down 9",308 "forward 3",309 "down 9",310 "down 9",311 "down 1",312 "up 7",313 "forward 4",314 "up 1",315 "up 1",316 "forward 1",317 "down 9",318 "up 8",319 "down 8",320 "down 3",321 "down 7",322 "forward 4",323 "down 5",324 "down 5",325 "forward 7",326 "forward 7",327 "forward 6",328 "up 2",329 "down 4",330 "forward 8",331 "forward 3",332 "forward 3",333 "forward 2",334 "forward 4",335 "up 9",336 "up 1",337 "forward 2",338 "forward 2",339 "forward 6",340 "down 9",341 "up 8",342 "forward 4",343 "forward 5",344 "forward 4",345 "down 4",346 "down 8",347 "forward 6",348 "down 8",349 "forward 9",350 "forward 8",351 "down 1",352 "down 2",353 "forward 2",354 "up 4",355 "up 7",356 "forward 5",357 "down 7",358 "down 5",359 "down 3",360 "up 7",361 "down 4",362 "forward 8",363 "up 8",364 "down 1",365 "down 2",366 "up 6",367 "up 8",368 "forward 9",369 "down 5",370 "down 2",371 "forward 5",372 "forward 4",373 "up 6",374 "forward 7",375 "down 3",376 "up 5",377 "up 9",378 "forward 5",379 "forward 1",380 "down 6",381 "down 7",382 "forward 9",383 "down 8",384 "down 2",385 "forward 9",386 "forward 2",387 "down 3",388 "forward 9",389 "down 3",390 "down 9",391 "up 3",392 "forward 7",393 "up 2",394 "up 5",395 "forward 3",396 "down 9",397 "up 1",398 "down 2",399 "down 4",400 "down 6",401 "forward 5",402 "forward 5",403 "up 7",404 "up 3",405 "down 1",406 "down 1",407 "up 8",408 "down 4",409 "forward 1",410 "down 4",411 "down 5",412 "down 9",413 "forward 7",414 "up 2",415 "up 1",416 "down 7",417 "forward 9",418 "forward 9",419 "forward 8",420 "forward 9",421 "down 5",422 "forward 9",423 "forward 9",424 "up 9",425 "down 7",426 "down 8",427 "forward 2",428 "forward 9",429 "down 1",430 "forward 3",431 "forward 8",432 "up 4",433 "down 4",434 "forward 4",435 "forward 3",436 "down 7",437 "down 3",438 "forward 6",439 "forward 9",440 "forward 1",441 "down 2",442 "up 3",443 "down 9",444 "forward 5",445 "forward 6",446 "forward 8",447 "up 2",448 "up 1",449 "down 3",450 "up 4",451 "forward 1",452 "up 9",453 "forward 4",454 "down 1",455 "up 2",456 "down 8",457 "down 9",458 "forward 3",459 "down 2",460 "up 5",461 "forward 2",462 "down 6",463 "down 5",464 "down 8",465 "down 3",466 "down 7",467 "down 2",468 "forward 8",469 "down 9",470 "up 7",471 "down 7",472 "down 7",473 "down 7",474 "forward 4",475 "forward 1",476 "forward 9",477 "up 9",478 "forward 5",479 "forward 8",480 "forward 7",481 "forward 7",482 "down 1",483 "forward 3",484 "down 7",485 "forward 2",486 "forward 4",487 "up 7",488 "forward 1",489 "down 5",490 "forward 5",491 "forward 1",492 "down 8",493 "forward 7",494 "forward 2",495 "up 3",496 "down 1",497 "up 7",498 "down 1",499 "down 2",500 "forward 9",501 "forward 6",502 "forward 3",503 "forward 2",504 "down 4",505 "forward 7",506 "forward 7",507 "forward 5",508 "forward 7",509 "forward 2",510 "down 9",511 "down 8",512 "forward 8",513 "forward 9",514 "down 3",515 "up 7",516 "up 1",517 "down 4",518 "forward 2",519 "forward 7",520 "forward 3",521 "forward 9",522 "up 2",523 "down 3",524 "forward 4",525 "down 8",526 "down 6",527 "down 4",528 "down 6",529 "down 7",530 "forward 9",531 "down 9",532 "forward 8",533 "down 1",534 "down 1",535 "forward 1",536 "forward 1",537 "down 7",538 "down 3",539 "down 3",540 "forward 2",541 "down 7",542 "forward 8",543 "up 7",544 "down 5",545 "forward 7",546 "forward 9",547 "down 2",548 "forward 9",549 "forward 3",550 "forward 9",551 "forward 9",552 "down 3",553 "forward 1",554 "forward 7",555 "up 8",556 "forward 7",557 "forward 4",558 "forward 5",559 "forward 6",560 "down 4",561 "up 3",562 "down 5",563 "up 8",564 "up 5",565 "up 6",566 "forward 1",567 "down 1",568 "up 8",569 "down 8",570 "down 5",571 "forward 8",572 "up 9",573 "down 8",574 "forward 2",575 "up 6",576 "forward 3",577 "down 3",578 "down 8",579 "down 4",580 "forward 6",581 "forward 2",582 "down 9",583 "up 9",584 "down 2",585 "down 9",586 "up 1",587 "down 6",588 "up 2",589 "down 9",590 "forward 8",591 "forward 3",592 "forward 6",593 "down 6",594 "up 9",595 "up 8",596 "forward 4",597 "down 2",598 "forward 5",599 "up 4",600 "up 4",601 "down 5",602 "down 9",603 "forward 3",604 "down 1",605 "forward 1",606 "forward 6",607 "forward 2",608 "down 7",609 "forward 7",610 "up 5",611 "forward 2",612 "down 8",613 "forward 5",614 "down 1",615 "down 7",616 "forward 7",617 "down 4",618 "forward 7",619 "forward 2",620 "down 6",621 "forward 9",622 "forward 4",623 "up 3",624 "forward 8",625 "forward 2",626 "up 6",627 "up 3",628 "forward 9",629 "forward 4",630 "down 2",631 "forward 6",632 "down 1",633 "forward 5",634 "down 2",635 "up 1",636 "down 1",637 "forward 2",638 "forward 4",639 "down 7",640 "up 6",641 "forward 4",642 "forward 7",643 "up 8",644 "forward 3",645 "down 8",646 "forward 7",647 "down 2",648 "down 5",649 "forward 3",650 "forward 7",651 "down 5",652 "forward 2",653 "forward 8",654 "up 6",655 "forward 8",656 "down 7",657 "up 3",658 "down 2",659 "forward 2",660 "down 8",661 "down 2",662 "up 5",663 "up 1",664 "forward 6",665 "down 1",666 "forward 2",667 "down 1",668 "forward 6",669 "forward 9",670 "down 9",671 "down 8",672 "down 3",673 "forward 5",674 "forward 3",675 "down 3",676 "down 1",677 "forward 4",678 "forward 8",679 "forward 2",680 "down 7",681 "forward 9",682 "forward 4",683 "down 4",684 "forward 6",685 "down 4",686 "forward 8",687 "down 8",688 "down 2",689 "up 7",690 "down 9",691 "down 5",692 "up 4",693 "down 3",694 "up 5",695 "forward 8",696 "down 4",697 "down 6",698 "forward 1",699 "up 2",700 "down 6",701 "forward 4",702 "down 8",703 "forward 1",704 "up 7",705 "forward 6",706 "up 2",707 "forward 1",708 "down 8",709 "down 2",710 "forward 3",711 "down 3",712 "down 2",713 "up 9",714 "down 3",715 "down 4",716 "down 3",717 "forward 9",718 "down 6",719 "forward 8",720 "forward 8",721 "down 1",722 "forward 8",723 "down 5",724 "up 9",725 "up 5",726 "up 5",727 "forward 5",728 "forward 4",729 "down 7",730 "down 6",731 "forward 9",732 "up 4",733 "forward 7",734 "up 5",735 "forward 7",736 "down 5",737 "down 3",738 "forward 5",739 "down 8",740 "up 3",741 "forward 4",742 "up 2",743 "down 1",744 "down 6",745 "down 6",746 "up 3",747 "forward 5",748 "forward 8",749 "down 2",750 "forward 6",751 "down 5",752 "down 4",753 "forward 9",754 "down 6",755 "forward 6",756 "up 5",757 "forward 4",758 "forward 5",759 "forward 1",760 "up 6",761 "up 2",762 "down 8",763 "up 4",764 "up 2",765 "down 3",766 "forward 4",767 "down 5",768 "forward 8",769 "up 5",770 "forward 6",771 "forward 9",772 "down 6",773 "down 3",774 "up 3",775 "down 2",776 "up 9",777 "forward 5",778 "up 5",779 "forward 3",780 "forward 2",781 "down 5",782 "up 2",783 "down 5",784 "forward 8",785 "forward 2",786 "down 1",787 "up 2",788 "down 6",789 "up 8",790 "down 3",791 "down 2",792 "forward 2",793 "down 1",794 "forward 8",795 "forward 2",796 "up 6",797 "forward 6",798 "up 3",799 "up 8",800 "up 2",801 "up 4",802 "down 7",803 "forward 6",804 "down 3",805 "down 2",806 "forward 5",807 "down 7",808 "down 6",809 "forward 1",810 "down 4",811 "forward 4",812 "up 1",813 "down 3",814 "up 3",815 "down 4",816 "forward 1",817 "down 2",818 "forward 6",819 "down 7",820 "forward 3",821 "forward 1",822 "forward 5",823 "down 7",824 "down 9",825 "forward 7",826 "forward 2",827 "forward 7",828 "forward 8",829 "down 1",830 "down 1",831 "up 6",832 "forward 2",833 "up 7",834 "down 9",835 "up 4",836 "up 9",837 "forward 9",838 "forward 6",839 "down 3",840 "down 9",841 "forward 1",842 "forward 1",843 "up 8",844 "forward 6",845 "forward 1",846 "forward 9",847 "down 2",848 "down 1",849 "forward 2",850 "forward 9",851 "down 9",852 "down 6",853 "forward 5",854 "down 6",855 "forward 4",856 "down 3",857 "forward 1",858 "down 4",859 "up 5",860 "forward 6",861 "forward 3",862 "down 2",863 "up 3",864 "down 9",865 "down 2",866 "forward 1",867 "down 4",868 "up 2",869 "down 6",870 "forward 6",871 "forward 7",872 "forward 3",873 "forward 9",874 "up 7",875 "up 2",876 "forward 2",877 "up 2",878 "forward 1",879 "up 2",880 "forward 8",881 "forward 5",882 "down 6",883 "up 7",884 "down 4",885 "down 1",886 "up 8",887 "forward 1",888 "down 3",889 "up 8",890 "forward 8",891 "down 6",892 "down 1",893 "down 6",894 "forward 1",895 "forward 7",896 "up 3",897 "forward 6",898 "forward 1",899 "up 3",900 "down 5",901 "down 1",902 "forward 5",903 "down 5",904 "up 7",905 "up 3",906 "down 6",907 "forward 6",908 "up 7",909 "forward 5",910 "forward 2",911 "forward 1",912 "down 8",913 "forward 3",914 "down 3",915 "forward 5",916 "down 4",917 "up 4",918 "down 8",919 "down 7",920 "down 7",921 "up 9",922 "up 2",923 "down 4",924 "down 1",925 "down 4",926 "forward 9",927 "up 8",928 "up 4",929 "down 2",930 "forward 8",931 "forward 1",932 "down 2",933 "up 5",934 "down 3",935 "down 8",936 "down 8",937 "down 6",938 "down 5",939 "forward 7",940 "down 3",941 "forward 5",942 "down 6",943 "down 9",944 "down 2",945 "forward 8",946 "down 4",947 "up 2",948 "forward 4",949 "down 8",950 "down 5",951 "down 4",952 "forward 2",953 "up 3",954 "forward 4",955 "up 3",956 "down 8",957 "down 2",958 "up 8",959 "forward 4",960 "forward 6",961 "down 3",962 "forward 9",963 "forward 6",964 "forward 8",965 "forward 5",966 "forward 1",967 "forward 5",968 "down 3",969 "up 2",970 "forward 4",971 "down 4",972 "down 3",973 "forward 1",974 "forward 3",975 "forward 7",976 "forward 9",977 "down 2",978 "up 4",979 "down 3",980 "up 8",981 "forward 9",982 "down 5",983 "up 9",984 "down 1",985 "up 4",986 "forward 7",987 "forward 2",988 "forward 4",989 "up 8",990 "down 4",991 "down 1",992 "forward 8",993 "down 4",994 "down 7",995 "up 1",996 "down 3",997 "down 2",998 "forward 5",999 "up 6",1000 "down 7",1001 "forward 2",...
day2.mjs
Source:day2.mjs
...
2.js
Source:2.js
1function solve(puzzleInput) {2 let pos = [0, 0];3 puzzleInput = puzzleInput4 .split("\n")5 .map((line) => line.split(" "))6 .map((instruction) => [instruction[0], Number(instruction[1])]);7 for (let instruction of puzzleInput) {8 let [dir, val] = instruction;9 if (dir === "forward") {10 pos[0] += val;11 } else {12 pos[1] += dir === "down" ? val : -val;13 }14 }15 console.log(pos[0] * pos[1]);16 //part two17 pos = [0, 0];18 let aim = 0;19 for (let instruction of puzzleInput) {20 let [dir, val] = instruction;21 if (dir === "forward") {22 pos[0] += val;23 pos[1] += aim * val;24 } else {25 aim += dir === "down" ? val : -val;26 }27 }28 console.log(pos[0] * pos[1]);29}30// // exmaple31// solve(`forward 532// down 533// forward 834// up 335// down 836// forward 2`);37// process.exit();38solve(`forward 539forward 240forward 941down 242forward 943forward 344forward 245down 646forward 347forward 348down 349down 350forward 851down 552forward 753forward 954forward 955forward 656forward 957forward 358forward 359forward 160forward 761down 662forward 763forward 464down 365down 166forward 467down 768down 269down 870forward 971down 572down 273forward 674up 475down 376down 177down 678down 779forward 680up 281forward 282down 983down 384forward 785up 386up 787forward 888forward 789down 490up 891up 192forward 493down 694forward 995forward 396down 197down 198forward 299forward 4100forward 3101up 2102forward 1103down 8104forward 4105down 5106forward 9107up 1108forward 3109forward 6110up 8111forward 1112forward 7113up 9114down 3115up 7116down 1117forward 5118forward 3119forward 7120down 5121down 1122down 2123down 4124down 5125down 5126down 8127up 9128down 7129down 7130down 6131forward 3132forward 5133forward 1134forward 8135up 4136down 8137down 3138down 1139down 9140down 3141down 9142down 8143down 2144forward 1145forward 7146forward 1147down 3148down 1149up 3150down 6151forward 6152forward 6153down 8154forward 3155down 1156forward 2157down 4158down 7159up 8160forward 4161down 4162up 1163forward 6164down 6165forward 5166forward 9167up 5168down 3169up 9170down 6171up 3172down 9173down 4174down 2175forward 3176down 6177down 7178down 9179forward 7180forward 2181forward 5182up 6183down 8184forward 1185down 2186forward 8187down 5188down 2189up 4190forward 9191up 4192down 4193down 2194forward 3195up 2196down 5197down 9198up 4199forward 9200down 5201down 2202down 2203forward 9204up 9205forward 6206up 7207down 2208forward 8209down 1210forward 2211down 3212up 6213down 4214forward 5215up 4216forward 5217forward 9218forward 9219forward 5220down 1221down 7222forward 6223forward 9224forward 3225forward 4226up 8227down 1228up 1229down 3230up 1231down 5232forward 6233up 5234up 6235down 9236forward 7237down 7238forward 1239forward 2240up 4241forward 4242down 9243up 4244down 6245forward 1246up 9247forward 2248down 8249forward 6250forward 6251down 6252forward 5253forward 9254up 8255down 4256forward 8257up 6258down 4259up 9260forward 2261down 8262down 6263forward 2264down 3265forward 1266forward 3267forward 2268up 4269down 6270up 6271down 4272down 2273forward 1274up 7275forward 9276forward 9277forward 7278down 1279down 9280forward 5281forward 4282forward 1283forward 4284down 5285forward 6286forward 8287down 5288down 7289up 2290up 1291forward 5292down 5293down 1294down 5295down 8296down 8297down 5298forward 7299down 6300down 2301forward 9302forward 1303forward 3304forward 4305up 3306down 4307up 7308forward 8309forward 7310up 4311down 9312forward 7313forward 6314up 1315down 1316up 6317down 5318up 1319forward 2320down 2321forward 3322down 6323up 5324up 4325down 8326down 5327down 3328down 4329up 3330down 3331down 2332down 7333up 2334down 8335forward 5336up 1337forward 9338down 6339down 6340down 8341up 4342forward 9343forward 8344up 7345down 9346down 4347forward 9348forward 9349up 2350down 1351forward 1352forward 4353forward 2354forward 9355down 1356down 3357down 1358down 3359up 5360down 2361forward 4362down 2363forward 1364down 6365up 9366down 3367forward 1368forward 5369forward 8370down 5371down 6372down 9373forward 4374down 7375up 8376forward 8377down 9378forward 6379down 8380up 3381forward 4382up 9383down 7384up 7385forward 6386forward 1387up 9388down 7389up 7390down 5391forward 6392up 7393down 8394down 8395forward 4396up 4397forward 1398forward 6399down 4400up 9401forward 4402up 1403up 8404up 6405forward 9406forward 4407forward 7408up 1409down 5410up 5411up 5412forward 4413down 9414up 8415down 6416down 3417down 6418forward 2419up 1420forward 3421up 8422down 1423forward 5424down 9425forward 4426up 5427forward 3428forward 2429down 8430down 9431up 6432down 9433down 7434forward 5435forward 4436forward 9437up 8438forward 3439down 7440forward 9441down 8442forward 4443forward 8444up 9445up 9446down 6447forward 5448forward 5449forward 5450up 2451up 2452up 1453down 6454forward 2455forward 2456down 8457down 6458up 2459forward 1460down 1461up 5462forward 7463down 2464forward 1465forward 3466down 5467down 7468forward 8469forward 4470forward 9471up 1472up 7473up 9474forward 3475up 1476forward 6477forward 3478forward 9479up 9480down 6481forward 8482up 6483down 9484forward 3485forward 7486down 9487forward 4488forward 5489forward 7490down 1491down 4492down 3493forward 6494down 3495forward 7496forward 8497down 1498forward 3499down 4500up 7501forward 2502forward 8503down 6504up 3505down 2506forward 9507forward 5508forward 7509up 2510up 6511down 9512forward 1513up 5514forward 1515up 6516up 2517up 1518forward 6519down 8520forward 7521down 5522forward 3523down 9524down 4525forward 3526down 1527up 1528up 7529forward 4530down 6531forward 3532forward 2533down 8534forward 9535forward 6536up 3537down 3538down 1539down 7540up 8541up 2542up 8543forward 6544forward 8545forward 6546forward 4547down 6548forward 6549forward 6550forward 1551down 2552forward 2553forward 6554down 1555up 6556forward 3557forward 9558forward 6559down 2560forward 2561up 4562down 2563up 4564forward 2565forward 2566forward 3567up 1568forward 8569forward 3570forward 3571forward 1572down 5573down 9574forward 4575down 1576forward 5577forward 2578down 5579forward 6580forward 3581up 3582forward 6583forward 9584forward 5585down 2586down 2587down 7588forward 8589down 1590down 5591down 9592up 3593up 5594up 4595forward 3596down 9597down 2598down 8599down 5600down 2601forward 4602up 3603down 5604up 3605down 8606down 7607up 1608forward 2609forward 1610down 2611up 1612up 5613down 8614down 3615up 9616forward 2617down 8618down 4619down 3620forward 3621forward 7622up 1623down 9624forward 1625down 6626up 3627up 5628down 6629up 4630forward 7631up 4632forward 9633up 4634forward 4635down 7636down 2637down 8638up 3639down 7640down 4641up 5642forward 8643down 8644down 1645forward 7646up 9647down 5648up 8649down 1650up 3651forward 8652up 4653down 1654up 1655up 7656forward 3657forward 6658forward 5659forward 2660down 4661forward 2662down 7663up 7664up 6665down 4666forward 4667forward 9668forward 7669down 4670down 6671forward 5672down 2673down 6674down 2675down 2676forward 9677up 5678forward 9679down 3680down 6681down 1682forward 5683down 5684forward 7685forward 9686up 8687forward 6688down 6689down 2690forward 8691forward 5692up 9693up 4694forward 1695forward 2696forward 2697up 9698down 6699forward 6700forward 8701up 5702up 7703forward 4704down 3705forward 1706up 6707up 9708forward 6709up 8710forward 5711down 4712forward 1713down 3714forward 1715forward 6716forward 2717up 4718down 6719forward 9720down 2721forward 4722down 4723forward 3724down 5725down 2726forward 2727forward 2728up 1729forward 1730down 7731down 8732up 6733forward 8734forward 5735forward 8736down 6737forward 5738down 3739up 3740forward 4741up 9742forward 8743forward 4744down 3745forward 6746up 6747down 2748down 7749down 3750down 2751down 8752forward 5753down 9754up 6755down 6756forward 8757down 1758forward 8759down 1760down 1761forward 3762forward 9763down 6764forward 7765down 4766forward 1767forward 4768forward 3769down 6770forward 5771down 5772forward 1773forward 3774forward 8775down 9776up 8777up 6778up 6779forward 2780forward 9781down 4782down 8783forward 6784up 1785down 2786down 6787forward 6788forward 2789up 8790forward 6791down 9792down 1793forward 7794forward 6795forward 5796forward 6797down 6798up 7799down 9800forward 9801forward 3802forward 5803down 4804down 1805down 7806up 3807up 7808forward 6809forward 8810down 7811down 4812forward 7813down 6814up 1815forward 4816down 2817forward 4818forward 3819forward 4820forward 4821up 3822down 8823down 4824down 1825down 8826down 3827up 9828down 4829forward 7830down 6831up 2832down 8833up 9834down 6835forward 1836down 3837forward 9838down 9839forward 1840down 5841up 5842up 1843forward 8844down 8845down 9846down 5847down 2848down 5849forward 3850down 9851forward 4852forward 4853up 2854forward 8855forward 4856forward 1857down 5858forward 5859down 5860forward 6861forward 4862up 5863down 9864up 3865up 8866forward 5867forward 9868up 6869forward 6870down 5871forward 7872down 8873down 7874down 9875forward 4876down 8877forward 4878down 5879forward 6880forward 4881down 7882down 5883forward 4884down 3885up 4886forward 3887up 9888down 8889forward 9890forward 6891forward 9892down 1893forward 2894up 5895down 9896down 2897down 9898up 8899forward 7900forward 8901forward 4902down 1903up 8904forward 8905down 8906down 4907forward 9908down 3909forward 7910forward 9911down 5912forward 7913forward 1914forward 5915forward 2916down 4917forward 7918down 6919forward 3920down 9921forward 3922down 5923up 6924up 3925forward 1926up 9927down 1928forward 2929down 8930down 7931up 9932up 2933down 5934up 9935forward 9936forward 9937down 1938forward 5939up 5940forward 1941up 1942down 3943forward 3944down 3945forward 3946up 5947up 4948down 7949down 7950down 4951forward 7952down 6953forward 1954up 1955down 8956forward 4957down 3958forward 9959up 6960forward 6961forward 3962up 9963down 9964forward 4965up 5966down 3967down 8968down 3969down 3970forward 4971forward 6972forward 4973up 2974up 3975up 5976down 5977down 6978forward 5979forward 4980down 1981down 2982up 8983down 2984down 1985up 4986forward 5987forward 8988forward 8989forward 5990down 3991forward 4992up 8993forward 7994forward 4995down 9996down 6997forward 2998down 7999forward 61000up 71001up 11002up 41003forward 21004forward 91005forward 71006up 51007forward 21008up 51009forward 11010forward 21011forward 41012down 61013forward 21014up 61015up 71016forward 31017forward 21018forward 61019forward 41020forward 91021forward 61022up 61023forward 51024up 71025up 51026down 61027down 21028down 11029forward 71030down 51031down 11032down 71033forward 81034forward 81035forward 51036down 9...
part2.solution.js
Source:part2.solution.js
1import calculateFinalPositionWithAim from "./part2.js";2console.log(3 calculateFinalPositionWithAim(`forward 84forward 35down 86forward 47down 28down 49down 810down 411down 712up 413down 614down 215forward 716down 517down 718down 519forward 820forward 421forward 322down 423forward 224up 325up 626forward 727down 428down 229forward 730up 331forward 832down 433down 634forward 335forward 936down 937down 638forward 839up 840forward 341down 842down 443forward 744forward 345up 946down 847forward 748forward 549forward 350down 151down 452forward 153down 654forward 955up 256forward 357down 258down 159up 560down 861down 762down 563down 964up 765forward 466down 967down 868down 469forward 370down 171up 872down 173down 874forward 475up 176forward 777down 678down 279forward 380down 981forward 982forward 483down 184up 685down 186up 287down 488down 989down 790forward 591down 392up 993forward 494up 595down 996forward 197forward 798forward 199down 8100forward 5101down 2102down 4103down 3104forward 4105down 9106up 7107up 1108forward 4109up 2110forward 4111forward 4112down 1113down 5114forward 6115forward 1116down 6117forward 8118forward 8119forward 6120down 3121forward 3122forward 1123forward 5124forward 7125down 5126forward 8127down 7128down 8129forward 7130forward 8131down 7132forward 7133up 2134up 9135down 1136forward 1137forward 6138up 3139up 6140down 2141down 4142forward 2143up 8144forward 5145up 9146up 5147down 2148forward 5149forward 9150up 3151forward 7152down 4153down 3154down 2155forward 9156up 4157down 7158down 1159forward 9160forward 3161up 4162forward 1163up 6164forward 5165forward 2166forward 2167down 9168forward 1169up 7170forward 3171down 1172down 5173up 8174down 5175forward 5176forward 5177down 9178up 5179forward 8180up 9181down 1182forward 1183down 7184up 3185down 9186down 9187down 5188up 6189forward 7190down 5191down 2192down 5193forward 3194forward 2195forward 9196forward 5197forward 6198up 7199up 7200forward 4201forward 2202up 4203up 6204down 8205up 9206up 5207down 8208forward 4209up 9210forward 8211forward 3212down 6213down 6214down 7215down 6216forward 7217up 5218down 2219down 5220forward 2221up 5222forward 7223down 5224up 4225up 2226forward 2227forward 9228forward 5229forward 8230up 4231forward 6232up 7233forward 5234down 2235down 3236down 8237up 2238down 2239up 1240up 7241down 1242down 6243down 9244down 7245forward 8246up 8247up 9248down 9249forward 6250forward 6251down 6252forward 3253forward 4254forward 6255forward 7256down 5257down 8258forward 7259forward 9260down 4261up 9262forward 8263down 6264down 1265down 2266forward 4267down 5268up 1269forward 1270down 6271forward 4272forward 2273forward 6274down 8275up 2276up 8277forward 3278down 6279forward 7280down 1281forward 1282forward 8283down 8284down 8285down 2286forward 8287down 4288up 8289down 6290forward 2291down 5292up 3293up 1294down 2295forward 4296up 7297forward 2298up 9299forward 1300down 5301forward 3302up 9303up 4304down 4305up 6306down 1307forward 9308up 5309forward 5310up 4311down 6312forward 2313up 6314forward 5315forward 5316down 4317up 7318forward 2319down 9320down 8321down 7322forward 4323forward 7324down 4325forward 9326up 2327forward 1328up 4329down 8330forward 9331up 2332up 5333down 7334up 6335forward 7336up 1337forward 3338down 3339down 2340down 6341down 6342forward 3343down 2344down 2345down 5346down 4347down 6348down 2349forward 7350down 6351forward 4352down 5353down 7354down 3355forward 2356forward 8357forward 1358up 6359down 8360down 4361up 5362forward 5363down 7364forward 5365forward 8366forward 7367down 8368down 5369down 3370up 2371forward 8372forward 7373down 6374up 1375down 9376down 3377down 7378down 2379forward 9380forward 2381forward 4382forward 8383forward 3384forward 2385down 3386down 8387up 7388down 7389down 1390forward 8391down 2392up 4393forward 9394down 6395forward 5396forward 8397forward 1398forward 4399down 6400down 1401down 6402forward 1403forward 7404down 3405down 3406down 1407up 2408down 6409down 5410down 6411forward 5412forward 2413forward 1414forward 8415up 5416down 2417down 9418down 9419down 5420down 3421up 6422forward 2423down 7424down 7425down 2426down 2427up 6428forward 8429forward 6430forward 4431down 1432forward 7433down 5434up 9435forward 5436down 4437down 9438up 7439forward 1440up 3441up 7442forward 6443forward 8444up 6445up 3446forward 4447up 3448down 1449forward 8450forward 1451up 3452forward 7453up 2454forward 6455forward 2456down 2457down 9458down 9459forward 1460forward 8461down 5462forward 4463forward 5464forward 5465down 9466forward 8467up 8468down 6469down 2470down 5471down 6472up 9473up 8474down 4475down 9476up 4477forward 6478forward 1479forward 3480up 4481up 3482forward 3483forward 8484down 1485down 2486down 2487forward 9488forward 4489up 2490forward 7491down 4492up 1493forward 2494forward 9495forward 8496down 4497down 7498up 7499down 1500forward 3501down 7502down 8503up 2504forward 2505forward 8506forward 4507forward 4508down 5509forward 8510down 2511up 7512down 1513up 9514up 5515down 3516forward 6517forward 2518forward 6519down 5520down 6521forward 9522up 5523up 6524down 4525down 5526up 4527down 6528down 2529down 5530down 4531forward 7532forward 6533down 8534forward 2535down 5536down 7537down 2538forward 8539forward 6540down 3541forward 4542up 6543down 9544down 3545forward 3546forward 3547down 9548up 1549up 3550forward 3551forward 6552forward 1553forward 4554forward 3555forward 3556forward 3557down 6558down 8559forward 3560down 5561forward 8562forward 3563down 4564up 3565up 1566down 7567forward 7568up 6569forward 7570down 4571down 7572up 9573down 9574forward 8575down 5576down 2577forward 9578down 3579forward 4580forward 4581forward 4582forward 6583down 1584up 5585forward 8586down 6587forward 5588up 5589up 5590down 2591down 9592down 7593up 3594up 7595up 6596forward 2597forward 6598up 9599forward 5600forward 2601up 4602down 4603down 5604forward 7605down 5606down 7607forward 3608down 6609down 1610forward 6611up 5612up 6613up 3614down 9615up 7616forward 9617down 3618forward 4619up 2620forward 9621down 2622up 2623up 5624forward 1625down 8626down 1627down 8628up 2629forward 9630forward 1631up 2632down 1633up 1634forward 2635down 7636forward 9637up 1638forward 8639down 5640down 5641down 9642forward 5643down 7644down 1645forward 9646down 5647forward 9648forward 9649down 6650down 5651down 6652forward 3653down 4654up 8655down 6656up 4657down 9658up 1659up 2660up 8661forward 6662down 7663down 4664down 9665down 3666forward 9667down 5668forward 6669down 6670forward 7671down 9672forward 2673forward 2674down 8675down 7676forward 5677down 8678forward 6679down 1680forward 6681forward 7682forward 3683forward 2684forward 1685forward 1686down 9687forward 7688up 9689down 5690forward 6691down 4692down 2693forward 4694forward 3695forward 9696down 8697down 2698forward 4699down 8700down 6701forward 9702down 7703forward 1704up 1705forward 3706down 5707down 8708up 6709forward 9710forward 4711down 2712forward 4713up 2714forward 9715down 5716down 1717down 9718forward 5719down 9720forward 1721down 9722forward 8723down 5724forward 9725forward 8726up 8727down 7728up 9729down 5730up 9731forward 7732forward 7733forward 1734up 2735up 2736forward 6737up 5738up 5739down 7740forward 2741up 8742forward 8743down 8744forward 7745forward 8746down 7747down 8748forward 4749forward 2750down 8751up 4752down 1753up 7754forward 4755forward 3756down 6757up 6758forward 6759down 1760forward 3761down 6762forward 6763up 3764up 1765up 5766down 1767up 9768down 8769forward 7770forward 9771up 2772forward 2773forward 6774up 2775up 3776forward 1777forward 2778forward 8779down 6780forward 5781down 8782forward 2783up 1784down 1785down 3786forward 9787down 6788down 1789down 6790down 6791down 6792down 1793up 6794down 6795forward 6796down 5797down 2798up 5799forward 7800down 3801forward 9802forward 2803down 2804down 1805down 9806up 3807down 2808forward 2809forward 6810down 4811up 7812up 3813up 9814forward 3815forward 8816forward 9817forward 4818forward 2819up 7820up 5821down 9822forward 1823up 1824down 7825forward 5826forward 5827down 3828forward 1829forward 6830up 8831down 4832down 2833up 2834forward 2835forward 1836down 4837up 9838down 1839down 4840down 6841forward 3842forward 7843down 4844up 8845down 6846forward 7847forward 4848up 2849down 8850forward 5851down 1852forward 7853down 1854up 6855down 9856forward 3857forward 1858up 2859up 4860forward 8861forward 1862up 8863forward 3864forward 7865up 9866up 6867up 9868down 9869down 5870forward 8871forward 7872down 5873forward 7874forward 6875forward 8876up 4877forward 6878down 6879up 8880down 7881up 8882forward 6883forward 7884down 4885forward 4886up 2887forward 9888down 6889down 2890down 8891forward 6892up 2893up 8894forward 2895down 3896forward 7897forward 6898down 9899up 1900forward 1901down 8902down 8903forward 4904forward 4905up 6906down 8907up 8908forward 1909forward 1910down 6911up 3912up 7913forward 1914forward 1915up 2916forward 2917down 4918up 8919forward 1920up 7921down 2922forward 2923down 1924forward 1925down 4926forward 4927forward 8928up 5929down 6930up 8931forward 4932down 3933up 6934forward 3935forward 4936down 5937forward 1938forward 6939forward 4940forward 1941down 7942down 4943forward 2944down 6945forward 3946down 5947forward 3948forward 4949forward 4950forward 9951down 5952forward 7953forward 7954forward 9955down 1956up 6957forward 1958down 9959forward 3960down 7961up 8962up 6963down 7964forward 2965down 9966forward 9967forward 6968down 9969forward 6970down 8971forward 1972up 6973down 1974forward 6975down 9976forward 6977forward 7978forward 3979forward 8980forward 5981forward 8982down 9983down 2984forward 3985down 3986up 4987down 4988down 3989forward 3990forward 3991down 5992forward 5993forward 1994down 9995down 3996up 7997forward 9998up 1999down 11000down 61001up 11002forward 2`)...
part1.solution.js
Source:part1.solution.js
1import calculateFinalPosition from "./part1.js";2console.log(3 calculateFinalPosition(`forward 84forward 35down 86forward 47down 28down 49down 810down 411down 712up 413down 614down 215forward 716down 517down 718down 519forward 820forward 421forward 322down 423forward 224up 325up 626forward 727down 428down 229forward 730up 331forward 832down 433down 634forward 335forward 936down 937down 638forward 839up 840forward 341down 842down 443forward 744forward 345up 946down 847forward 748forward 549forward 350down 151down 452forward 153down 654forward 955up 256forward 357down 258down 159up 560down 861down 762down 563down 964up 765forward 466down 967down 868down 469forward 370down 171up 872down 173down 874forward 475up 176forward 777down 678down 279forward 380down 981forward 982forward 483down 184up 685down 186up 287down 488down 989down 790forward 591down 392up 993forward 494up 595down 996forward 197forward 798forward 199down 8100forward 5101down 2102down 4103down 3104forward 4105down 9106up 7107up 1108forward 4109up 2110forward 4111forward 4112down 1113down 5114forward 6115forward 1116down 6117forward 8118forward 8119forward 6120down 3121forward 3122forward 1123forward 5124forward 7125down 5126forward 8127down 7128down 8129forward 7130forward 8131down 7132forward 7133up 2134up 9135down 1136forward 1137forward 6138up 3139up 6140down 2141down 4142forward 2143up 8144forward 5145up 9146up 5147down 2148forward 5149forward 9150up 3151forward 7152down 4153down 3154down 2155forward 9156up 4157down 7158down 1159forward 9160forward 3161up 4162forward 1163up 6164forward 5165forward 2166forward 2167down 9168forward 1169up 7170forward 3171down 1172down 5173up 8174down 5175forward 5176forward 5177down 9178up 5179forward 8180up 9181down 1182forward 1183down 7184up 3185down 9186down 9187down 5188up 6189forward 7190down 5191down 2192down 5193forward 3194forward 2195forward 9196forward 5197forward 6198up 7199up 7200forward 4201forward 2202up 4203up 6204down 8205up 9206up 5207down 8208forward 4209up 9210forward 8211forward 3212down 6213down 6214down 7215down 6216forward 7217up 5218down 2219down 5220forward 2221up 5222forward 7223down 5224up 4225up 2226forward 2227forward 9228forward 5229forward 8230up 4231forward 6232up 7233forward 5234down 2235down 3236down 8237up 2238down 2239up 1240up 7241down 1242down 6243down 9244down 7245forward 8246up 8247up 9248down 9249forward 6250forward 6251down 6252forward 3253forward 4254forward 6255forward 7256down 5257down 8258forward 7259forward 9260down 4261up 9262forward 8263down 6264down 1265down 2266forward 4267down 5268up 1269forward 1270down 6271forward 4272forward 2273forward 6274down 8275up 2276up 8277forward 3278down 6279forward 7280down 1281forward 1282forward 8283down 8284down 8285down 2286forward 8287down 4288up 8289down 6290forward 2291down 5292up 3293up 1294down 2295forward 4296up 7297forward 2298up 9299forward 1300down 5301forward 3302up 9303up 4304down 4305up 6306down 1307forward 9308up 5309forward 5310up 4311down 6312forward 2313up 6314forward 5315forward 5316down 4317up 7318forward 2319down 9320down 8321down 7322forward 4323forward 7324down 4325forward 9326up 2327forward 1328up 4329down 8330forward 9331up 2332up 5333down 7334up 6335forward 7336up 1337forward 3338down 3339down 2340down 6341down 6342forward 3343down 2344down 2345down 5346down 4347down 6348down 2349forward 7350down 6351forward 4352down 5353down 7354down 3355forward 2356forward 8357forward 1358up 6359down 8360down 4361up 5362forward 5363down 7364forward 5365forward 8366forward 7367down 8368down 5369down 3370up 2371forward 8372forward 7373down 6374up 1375down 9376down 3377down 7378down 2379forward 9380forward 2381forward 4382forward 8383forward 3384forward 2385down 3386down 8387up 7388down 7389down 1390forward 8391down 2392up 4393forward 9394down 6395forward 5396forward 8397forward 1398forward 4399down 6400down 1401down 6402forward 1403forward 7404down 3405down 3406down 1407up 2408down 6409down 5410down 6411forward 5412forward 2413forward 1414forward 8415up 5416down 2417down 9418down 9419down 5420down 3421up 6422forward 2423down 7424down 7425down 2426down 2427up 6428forward 8429forward 6430forward 4431down 1432forward 7433down 5434up 9435forward 5436down 4437down 9438up 7439forward 1440up 3441up 7442forward 6443forward 8444up 6445up 3446forward 4447up 3448down 1449forward 8450forward 1451up 3452forward 7453up 2454forward 6455forward 2456down 2457down 9458down 9459forward 1460forward 8461down 5462forward 4463forward 5464forward 5465down 9466forward 8467up 8468down 6469down 2470down 5471down 6472up 9473up 8474down 4475down 9476up 4477forward 6478forward 1479forward 3480up 4481up 3482forward 3483forward 8484down 1485down 2486down 2487forward 9488forward 4489up 2490forward 7491down 4492up 1493forward 2494forward 9495forward 8496down 4497down 7498up 7499down 1500forward 3501down 7502down 8503up 2504forward 2505forward 8506forward 4507forward 4508down 5509forward 8510down 2511up 7512down 1513up 9514up 5515down 3516forward 6517forward 2518forward 6519down 5520down 6521forward 9522up 5523up 6524down 4525down 5526up 4527down 6528down 2529down 5530down 4531forward 7532forward 6533down 8534forward 2535down 5536down 7537down 2538forward 8539forward 6540down 3541forward 4542up 6543down 9544down 3545forward 3546forward 3547down 9548up 1549up 3550forward 3551forward 6552forward 1553forward 4554forward 3555forward 3556forward 3557down 6558down 8559forward 3560down 5561forward 8562forward 3563down 4564up 3565up 1566down 7567forward 7568up 6569forward 7570down 4571down 7572up 9573down 9574forward 8575down 5576down 2577forward 9578down 3579forward 4580forward 4581forward 4582forward 6583down 1584up 5585forward 8586down 6587forward 5588up 5589up 5590down 2591down 9592down 7593up 3594up 7595up 6596forward 2597forward 6598up 9599forward 5600forward 2601up 4602down 4603down 5604forward 7605down 5606down 7607forward 3608down 6609down 1610forward 6611up 5612up 6613up 3614down 9615up 7616forward 9617down 3618forward 4619up 2620forward 9621down 2622up 2623up 5624forward 1625down 8626down 1627down 8628up 2629forward 9630forward 1631up 2632down 1633up 1634forward 2635down 7636forward 9637up 1638forward 8639down 5640down 5641down 9642forward 5643down 7644down 1645forward 9646down 5647forward 9648forward 9649down 6650down 5651down 6652forward 3653down 4654up 8655down 6656up 4657down 9658up 1659up 2660up 8661forward 6662down 7663down 4664down 9665down 3666forward 9667down 5668forward 6669down 6670forward 7671down 9672forward 2673forward 2674down 8675down 7676forward 5677down 8678forward 6679down 1680forward 6681forward 7682forward 3683forward 2684forward 1685forward 1686down 9687forward 7688up 9689down 5690forward 6691down 4692down 2693forward 4694forward 3695forward 9696down 8697down 2698forward 4699down 8700down 6701forward 9702down 7703forward 1704up 1705forward 3706down 5707down 8708up 6709forward 9710forward 4711down 2712forward 4713up 2714forward 9715down 5716down 1717down 9718forward 5719down 9720forward 1721down 9722forward 8723down 5724forward 9725forward 8726up 8727down 7728up 9729down 5730up 9731forward 7732forward 7733forward 1734up 2735up 2736forward 6737up 5738up 5739down 7740forward 2741up 8742forward 8743down 8744forward 7745forward 8746down 7747down 8748forward 4749forward 2750down 8751up 4752down 1753up 7754forward 4755forward 3756down 6757up 6758forward 6759down 1760forward 3761down 6762forward 6763up 3764up 1765up 5766down 1767up 9768down 8769forward 7770forward 9771up 2772forward 2773forward 6774up 2775up 3776forward 1777forward 2778forward 8779down 6780forward 5781down 8782forward 2783up 1784down 1785down 3786forward 9787down 6788down 1789down 6790down 6791down 6792down 1793up 6794down 6795forward 6796down 5797down 2798up 5799forward 7800down 3801forward 9802forward 2803down 2804down 1805down 9806up 3807down 2808forward 2809forward 6810down 4811up 7812up 3813up 9814forward 3815forward 8816forward 9817forward 4818forward 2819up 7820up 5821down 9822forward 1823up 1824down 7825forward 5826forward 5827down 3828forward 1829forward 6830up 8831down 4832down 2833up 2834forward 2835forward 1836down 4837up 9838down 1839down 4840down 6841forward 3842forward 7843down 4844up 8845down 6846forward 7847forward 4848up 2849down 8850forward 5851down 1852forward 7853down 1854up 6855down 9856forward 3857forward 1858up 2859up 4860forward 8861forward 1862up 8863forward 3864forward 7865up 9866up 6867up 9868down 9869down 5870forward 8871forward 7872down 5873forward 7874forward 6875forward 8876up 4877forward 6878down 6879up 8880down 7881up 8882forward 6883forward 7884down 4885forward 4886up 2887forward 9888down 6889down 2890down 8891forward 6892up 2893up 8894forward 2895down 3896forward 7897forward 6898down 9899up 1900forward 1901down 8902down 8903forward 4904forward 4905up 6906down 8907up 8908forward 1909forward 1910down 6911up 3912up 7913forward 1914forward 1915up 2916forward 2917down 4918up 8919forward 1920up 7921down 2922forward 2923down 1924forward 1925down 4926forward 4927forward 8928up 5929down 6930up 8931forward 4932down 3933up 6934forward 3935forward 4936down 5937forward 1938forward 6939forward 4940forward 1941down 7942down 4943forward 2944down 6945forward 3946down 5947forward 3948forward 4949forward 4950forward 9951down 5952forward 7953forward 7954forward 9955down 1956up 6957forward 1958down 9959forward 3960down 7961up 8962up 6963down 7964forward 2965down 9966forward 9967forward 6968down 9969forward 6970down 8971forward 1972up 6973down 1974forward 6975down 9976forward 6977forward 7978forward 3979forward 8980forward 5981forward 8982down 9983down 2984forward 3985down 3986up 4987down 4988down 3989forward 3990forward 3991down 5992forward 5993forward 1994down 9995down 3996up 7997forward 9998up 1999down 11000down 61001up 11002forward 2`)...
Using AI Code Generation
1var parent = require('stryker-parent');2parent.forward('test');3var child = require('stryker-child');4child.forward('test');5var children = require('stryker-children');6children.forward('test');7var parent = require('stryker-parent');8parent.forward('test');9var child = require('stryker-child');10child.forward('test');11var children = require('stryker-children');12children.forward('test');13var parent = require('stryker-parent');14parent.forward('test');15var child = require('stryker-child');16child.forward('test');17var children = require('stryker-children');18children.forward('test');19var parent = require('stryker-parent');20parent.forward('test');21var child = require('stryker-child');22child.forward('test');23var children = require('stryker-children');24children.forward('test');25var parent = require('stryker-parent');26parent.forward('test');27var child = require('stryker-child');28child.forward('test');29var children = require('stryker-children');30children.forward('test');31var parent = require('stryker-parent');32parent.forward('test');33var child = require('stryker-child');34child.forward('test');35var children = require('stryker-children');36children.forward('test');
Using AI Code Generation
1var parent = require('stryker-parent');2parent.forward('test');3var parent = require('stryker-parent');4parent.forward('test');5var parent = require('stryker-parent');6parent.forward('test');
Using AI Code Generation
1var parent = require('stryker-parent');2parent.forward('test');3module.exports = {4 forward: function (message) {5 console.log(message);6 }7};8{9}10{11 "scripts": {12 },13 "dependencies": {14 }15}16{17 "scripts": {18 },19 "dependencies": {20 }21}22{23 "scripts": {24 },25 "dependencies": {26 }27}
Using AI Code Generation
1var stryker = require('stryker-parent');2stryker.forward('mocha', ['--grep', 'should be tested']);3module.exports = function(config) {4 config.set({5 });6};
Using AI Code Generation
1var stryker = require('stryker-parent');2var childProcess = stryker('childProcess');3childProcess.forward('message', function (message) {4 console.log(message);5});6childProcess.forward('error', function (message) {7 console.log(message);8});9var stryker = require('stryker-child');10var childProcess = stryker('childProcess');11childProcess.forward('message', function (message) {12 console.log(message);13});14childProcess.forward('error', function (message) {15 console.log(message);16});17var stryker = require('stryker-parent');18var childProcess = stryker('childProcess');19childProcess.forward('message', function (message) {20 console.log(message);21});22childProcess.forward('error', function (message) {23 console.log(message);24});25childProcess.zip (3.3 KB)26var stryker = require('stryker-parent');27var childProcess = stryker('childProcess');28childProcess.forward('message', function (message) {29 console.log('Parent process received message: ' + message);30});31childProcess.forward('error', function (message) {32 console.log('Parent process received error: ' + message);33});
Using AI Code Generation
1console.log('This is test.js');2var parent = require('stryker-parent');3parent.forward('test.js');4console.log('This is stryker-parent/index.js');5var parent = require('stryker-parent');6parent.forward('stryker-parent/index.js');7console.log('This is stryker-parent/stryker-parent.js');8var parent = require('stryker-parent');9parent.forward('stryker-parent/stryker-parent.js');10console.log('This is stryker-parent/stryker-parent/stryker-parent.js');11var parent = require('stryker-parent');12parent.forward('stryker-parent/stryker-parent/stryker-parent.js');13console.log('This is stryker-parent/stryker-parent/stryker-parent/stryker-parent.js');14var parent = require('stryker-parent');15parent.forward('stryker-parent/stryker-parent/stryker-parent/stryker-parent.js');16console.log('This is stryker-parent/stryker-parent/stryker-parent/stryker-parent/stryker-parent.js');17var parent = require('stryker-parent');18parent.forward('stryker-parent/stryker-parent/stryker-parent/stryker-parent/stryker-parent.js');19console.log('This is stryker-parent/stryker-parent/stryker-parent/stryker-parent/stryker-parent/stryker-parent.js');20var parent = require('stryker-parent');21parent.forward('stryker-parent/stryker-parent/stryker-parent/stryker-parent/stryker-parent/stryker-parent.js
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!