day 5 done
This commit is contained in:
parent
69ff07e0cf
commit
952c986810
86
day5/.gitignore
vendored
Normal file
86
day5/.gitignore
vendored
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
node_modules/
|
||||||
|
.node_modules/
|
||||||
|
built/*
|
||||||
|
tests/cases/rwc/*
|
||||||
|
tests/cases/test262/*
|
||||||
|
tests/cases/perf/*
|
||||||
|
!tests/cases/webharness/compilerToString.js
|
||||||
|
test-args.txt
|
||||||
|
~*.docx
|
||||||
|
\#*\#
|
||||||
|
.\#*
|
||||||
|
tests/baselines/local/*
|
||||||
|
tests/baselines/local.old/*
|
||||||
|
tests/services/baselines/local/*
|
||||||
|
tests/baselines/prototyping/local/*
|
||||||
|
tests/baselines/rwc/*
|
||||||
|
tests/baselines/test262/*
|
||||||
|
tests/baselines/reference/projectOutput/*
|
||||||
|
tests/baselines/local/projectOutput/*
|
||||||
|
tests/baselines/reference/testresults.tap
|
||||||
|
tests/services/baselines/prototyping/local/*
|
||||||
|
tests/services/browser/typescriptServices.js
|
||||||
|
src/harness/*.js
|
||||||
|
src/compiler/diagnosticInformationMap.generated.ts
|
||||||
|
src/compiler/diagnosticMessages.generated.json
|
||||||
|
src/parser/diagnosticInformationMap.generated.ts
|
||||||
|
src/parser/diagnosticMessages.generated.json
|
||||||
|
rwc-report.html
|
||||||
|
*.swp
|
||||||
|
build.json
|
||||||
|
*.actual
|
||||||
|
tests/webTestServer.js
|
||||||
|
tests/webTestServer.js.map
|
||||||
|
tests/webhost/*.d.ts
|
||||||
|
tests/webhost/webtsc.js
|
||||||
|
tests/cases/**/*.js
|
||||||
|
!tests/cases/docker/*.js/
|
||||||
|
tests/cases/**/*.js.map
|
||||||
|
*.config
|
||||||
|
scripts/eslint/built/
|
||||||
|
scripts/debug.bat
|
||||||
|
scripts/run.bat
|
||||||
|
scripts/**/*.js
|
||||||
|
scripts/**/*.js.map
|
||||||
|
coverage/
|
||||||
|
internal/
|
||||||
|
**/.DS_Store
|
||||||
|
.settings
|
||||||
|
**/.vs
|
||||||
|
**/.vscode/*
|
||||||
|
!**/.vscode/tasks.json
|
||||||
|
!**/.vscode/settings.template.json
|
||||||
|
!**/.vscode/launch.template.json
|
||||||
|
!**/.vscode/extensions.json
|
||||||
|
!tests/cases/projects/projectOption/**/node_modules
|
||||||
|
!tests/cases/projects/NodeModulesSearch/**/*
|
||||||
|
!tests/baselines/reference/project/nodeModules*/**/*
|
||||||
|
.idea
|
||||||
|
yarn.lock
|
||||||
|
yarn-error.log
|
||||||
|
.parallelperf.*
|
||||||
|
tests/cases/user/*/package-lock.json
|
||||||
|
tests/cases/user/*/node_modules/
|
||||||
|
tests/cases/user/*/**/*.js
|
||||||
|
tests/cases/user/*/**/*.js.map
|
||||||
|
tests/cases/user/*/**/*.d.ts
|
||||||
|
!tests/cases/user/zone.js/
|
||||||
|
!tests/cases/user/bignumber.js/
|
||||||
|
!tests/cases/user/discord.js/
|
||||||
|
tests/baselines/reference/dt
|
||||||
|
.failed-tests
|
||||||
|
TEST-results.xml
|
||||||
|
package-lock.json
|
||||||
|
tests/cases/user/npm/npm
|
||||||
|
tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter
|
||||||
|
tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter
|
||||||
|
tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter
|
||||||
|
tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter
|
||||||
|
tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter
|
||||||
|
tests/cases/user/create-react-app/create-react-app
|
||||||
|
tests/cases/user/fp-ts/fp-ts
|
||||||
|
tests/cases/user/webpack/webpack
|
||||||
|
tests/cases/user/puppeteer/puppeteer
|
||||||
|
tests/cases/user/axios-src/axios-src
|
||||||
|
tests/cases/user/prettier/prettier
|
||||||
|
.eslintcache
|
9
day5/inp
Normal file
9
day5/inp
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[D]
|
||||||
|
[N] [C]
|
||||||
|
[Z] [M] [P]
|
||||||
|
1 2 3
|
||||||
|
|
||||||
|
move 1 from 2 to 1
|
||||||
|
move 3 from 1 to 3
|
||||||
|
move 2 from 2 to 1
|
||||||
|
move 1 from 1 to 2
|
511
day5/input
Normal file
511
day5/input
Normal file
@ -0,0 +1,511 @@
|
|||||||
|
[C] [B] [H]
|
||||||
|
[W] [D] [J] [Q] [B]
|
||||||
|
[P] [F] [Z] [F] [B] [L]
|
||||||
|
[G] [Z] [N] [P] [J] [S] [V]
|
||||||
|
[Z] [C] [H] [Z] [G] [T] [Z] [C]
|
||||||
|
[V] [B] [M] [M] [C] [Q] [C] [G] [H]
|
||||||
|
[S] [V] [L] [D] [F] [F] [G] [L] [F]
|
||||||
|
[B] [J] [V] [L] [V] [G] [L] [N] [J]
|
||||||
|
1 2 3 4 5 6 7 8 9
|
||||||
|
|
||||||
|
move 5 from 4 to 7
|
||||||
|
move 8 from 5 to 9
|
||||||
|
move 6 from 2 to 8
|
||||||
|
move 7 from 7 to 9
|
||||||
|
move 1 from 7 to 4
|
||||||
|
move 2 from 7 to 4
|
||||||
|
move 9 from 8 to 4
|
||||||
|
move 16 from 9 to 7
|
||||||
|
move 1 from 3 to 8
|
||||||
|
move 15 from 4 to 5
|
||||||
|
move 3 from 9 to 5
|
||||||
|
move 2 from 3 to 5
|
||||||
|
move 1 from 8 to 7
|
||||||
|
move 3 from 1 to 7
|
||||||
|
move 5 from 3 to 5
|
||||||
|
move 13 from 7 to 2
|
||||||
|
move 5 from 7 to 1
|
||||||
|
move 7 from 2 to 6
|
||||||
|
move 2 from 7 to 8
|
||||||
|
move 3 from 6 to 5
|
||||||
|
move 2 from 8 to 2
|
||||||
|
move 2 from 6 to 1
|
||||||
|
move 11 from 1 to 7
|
||||||
|
move 2 from 2 to 9
|
||||||
|
move 8 from 6 to 5
|
||||||
|
move 2 from 9 to 6
|
||||||
|
move 3 from 6 to 4
|
||||||
|
move 1 from 4 to 7
|
||||||
|
move 22 from 5 to 6
|
||||||
|
move 13 from 6 to 9
|
||||||
|
move 5 from 2 to 7
|
||||||
|
move 6 from 5 to 8
|
||||||
|
move 13 from 7 to 2
|
||||||
|
move 2 from 4 to 6
|
||||||
|
move 5 from 6 to 3
|
||||||
|
move 2 from 7 to 5
|
||||||
|
move 3 from 3 to 6
|
||||||
|
move 2 from 6 to 2
|
||||||
|
move 8 from 2 to 4
|
||||||
|
move 2 from 4 to 7
|
||||||
|
move 2 from 2 to 9
|
||||||
|
move 5 from 4 to 5
|
||||||
|
move 2 from 3 to 2
|
||||||
|
move 1 from 5 to 4
|
||||||
|
move 6 from 5 to 9
|
||||||
|
move 1 from 7 to 3
|
||||||
|
move 1 from 5 to 9
|
||||||
|
move 5 from 5 to 1
|
||||||
|
move 1 from 6 to 8
|
||||||
|
move 1 from 5 to 8
|
||||||
|
move 4 from 6 to 9
|
||||||
|
move 8 from 8 to 9
|
||||||
|
move 1 from 3 to 6
|
||||||
|
move 4 from 1 to 7
|
||||||
|
move 3 from 6 to 4
|
||||||
|
move 7 from 2 to 6
|
||||||
|
move 27 from 9 to 8
|
||||||
|
move 3 from 4 to 7
|
||||||
|
move 6 from 8 to 1
|
||||||
|
move 1 from 4 to 6
|
||||||
|
move 1 from 2 to 7
|
||||||
|
move 7 from 6 to 3
|
||||||
|
move 1 from 4 to 3
|
||||||
|
move 4 from 1 to 6
|
||||||
|
move 1 from 9 to 2
|
||||||
|
move 1 from 2 to 4
|
||||||
|
move 1 from 4 to 5
|
||||||
|
move 3 from 9 to 4
|
||||||
|
move 5 from 7 to 8
|
||||||
|
move 2 from 5 to 6
|
||||||
|
move 4 from 6 to 9
|
||||||
|
move 10 from 8 to 3
|
||||||
|
move 2 from 4 to 7
|
||||||
|
move 3 from 1 to 7
|
||||||
|
move 2 from 9 to 6
|
||||||
|
move 6 from 3 to 1
|
||||||
|
move 7 from 3 to 4
|
||||||
|
move 2 from 1 to 9
|
||||||
|
move 4 from 1 to 9
|
||||||
|
move 1 from 3 to 6
|
||||||
|
move 1 from 3 to 8
|
||||||
|
move 2 from 9 to 5
|
||||||
|
move 2 from 5 to 3
|
||||||
|
move 3 from 3 to 1
|
||||||
|
move 1 from 4 to 6
|
||||||
|
move 5 from 7 to 6
|
||||||
|
move 2 from 3 to 4
|
||||||
|
move 2 from 8 to 1
|
||||||
|
move 9 from 4 to 7
|
||||||
|
move 4 from 9 to 3
|
||||||
|
move 2 from 8 to 3
|
||||||
|
move 1 from 1 to 4
|
||||||
|
move 1 from 6 to 2
|
||||||
|
move 1 from 2 to 9
|
||||||
|
move 6 from 3 to 5
|
||||||
|
move 2 from 1 to 3
|
||||||
|
move 1 from 3 to 2
|
||||||
|
move 1 from 2 to 9
|
||||||
|
move 8 from 6 to 8
|
||||||
|
move 2 from 6 to 3
|
||||||
|
move 1 from 1 to 2
|
||||||
|
move 7 from 7 to 9
|
||||||
|
move 13 from 8 to 6
|
||||||
|
move 1 from 2 to 8
|
||||||
|
move 6 from 9 to 3
|
||||||
|
move 1 from 1 to 6
|
||||||
|
move 2 from 8 to 5
|
||||||
|
move 5 from 3 to 4
|
||||||
|
move 2 from 8 to 1
|
||||||
|
move 8 from 5 to 2
|
||||||
|
move 4 from 3 to 2
|
||||||
|
move 5 from 8 to 4
|
||||||
|
move 2 from 9 to 4
|
||||||
|
move 4 from 4 to 7
|
||||||
|
move 10 from 2 to 6
|
||||||
|
move 1 from 2 to 9
|
||||||
|
move 24 from 6 to 1
|
||||||
|
move 17 from 1 to 8
|
||||||
|
move 1 from 9 to 2
|
||||||
|
move 2 from 4 to 9
|
||||||
|
move 10 from 7 to 4
|
||||||
|
move 1 from 2 to 5
|
||||||
|
move 5 from 9 to 1
|
||||||
|
move 1 from 7 to 6
|
||||||
|
move 12 from 8 to 6
|
||||||
|
move 1 from 7 to 5
|
||||||
|
move 2 from 5 to 6
|
||||||
|
move 16 from 6 to 8
|
||||||
|
move 12 from 1 to 6
|
||||||
|
move 2 from 1 to 7
|
||||||
|
move 9 from 6 to 2
|
||||||
|
move 2 from 4 to 1
|
||||||
|
move 1 from 1 to 5
|
||||||
|
move 7 from 4 to 6
|
||||||
|
move 13 from 8 to 2
|
||||||
|
move 5 from 8 to 2
|
||||||
|
move 2 from 7 to 3
|
||||||
|
move 2 from 4 to 9
|
||||||
|
move 1 from 5 to 4
|
||||||
|
move 3 from 9 to 8
|
||||||
|
move 2 from 4 to 2
|
||||||
|
move 2 from 3 to 8
|
||||||
|
move 1 from 1 to 5
|
||||||
|
move 1 from 4 to 8
|
||||||
|
move 6 from 2 to 7
|
||||||
|
move 1 from 5 to 8
|
||||||
|
move 1 from 6 to 2
|
||||||
|
move 7 from 6 to 8
|
||||||
|
move 1 from 6 to 2
|
||||||
|
move 24 from 2 to 1
|
||||||
|
move 10 from 8 to 3
|
||||||
|
move 4 from 8 to 2
|
||||||
|
move 4 from 7 to 1
|
||||||
|
move 5 from 2 to 9
|
||||||
|
move 1 from 6 to 2
|
||||||
|
move 10 from 3 to 1
|
||||||
|
move 2 from 7 to 3
|
||||||
|
move 2 from 3 to 7
|
||||||
|
move 2 from 7 to 9
|
||||||
|
move 35 from 1 to 5
|
||||||
|
move 28 from 5 to 6
|
||||||
|
move 2 from 2 to 7
|
||||||
|
move 19 from 6 to 4
|
||||||
|
move 3 from 1 to 2
|
||||||
|
move 3 from 2 to 5
|
||||||
|
move 23 from 4 to 7
|
||||||
|
move 2 from 6 to 8
|
||||||
|
move 4 from 7 to 6
|
||||||
|
move 3 from 5 to 6
|
||||||
|
move 13 from 7 to 4
|
||||||
|
move 2 from 5 to 6
|
||||||
|
move 2 from 9 to 4
|
||||||
|
move 5 from 6 to 3
|
||||||
|
move 6 from 4 to 5
|
||||||
|
move 1 from 4 to 8
|
||||||
|
move 4 from 4 to 6
|
||||||
|
move 5 from 9 to 7
|
||||||
|
move 2 from 8 to 7
|
||||||
|
move 5 from 3 to 2
|
||||||
|
move 4 from 5 to 2
|
||||||
|
move 5 from 2 to 9
|
||||||
|
move 4 from 8 to 4
|
||||||
|
move 1 from 9 to 8
|
||||||
|
move 2 from 2 to 6
|
||||||
|
move 4 from 4 to 2
|
||||||
|
move 3 from 2 to 3
|
||||||
|
move 3 from 5 to 1
|
||||||
|
move 2 from 3 to 2
|
||||||
|
move 3 from 1 to 4
|
||||||
|
move 1 from 9 to 4
|
||||||
|
move 5 from 4 to 9
|
||||||
|
move 2 from 4 to 3
|
||||||
|
move 5 from 6 to 8
|
||||||
|
move 1 from 9 to 7
|
||||||
|
move 2 from 6 to 3
|
||||||
|
move 1 from 4 to 5
|
||||||
|
move 1 from 9 to 4
|
||||||
|
move 6 from 8 to 6
|
||||||
|
move 2 from 3 to 6
|
||||||
|
move 2 from 9 to 4
|
||||||
|
move 2 from 3 to 9
|
||||||
|
move 1 from 3 to 1
|
||||||
|
move 17 from 6 to 4
|
||||||
|
move 1 from 1 to 8
|
||||||
|
move 1 from 6 to 5
|
||||||
|
move 1 from 9 to 2
|
||||||
|
move 11 from 4 to 6
|
||||||
|
move 9 from 4 to 5
|
||||||
|
move 7 from 9 to 4
|
||||||
|
move 2 from 5 to 2
|
||||||
|
move 1 from 4 to 9
|
||||||
|
move 5 from 2 to 1
|
||||||
|
move 1 from 2 to 9
|
||||||
|
move 4 from 4 to 9
|
||||||
|
move 4 from 1 to 5
|
||||||
|
move 1 from 1 to 7
|
||||||
|
move 1 from 8 to 9
|
||||||
|
move 8 from 7 to 8
|
||||||
|
move 4 from 7 to 4
|
||||||
|
move 9 from 5 to 2
|
||||||
|
move 2 from 4 to 1
|
||||||
|
move 11 from 6 to 8
|
||||||
|
move 2 from 4 to 3
|
||||||
|
move 2 from 4 to 8
|
||||||
|
move 1 from 1 to 4
|
||||||
|
move 3 from 2 to 8
|
||||||
|
move 1 from 1 to 3
|
||||||
|
move 3 from 3 to 9
|
||||||
|
move 8 from 9 to 6
|
||||||
|
move 1 from 4 to 8
|
||||||
|
move 2 from 9 to 3
|
||||||
|
move 5 from 6 to 9
|
||||||
|
move 7 from 5 to 6
|
||||||
|
move 2 from 3 to 4
|
||||||
|
move 5 from 7 to 9
|
||||||
|
move 2 from 4 to 5
|
||||||
|
move 2 from 2 to 3
|
||||||
|
move 10 from 9 to 5
|
||||||
|
move 2 from 6 to 3
|
||||||
|
move 6 from 2 to 7
|
||||||
|
move 10 from 5 to 3
|
||||||
|
move 6 from 7 to 1
|
||||||
|
move 2 from 1 to 7
|
||||||
|
move 4 from 3 to 9
|
||||||
|
move 3 from 8 to 2
|
||||||
|
move 2 from 7 to 5
|
||||||
|
move 19 from 8 to 7
|
||||||
|
move 4 from 5 to 9
|
||||||
|
move 4 from 9 to 8
|
||||||
|
move 1 from 2 to 5
|
||||||
|
move 3 from 6 to 8
|
||||||
|
move 1 from 5 to 9
|
||||||
|
move 5 from 9 to 7
|
||||||
|
move 6 from 3 to 8
|
||||||
|
move 1 from 3 to 8
|
||||||
|
move 2 from 3 to 2
|
||||||
|
move 23 from 7 to 6
|
||||||
|
move 10 from 8 to 4
|
||||||
|
move 4 from 4 to 9
|
||||||
|
move 4 from 2 to 6
|
||||||
|
move 1 from 3 to 8
|
||||||
|
move 4 from 8 to 4
|
||||||
|
move 31 from 6 to 4
|
||||||
|
move 9 from 4 to 5
|
||||||
|
move 8 from 5 to 3
|
||||||
|
move 1 from 6 to 7
|
||||||
|
move 2 from 5 to 7
|
||||||
|
move 4 from 9 to 2
|
||||||
|
move 21 from 4 to 8
|
||||||
|
move 4 from 2 to 9
|
||||||
|
move 3 from 3 to 9
|
||||||
|
move 2 from 7 to 9
|
||||||
|
move 11 from 4 to 9
|
||||||
|
move 1 from 8 to 5
|
||||||
|
move 1 from 5 to 9
|
||||||
|
move 9 from 9 to 3
|
||||||
|
move 3 from 1 to 5
|
||||||
|
move 2 from 5 to 8
|
||||||
|
move 11 from 3 to 6
|
||||||
|
move 4 from 6 to 3
|
||||||
|
move 2 from 8 to 3
|
||||||
|
move 10 from 9 to 6
|
||||||
|
move 22 from 8 to 9
|
||||||
|
move 1 from 1 to 8
|
||||||
|
move 4 from 6 to 3
|
||||||
|
move 2 from 7 to 6
|
||||||
|
move 3 from 8 to 3
|
||||||
|
move 14 from 3 to 2
|
||||||
|
move 1 from 3 to 4
|
||||||
|
move 1 from 2 to 4
|
||||||
|
move 2 from 9 to 1
|
||||||
|
move 1 from 5 to 7
|
||||||
|
move 1 from 3 to 2
|
||||||
|
move 14 from 6 to 5
|
||||||
|
move 13 from 5 to 2
|
||||||
|
move 1 from 5 to 6
|
||||||
|
move 1 from 7 to 9
|
||||||
|
move 8 from 9 to 4
|
||||||
|
move 2 from 6 to 7
|
||||||
|
move 23 from 2 to 4
|
||||||
|
move 2 from 1 to 4
|
||||||
|
move 2 from 2 to 5
|
||||||
|
move 1 from 5 to 1
|
||||||
|
move 1 from 7 to 2
|
||||||
|
move 1 from 5 to 9
|
||||||
|
move 16 from 9 to 5
|
||||||
|
move 1 from 2 to 4
|
||||||
|
move 13 from 5 to 3
|
||||||
|
move 1 from 1 to 4
|
||||||
|
move 1 from 7 to 1
|
||||||
|
move 1 from 5 to 3
|
||||||
|
move 2 from 5 to 7
|
||||||
|
move 2 from 7 to 1
|
||||||
|
move 9 from 3 to 2
|
||||||
|
move 2 from 1 to 7
|
||||||
|
move 1 from 1 to 9
|
||||||
|
move 19 from 4 to 2
|
||||||
|
move 1 from 9 to 7
|
||||||
|
move 1 from 7 to 8
|
||||||
|
move 23 from 2 to 8
|
||||||
|
move 2 from 7 to 2
|
||||||
|
move 12 from 4 to 5
|
||||||
|
move 12 from 5 to 1
|
||||||
|
move 5 from 2 to 9
|
||||||
|
move 2 from 2 to 7
|
||||||
|
move 5 from 8 to 1
|
||||||
|
move 3 from 9 to 4
|
||||||
|
move 1 from 2 to 8
|
||||||
|
move 1 from 2 to 4
|
||||||
|
move 4 from 8 to 1
|
||||||
|
move 2 from 3 to 1
|
||||||
|
move 2 from 7 to 5
|
||||||
|
move 1 from 4 to 9
|
||||||
|
move 8 from 4 to 7
|
||||||
|
move 13 from 8 to 6
|
||||||
|
move 1 from 3 to 1
|
||||||
|
move 13 from 6 to 7
|
||||||
|
move 13 from 7 to 6
|
||||||
|
move 7 from 1 to 4
|
||||||
|
move 5 from 7 to 3
|
||||||
|
move 3 from 4 to 3
|
||||||
|
move 13 from 6 to 1
|
||||||
|
move 3 from 8 to 6
|
||||||
|
move 8 from 3 to 8
|
||||||
|
move 12 from 1 to 8
|
||||||
|
move 1 from 3 to 5
|
||||||
|
move 6 from 1 to 7
|
||||||
|
move 3 from 6 to 8
|
||||||
|
move 1 from 3 to 8
|
||||||
|
move 1 from 9 to 2
|
||||||
|
move 3 from 5 to 6
|
||||||
|
move 1 from 7 to 3
|
||||||
|
move 8 from 7 to 1
|
||||||
|
move 2 from 6 to 2
|
||||||
|
move 3 from 4 to 3
|
||||||
|
move 2 from 9 to 2
|
||||||
|
move 6 from 8 to 9
|
||||||
|
move 5 from 2 to 5
|
||||||
|
move 2 from 3 to 4
|
||||||
|
move 5 from 5 to 4
|
||||||
|
move 1 from 3 to 9
|
||||||
|
move 8 from 4 to 5
|
||||||
|
move 1 from 6 to 8
|
||||||
|
move 2 from 1 to 4
|
||||||
|
move 1 from 1 to 4
|
||||||
|
move 3 from 1 to 5
|
||||||
|
move 3 from 1 to 6
|
||||||
|
move 7 from 1 to 9
|
||||||
|
move 2 from 6 to 9
|
||||||
|
move 1 from 3 to 5
|
||||||
|
move 17 from 8 to 7
|
||||||
|
move 17 from 7 to 6
|
||||||
|
move 5 from 5 to 2
|
||||||
|
move 5 from 2 to 1
|
||||||
|
move 13 from 6 to 2
|
||||||
|
move 1 from 1 to 4
|
||||||
|
move 5 from 5 to 1
|
||||||
|
move 1 from 1 to 5
|
||||||
|
move 10 from 9 to 1
|
||||||
|
move 13 from 1 to 8
|
||||||
|
move 13 from 8 to 4
|
||||||
|
move 5 from 6 to 7
|
||||||
|
move 8 from 1 to 7
|
||||||
|
move 1 from 1 to 3
|
||||||
|
move 12 from 2 to 6
|
||||||
|
move 1 from 3 to 8
|
||||||
|
move 6 from 6 to 2
|
||||||
|
move 2 from 5 to 1
|
||||||
|
move 5 from 2 to 5
|
||||||
|
move 2 from 5 to 9
|
||||||
|
move 12 from 4 to 2
|
||||||
|
move 1 from 6 to 2
|
||||||
|
move 15 from 2 to 1
|
||||||
|
move 1 from 8 to 6
|
||||||
|
move 2 from 7 to 3
|
||||||
|
move 2 from 4 to 2
|
||||||
|
move 1 from 2 to 9
|
||||||
|
move 1 from 2 to 6
|
||||||
|
move 7 from 7 to 3
|
||||||
|
move 1 from 4 to 1
|
||||||
|
move 17 from 1 to 2
|
||||||
|
move 3 from 6 to 4
|
||||||
|
move 1 from 3 to 8
|
||||||
|
move 3 from 9 to 6
|
||||||
|
move 4 from 6 to 3
|
||||||
|
move 13 from 2 to 9
|
||||||
|
move 3 from 2 to 8
|
||||||
|
move 2 from 5 to 1
|
||||||
|
move 6 from 8 to 2
|
||||||
|
move 1 from 6 to 2
|
||||||
|
move 3 from 2 to 7
|
||||||
|
move 3 from 1 to 6
|
||||||
|
move 2 from 9 to 8
|
||||||
|
move 6 from 9 to 8
|
||||||
|
move 8 from 9 to 3
|
||||||
|
move 7 from 7 to 4
|
||||||
|
move 20 from 3 to 7
|
||||||
|
move 4 from 6 to 8
|
||||||
|
move 1 from 8 to 6
|
||||||
|
move 2 from 6 to 4
|
||||||
|
move 3 from 2 to 1
|
||||||
|
move 2 from 9 to 6
|
||||||
|
move 9 from 8 to 6
|
||||||
|
move 3 from 1 to 9
|
||||||
|
move 9 from 4 to 8
|
||||||
|
move 1 from 5 to 6
|
||||||
|
move 3 from 4 to 2
|
||||||
|
move 1 from 5 to 3
|
||||||
|
move 8 from 6 to 4
|
||||||
|
move 4 from 9 to 3
|
||||||
|
move 10 from 8 to 6
|
||||||
|
move 5 from 2 to 3
|
||||||
|
move 3 from 6 to 4
|
||||||
|
move 10 from 3 to 1
|
||||||
|
move 11 from 4 to 1
|
||||||
|
move 1 from 8 to 2
|
||||||
|
move 2 from 4 to 2
|
||||||
|
move 1 from 4 to 9
|
||||||
|
move 10 from 6 to 3
|
||||||
|
move 21 from 1 to 5
|
||||||
|
move 2 from 2 to 7
|
||||||
|
move 1 from 9 to 6
|
||||||
|
move 1 from 6 to 3
|
||||||
|
move 1 from 6 to 7
|
||||||
|
move 11 from 5 to 6
|
||||||
|
move 1 from 2 to 8
|
||||||
|
move 1 from 5 to 9
|
||||||
|
move 11 from 6 to 3
|
||||||
|
move 1 from 8 to 4
|
||||||
|
move 1 from 4 to 1
|
||||||
|
move 3 from 5 to 7
|
||||||
|
move 1 from 1 to 5
|
||||||
|
move 5 from 5 to 8
|
||||||
|
move 23 from 7 to 9
|
||||||
|
move 5 from 8 to 4
|
||||||
|
move 1 from 5 to 2
|
||||||
|
move 12 from 3 to 4
|
||||||
|
move 6 from 3 to 6
|
||||||
|
move 1 from 5 to 2
|
||||||
|
move 8 from 9 to 2
|
||||||
|
move 1 from 7 to 8
|
||||||
|
move 2 from 7 to 9
|
||||||
|
move 4 from 3 to 5
|
||||||
|
move 1 from 5 to 9
|
||||||
|
move 1 from 6 to 5
|
||||||
|
move 4 from 6 to 5
|
||||||
|
move 3 from 2 to 1
|
||||||
|
move 3 from 1 to 3
|
||||||
|
move 8 from 9 to 1
|
||||||
|
move 4 from 2 to 9
|
||||||
|
move 1 from 9 to 7
|
||||||
|
move 14 from 4 to 8
|
||||||
|
move 3 from 3 to 4
|
||||||
|
move 1 from 5 to 8
|
||||||
|
move 2 from 8 to 6
|
||||||
|
move 2 from 6 to 7
|
||||||
|
move 4 from 4 to 3
|
||||||
|
move 12 from 9 to 1
|
||||||
|
move 1 from 3 to 2
|
||||||
|
move 6 from 8 to 2
|
||||||
|
move 1 from 7 to 1
|
||||||
|
move 5 from 2 to 3
|
||||||
|
move 21 from 1 to 3
|
||||||
|
move 5 from 5 to 4
|
||||||
|
move 1 from 8 to 5
|
||||||
|
move 2 from 2 to 7
|
||||||
|
move 1 from 6 to 1
|
||||||
|
move 2 from 9 to 2
|
||||||
|
move 1 from 2 to 9
|
||||||
|
move 1 from 1 to 5
|
||||||
|
move 4 from 3 to 5
|
||||||
|
move 7 from 8 to 1
|
||||||
|
move 6 from 1 to 9
|
||||||
|
move 1 from 2 to 5
|
||||||
|
move 6 from 9 to 7
|
||||||
|
move 8 from 3 to 4
|
||||||
|
move 2 from 4 to 8
|
||||||
|
move 1 from 1 to 6
|
||||||
|
move 10 from 3 to 9
|
||||||
|
move 12 from 4 to 2
|
||||||
|
move 1 from 8 to 1
|
5
day5/package.json
Normal file
5
day5/package.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^18.11.10"
|
||||||
|
}
|
||||||
|
}
|
73
day5/solution.ts
Normal file
73
day5/solution.ts
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
import { readFileSync } from 'fs';
|
||||||
|
import { join } from 'path';
|
||||||
|
|
||||||
|
|
||||||
|
function transpose(matrix) {
|
||||||
|
return matrix.reduce((prev, next) => next.map((item, i) =>
|
||||||
|
(prev[i] || []).concat(next[i])
|
||||||
|
), []);
|
||||||
|
}
|
||||||
|
|
||||||
|
const fileString = readFileSync(join(__dirname, "input"), 'utf-8');
|
||||||
|
const problemParts = fileString.split("\n\n");
|
||||||
|
const rows = problemParts[0].split("\n");
|
||||||
|
var rotRows = [];
|
||||||
|
for (const row of rows) {
|
||||||
|
rotRows.push(row.match(/.{1,4}/g));
|
||||||
|
}
|
||||||
|
|
||||||
|
rotRows.pop();
|
||||||
|
|
||||||
|
|
||||||
|
//rotRows = rotRows.map((_, index) => rotRows.map(row => row[index]).reverse());
|
||||||
|
rotRows = transpose(rotRows);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
rotRows = rotRows.map(element => {
|
||||||
|
return element.map(val => {
|
||||||
|
return val.trim();
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
rotRows = rotRows.map(element => {
|
||||||
|
return element.filter(val => {
|
||||||
|
return val.length != 0;
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
rotRows = rotRows.map(element => {
|
||||||
|
return element.reverse()
|
||||||
|
});
|
||||||
|
|
||||||
|
const movesRawText = problemParts[1].trim();
|
||||||
|
var movesRaw = movesRawText.split("\n");
|
||||||
|
movesRaw = movesRaw.filter(val => {
|
||||||
|
return val.length != 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
var parsedMoves = [];
|
||||||
|
|
||||||
|
for (const rawMove of movesRaw) {
|
||||||
|
const cr = rawMove.split('move')[1].split("from");
|
||||||
|
const count: number = +cr[0].trim();
|
||||||
|
const mr = cr[1].split("to");
|
||||||
|
const start: number = +mr[0].trim();
|
||||||
|
const end: number = +mr[1].trim();
|
||||||
|
parsedMoves.push([count, start - 1, end - 1])
|
||||||
|
}
|
||||||
|
console.table(rotRows);
|
||||||
|
|
||||||
|
for (const move of parsedMoves) {
|
||||||
|
var tmp = [];
|
||||||
|
for (var i = 0; i < move[0]; i++) {
|
||||||
|
tmp.push(rotRows[move[1]].pop());
|
||||||
|
}
|
||||||
|
tmp = tmp.reverse();
|
||||||
|
rotRows[move[2]] = rotRows[move[2]].concat(tmp);
|
||||||
|
}
|
||||||
|
console.table(rotRows);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
7
day5/tsconfig.json
Normal file
7
day5/tsconfig.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"types": [
|
||||||
|
"node"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user