re-doing 2016 in python, because I can. days 1-3

This commit is contained in:
Stefan Harmuth 2024-12-23 18:25:24 +01:00
parent e9ee54b0d9
commit 0156ff8c8d
82 changed files with 7708 additions and 5604 deletions

169
.gitignore vendored Normal file
View File

@ -0,0 +1,169 @@
# ---> Python
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
venv_pypy/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/
answer_cache.json
.session
session.cookie
.aoc_tiles/*
!.aoc_tiles/tiles/

View File

@ -1,231 +1,231 @@
bot 147 gives low to bot 67 and high to bot 71 bot 147 gives low to bot 67 and high to bot 71
bot 142 gives low to bot 128 and high to bot 164 bot 142 gives low to bot 128 and high to bot 164
bot 47 gives low to bot 4 and high to bot 209 bot 47 gives low to bot 4 and high to bot 209
bot 107 gives low to bot 194 and high to bot 103 bot 107 gives low to bot 194 and high to bot 103
bot 102 gives low to bot 82 and high to bot 3 bot 102 gives low to bot 82 and high to bot 3
bot 101 gives low to bot 46 and high to bot 111 bot 101 gives low to bot 46 and high to bot 111
value 23 goes to bot 76 value 23 goes to bot 76
bot 16 gives low to bot 203 and high to bot 32 bot 16 gives low to bot 203 and high to bot 32
bot 30 gives low to output 20 and high to bot 31 bot 30 gives low to output 20 and high to bot 31
bot 170 gives low to bot 123 and high to bot 108 bot 170 gives low to bot 123 and high to bot 108
value 3 goes to bot 122 value 3 goes to bot 122
bot 176 gives low to bot 89 and high to bot 199 bot 176 gives low to bot 89 and high to bot 199
value 43 goes to bot 117 value 43 goes to bot 117
bot 190 gives low to bot 120 and high to bot 198 bot 190 gives low to bot 120 and high to bot 198
bot 72 gives low to bot 14 and high to bot 37 bot 72 gives low to bot 14 and high to bot 37
bot 122 gives low to bot 26 and high to bot 101 bot 122 gives low to bot 26 and high to bot 101
bot 62 gives low to bot 88 and high to bot 85 bot 62 gives low to bot 88 and high to bot 85
bot 184 gives low to bot 103 and high to bot 113 bot 184 gives low to bot 103 and high to bot 113
bot 146 gives low to bot 47 and high to bot 7 bot 146 gives low to bot 47 and high to bot 7
bot 133 gives low to bot 32 and high to bot 92 bot 133 gives low to bot 32 and high to bot 92
bot 188 gives low to bot 79 and high to bot 97 bot 188 gives low to bot 79 and high to bot 97
value 2 goes to bot 26 value 2 goes to bot 26
bot 68 gives low to output 18 and high to output 5 bot 68 gives low to output 18 and high to output 5
bot 139 gives low to bot 147 and high to bot 195 bot 139 gives low to bot 147 and high to bot 195
bot 36 gives low to bot 166 and high to bot 116 bot 36 gives low to bot 166 and high to bot 116
bot 99 gives low to bot 36 and high to bot 28 bot 99 gives low to bot 36 and high to bot 28
bot 55 gives low to bot 134 and high to bot 182 bot 55 gives low to bot 134 and high to bot 182
bot 132 gives low to bot 20 and high to bot 201 bot 132 gives low to bot 20 and high to bot 201
bot 81 gives low to bot 126 and high to bot 153 bot 81 gives low to bot 126 and high to bot 153
bot 177 gives low to output 16 and high to bot 12 bot 177 gives low to output 16 and high to bot 12
bot 23 gives low to bot 90 and high to bot 42 bot 23 gives low to bot 90 and high to bot 42
bot 191 gives low to bot 157 and high to bot 73 bot 191 gives low to bot 157 and high to bot 73
bot 3 gives low to bot 25 and high to bot 186 bot 3 gives low to bot 25 and high to bot 186
bot 126 gives low to bot 83 and high to bot 24 bot 126 gives low to bot 83 and high to bot 24
bot 105 gives low to bot 176 and high to bot 60 bot 105 gives low to bot 176 and high to bot 60
bot 204 gives low to bot 102 and high to bot 118 bot 204 gives low to bot 102 and high to bot 118
bot 199 gives low to bot 141 and high to bot 83 bot 199 gives low to bot 141 and high to bot 83
bot 194 gives low to bot 63 and high to bot 197 bot 194 gives low to bot 63 and high to bot 197
bot 161 gives low to bot 170 and high to bot 173 bot 161 gives low to bot 170 and high to bot 173
bot 152 gives low to bot 92 and high to bot 4 bot 152 gives low to bot 92 and high to bot 4
bot 53 gives low to bot 52 and high to bot 205 bot 53 gives low to bot 52 and high to bot 205
bot 171 gives low to bot 137 and high to bot 91 bot 171 gives low to bot 137 and high to bot 91
bot 71 gives low to bot 161 and high to bot 58 bot 71 gives low to bot 161 and high to bot 58
bot 128 gives low to bot 192 and high to bot 164 bot 128 gives low to bot 192 and high to bot 164
bot 118 gives low to bot 3 and high to bot 57 bot 118 gives low to bot 3 and high to bot 57
bot 124 gives low to bot 86 and high to bot 87 bot 124 gives low to bot 86 and high to bot 87
bot 93 gives low to bot 85 and high to bot 96 bot 93 gives low to bot 85 and high to bot 96
bot 198 gives low to bot 172 and high to bot 44 bot 198 gives low to bot 172 and high to bot 44
bot 100 gives low to bot 124 and high to bot 78 bot 100 gives low to bot 124 and high to bot 78
bot 145 gives low to bot 91 and high to bot 168 bot 145 gives low to bot 91 and high to bot 168
value 47 goes to bot 120 value 47 goes to bot 120
bot 165 gives low to bot 57 and high to bot 158 bot 165 gives low to bot 57 and high to bot 158
bot 138 gives low to bot 64 and high to bot 54 bot 138 gives low to bot 64 and high to bot 54
value 5 goes to bot 150 value 5 goes to bot 150
bot 29 gives low to bot 23 and high to bot 42 bot 29 gives low to bot 23 and high to bot 42
bot 110 gives low to output 14 and high to bot 68 bot 110 gives low to output 14 and high to bot 68
bot 73 gives low to bot 156 and high to bot 29 bot 73 gives low to bot 156 and high to bot 29
bot 49 gives low to bot 0 and high to bot 202 bot 49 gives low to bot 0 and high to bot 202
bot 32 gives low to bot 10 and high to bot 51 bot 32 gives low to bot 10 and high to bot 51
value 11 goes to bot 36 value 11 goes to bot 36
bot 131 gives low to bot 98 and high to bot 151 bot 131 gives low to bot 98 and high to bot 151
value 31 goes to bot 105 value 31 goes to bot 105
bot 135 gives low to output 4 and high to bot 30 bot 135 gives low to output 4 and high to bot 30
bot 185 gives low to bot 171 and high to bot 145 bot 185 gives low to bot 171 and high to bot 145
bot 67 gives low to bot 179 and high to bot 161 bot 67 gives low to bot 179 and high to bot 161
bot 187 gives low to bot 37 and high to bot 125 bot 187 gives low to bot 37 and high to bot 125
value 59 goes to bot 190 value 59 goes to bot 190
bot 1 gives low to bot 155 and high to bot 128 bot 1 gives low to bot 155 and high to bot 128
bot 10 gives low to bot 181 and high to bot 27 bot 10 gives low to bot 181 and high to bot 27
bot 13 gives low to bot 188 and high to bot 22 bot 13 gives low to bot 188 and high to bot 22
bot 182 gives low to bot 95 and high to bot 15 bot 182 gives low to bot 95 and high to bot 15
bot 31 gives low to output 11 and high to bot 0 bot 31 gives low to output 11 and high to bot 0
bot 116 gives low to bot 193 and high to bot 147 bot 116 gives low to bot 193 and high to bot 147
bot 17 gives low to bot 9 and high to bot 90 bot 17 gives low to bot 9 and high to bot 90
bot 205 gives low to bot 130 and high to bot 204 bot 205 gives low to bot 130 and high to bot 204
bot 169 gives low to bot 101 and high to bot 179 bot 169 gives low to bot 101 and high to bot 179
bot 206 gives low to bot 159 and high to bot 2 bot 206 gives low to bot 159 and high to bot 2
bot 42 gives low to bot 18 and high to bot 55 bot 42 gives low to bot 18 and high to bot 55
value 17 goes to bot 63 value 17 goes to bot 63
bot 19 gives low to bot 109 and high to bot 132 bot 19 gives low to bot 109 and high to bot 132
bot 172 gives low to bot 184 and high to bot 44 bot 172 gives low to bot 184 and high to bot 44
bot 125 gives low to bot 200 and high to bot 11 bot 125 gives low to bot 200 and high to bot 11
bot 119 gives low to bot 177 and high to bot 180 bot 119 gives low to bot 177 and high to bot 180
bot 26 gives low to bot 105 and high to bot 46 bot 26 gives low to bot 105 and high to bot 46
bot 2 gives low to bot 112 and high to bot 146 bot 2 gives low to bot 112 and high to bot 146
bot 61 gives low to bot 77 and high to bot 16 bot 61 gives low to bot 77 and high to bot 16
bot 123 gives low to bot 153 and high to bot 206 bot 123 gives low to bot 153 and high to bot 206
bot 40 gives low to output 8 and high to bot 181 bot 40 gives low to output 8 and high to bot 181
bot 103 gives low to bot 197 and high to bot 191 bot 103 gives low to bot 197 and high to bot 191
bot 34 gives low to bot 19 and high to bot 48 bot 34 gives low to bot 19 and high to bot 48
bot 25 gives low to bot 31 and high to bot 49 bot 25 gives low to bot 31 and high to bot 49
value 67 goes to bot 194 value 67 goes to bot 194
value 13 goes to bot 59 value 13 goes to bot 59
bot 8 gives low to bot 167 and high to bot 1 bot 8 gives low to bot 167 and high to bot 1
bot 56 gives low to bot 16 and high to bot 133 bot 56 gives low to bot 16 and high to bot 133
bot 14 gives low to output 15 and high to bot 43 bot 14 gives low to output 15 and high to bot 43
bot 70 gives low to bot 125 and high to bot 64 bot 70 gives low to bot 125 and high to bot 64
bot 164 gives low to bot 94 and high to bot 165 bot 164 gives low to bot 94 and high to bot 165
bot 150 gives low to bot 122 and high to bot 169 bot 150 gives low to bot 122 and high to bot 169
bot 95 gives low to bot 145 and high to bot 15 bot 95 gives low to bot 145 and high to bot 15
bot 90 gives low to bot 34 and high to bot 18 bot 90 gives low to bot 34 and high to bot 18
bot 148 gives low to bot 54 and high to bot 8 bot 148 gives low to bot 54 and high to bot 8
bot 113 gives low to bot 191 and high to bot 50 bot 113 gives low to bot 191 and high to bot 50
value 53 goes to bot 119 value 53 goes to bot 119
bot 77 gives low to bot 104 and high to bot 203 bot 77 gives low to bot 104 and high to bot 203
bot 82 gives low to bot 30 and high to bot 25 bot 82 gives low to bot 30 and high to bot 25
bot 179 gives low to bot 111 and high to bot 170 bot 179 gives low to bot 111 and high to bot 170
bot 141 gives low to bot 180 and high to bot 61 bot 141 gives low to bot 180 and high to bot 61
bot 173 gives low to bot 108 and high to bot 183 bot 173 gives low to bot 108 and high to bot 183
bot 109 gives low to bot 58 and high to bot 20 bot 109 gives low to bot 58 and high to bot 20
bot 94 gives low to bot 118 and high to bot 165 bot 94 gives low to bot 118 and high to bot 165
bot 0 gives low to output 7 and high to bot 21 bot 0 gives low to output 7 and high to bot 21
bot 104 gives low to output 3 and high to bot 40 bot 104 gives low to output 3 and high to bot 40
value 61 goes to bot 166 value 61 goes to bot 166
bot 163 gives low to bot 151 and high to bot 52 bot 163 gives low to bot 151 and high to bot 52
bot 193 gives low to bot 169 and high to bot 67 bot 193 gives low to bot 169 and high to bot 67
bot 60 gives low to bot 199 and high to bot 126 bot 60 gives low to bot 199 and high to bot 126
bot 195 gives low to bot 71 and high to bot 109 bot 195 gives low to bot 71 and high to bot 109
bot 80 gives low to bot 100 and high to bot 78 bot 80 gives low to bot 100 and high to bot 78
bot 137 gives low to bot 45 and high to bot 208 bot 137 gives low to bot 45 and high to bot 208
bot 155 gives low to bot 205 and high to bot 192 bot 155 gives low to bot 205 and high to bot 192
bot 50 gives low to bot 73 and high to bot 29 bot 50 gives low to bot 73 and high to bot 29
bot 83 gives low to bot 61 and high to bot 56 bot 83 gives low to bot 61 and high to bot 56
bot 88 gives low to bot 72 and high to bot 187 bot 88 gives low to bot 72 and high to bot 187
bot 151 gives low to bot 160 and high to bot 41 bot 151 gives low to bot 160 and high to bot 41
bot 52 gives low to bot 41 and high to bot 130 bot 52 gives low to bot 41 and high to bot 130
bot 27 gives low to bot 5 and high to bot 72 bot 27 gives low to bot 5 and high to bot 72
bot 78 gives low to bot 87 and high to bot 106 bot 78 gives low to bot 87 and high to bot 106
bot 98 gives low to output 17 and high to bot 160 bot 98 gives low to output 17 and high to bot 160
bot 201 gives low to bot 185 and high to bot 95 bot 201 gives low to bot 185 and high to bot 95
bot 111 gives low to bot 81 and high to bot 123 bot 111 gives low to bot 81 and high to bot 123
bot 189 gives low to bot 162 and high to bot 124 bot 189 gives low to bot 162 and high to bot 124
bot 51 gives low to bot 27 and high to bot 88 bot 51 gives low to bot 27 and high to bot 88
bot 197 gives low to bot 13 and high to bot 157 bot 197 gives low to bot 13 and high to bot 157
bot 160 gives low to output 6 and high to bot 74 bot 160 gives low to output 6 and high to bot 74
value 19 goes to bot 176 value 19 goes to bot 176
bot 134 gives low to bot 201 and high to bot 182 bot 134 gives low to bot 201 and high to bot 182
bot 200 gives low to bot 6 and high to bot 131 bot 200 gives low to bot 6 and high to bot 131
bot 24 gives low to bot 56 and high to bot 207 bot 24 gives low to bot 56 and high to bot 207
value 29 goes to bot 99 value 29 goes to bot 99
value 71 goes to bot 89 value 71 goes to bot 89
bot 159 gives low to bot 207 and high to bot 112 bot 159 gives low to bot 207 and high to bot 112
bot 35 gives low to bot 7 and high to bot 175 bot 35 gives low to bot 7 and high to bot 175
bot 143 gives low to bot 195 and high to bot 19 bot 143 gives low to bot 195 and high to bot 19
bot 91 gives low to bot 208 and high to bot 66 bot 91 gives low to bot 208 and high to bot 66
bot 92 gives low to bot 51 and high to bot 62 bot 92 gives low to bot 51 and high to bot 62
bot 183 gives low to bot 121 and high to bot 137 bot 183 gives low to bot 121 and high to bot 137
bot 39 gives low to bot 189 and high to bot 100 bot 39 gives low to bot 189 and high to bot 100
bot 66 gives low to bot 84 and high to bot 140 bot 66 gives low to bot 84 and high to bot 140
bot 112 gives low to bot 152 and high to bot 47 bot 112 gives low to bot 152 and high to bot 47
bot 181 gives low to output 12 and high to bot 5 bot 181 gives low to output 12 and high to bot 5
bot 208 gives low to bot 35 and high to bot 84 bot 208 gives low to bot 35 and high to bot 84
value 41 goes to bot 190 value 41 goes to bot 190
bot 57 gives low to bot 186 and high to bot 158 bot 57 gives low to bot 186 and high to bot 158
bot 41 gives low to bot 74 and high to bot 65 bot 41 gives low to bot 74 and high to bot 65
bot 96 gives low to bot 70 and high to bot 138 bot 96 gives low to bot 70 and high to bot 138
bot 74 gives low to output 2 and high to bot 135 bot 74 gives low to output 2 and high to bot 135
bot 4 gives low to bot 62 and high to bot 93 bot 4 gives low to bot 62 and high to bot 93
bot 156 gives low to bot 17 and high to bot 23 bot 156 gives low to bot 17 and high to bot 23
bot 6 gives low to output 9 and high to bot 98 bot 6 gives low to output 9 and high to bot 98
bot 65 gives low to bot 135 and high to bot 82 bot 65 gives low to bot 135 and high to bot 82
bot 64 gives low to bot 11 and high to bot 149 bot 64 gives low to bot 11 and high to bot 149
bot 45 gives low to bot 146 and high to bot 35 bot 45 gives low to bot 146 and high to bot 35
bot 28 gives low to bot 116 and high to bot 139 bot 28 gives low to bot 116 and high to bot 139
bot 149 gives low to bot 163 and high to bot 53 bot 149 gives low to bot 163 and high to bot 53
bot 136 gives low to bot 96 and high to bot 127 bot 136 gives low to bot 96 and high to bot 127
bot 48 gives low to bot 132 and high to bot 134 bot 48 gives low to bot 132 and high to bot 134
bot 192 gives low to bot 204 and high to bot 94 bot 192 gives low to bot 204 and high to bot 94
bot 166 gives low to bot 150 and high to bot 193 bot 166 gives low to bot 150 and high to bot 193
bot 174 gives low to bot 129 and high to bot 69 bot 174 gives low to bot 129 and high to bot 69
bot 18 gives low to bot 48 and high to bot 55 bot 18 gives low to bot 48 and high to bot 55
bot 76 gives low to bot 115 and high to bot 172 bot 76 gives low to bot 115 and high to bot 172
bot 108 gives low to bot 206 and high to bot 121 bot 108 gives low to bot 206 and high to bot 121
bot 79 gives low to bot 28 and high to bot 38 bot 79 gives low to bot 28 and high to bot 38
bot 97 gives low to bot 38 and high to bot 9 bot 97 gives low to bot 38 and high to bot 9
bot 15 gives low to bot 168 and high to bot 114 bot 15 gives low to bot 168 and high to bot 114
bot 37 gives low to bot 43 and high to bot 200 bot 37 gives low to bot 43 and high to bot 200
bot 175 gives low to bot 75 and high to bot 189 bot 175 gives low to bot 75 and high to bot 189
bot 84 gives low to bot 175 and high to bot 39 bot 84 gives low to bot 175 and high to bot 39
bot 162 gives low to bot 127 and high to bot 86 bot 162 gives low to bot 127 and high to bot 86
bot 167 gives low to bot 53 and high to bot 155 bot 167 gives low to bot 53 and high to bot 155
bot 168 gives low to bot 66 and high to bot 114 bot 168 gives low to bot 66 and high to bot 114
bot 129 gives low to bot 144 and high to bot 69 bot 129 gives low to bot 144 and high to bot 69
bot 89 gives low to bot 119 and high to bot 141 bot 89 gives low to bot 119 and high to bot 141
bot 69 gives low to bot 110 and high to bot 68 bot 69 gives low to bot 110 and high to bot 68
bot 130 gives low to bot 65 and high to bot 102 bot 130 gives low to bot 65 and high to bot 102
bot 5 gives low to output 19 and high to bot 14 bot 5 gives low to output 19 and high to bot 14
bot 54 gives low to bot 149 and high to bot 167 bot 54 gives low to bot 149 and high to bot 167
bot 127 gives low to bot 138 and high to bot 148 bot 127 gives low to bot 138 and high to bot 148
bot 153 gives low to bot 24 and high to bot 159 bot 153 gives low to bot 24 and high to bot 159
bot 117 gives low to bot 59 and high to bot 188 bot 117 gives low to bot 59 and high to bot 188
bot 144 gives low to output 1 and high to bot 110 bot 144 gives low to output 1 and high to bot 110
bot 63 gives low to bot 117 and high to bot 13 bot 63 gives low to bot 117 and high to bot 13
bot 44 gives low to bot 113 and high to bot 50 bot 44 gives low to bot 113 and high to bot 50
bot 114 gives low to bot 140 and high to bot 80 bot 114 gives low to bot 140 and high to bot 80
bot 115 gives low to bot 107 and high to bot 184 bot 115 gives low to bot 107 and high to bot 184
bot 207 gives low to bot 133 and high to bot 152 bot 207 gives low to bot 133 and high to bot 152
bot 33 gives low to bot 8 and high to bot 196 bot 33 gives low to bot 8 and high to bot 196
bot 59 gives low to bot 99 and high to bot 79 bot 59 gives low to bot 99 and high to bot 79
bot 140 gives low to bot 39 and high to bot 80 bot 140 gives low to bot 39 and high to bot 80
bot 202 gives low to bot 21 and high to bot 129 bot 202 gives low to bot 21 and high to bot 129
value 7 goes to bot 107 value 7 goes to bot 107
bot 11 gives low to bot 131 and high to bot 163 bot 11 gives low to bot 131 and high to bot 163
bot 21 gives low to output 0 and high to bot 144 bot 21 gives low to output 0 and high to bot 144
bot 106 gives low to bot 196 and high to bot 142 bot 106 gives low to bot 196 and high to bot 142
bot 121 gives low to bot 2 and high to bot 45 bot 121 gives low to bot 2 and high to bot 45
bot 154 gives low to bot 183 and high to bot 171 bot 154 gives low to bot 183 and high to bot 171
bot 157 gives low to bot 22 and high to bot 156 bot 157 gives low to bot 22 and high to bot 156
bot 203 gives low to bot 40 and high to bot 10 bot 203 gives low to bot 40 and high to bot 10
bot 12 gives low to output 10 and high to bot 104 bot 12 gives low to output 10 and high to bot 104
bot 186 gives low to bot 49 and high to bot 178 bot 186 gives low to bot 49 and high to bot 178
bot 43 gives low to output 13 and high to bot 6 bot 43 gives low to output 13 and high to bot 6
bot 196 gives low to bot 1 and high to bot 142 bot 196 gives low to bot 1 and high to bot 142
bot 22 gives low to bot 97 and high to bot 17 bot 22 gives low to bot 97 and high to bot 17
bot 38 gives low to bot 139 and high to bot 143 bot 38 gives low to bot 139 and high to bot 143
bot 209 gives low to bot 93 and high to bot 136 bot 209 gives low to bot 93 and high to bot 136
bot 9 gives low to bot 143 and high to bot 34 bot 9 gives low to bot 143 and high to bot 34
bot 180 gives low to bot 12 and high to bot 77 bot 180 gives low to bot 12 and high to bot 77
bot 7 gives low to bot 209 and high to bot 75 bot 7 gives low to bot 209 and high to bot 75
value 37 goes to bot 115 value 37 goes to bot 115
bot 120 gives low to bot 76 and high to bot 198 bot 120 gives low to bot 76 and high to bot 198
bot 75 gives low to bot 136 and high to bot 162 bot 75 gives low to bot 136 and high to bot 162
bot 20 gives low to bot 154 and high to bot 185 bot 20 gives low to bot 154 and high to bot 185
bot 178 gives low to bot 202 and high to bot 174 bot 178 gives low to bot 202 and high to bot 174
bot 86 gives low to bot 148 and high to bot 33 bot 86 gives low to bot 148 and high to bot 33
value 73 goes to bot 177 value 73 goes to bot 177
bot 85 gives low to bot 187 and high to bot 70 bot 85 gives low to bot 187 and high to bot 70
bot 158 gives low to bot 178 and high to bot 174 bot 158 gives low to bot 178 and high to bot 174
bot 46 gives low to bot 60 and high to bot 81 bot 46 gives low to bot 60 and high to bot 81
bot 87 gives low to bot 33 and high to bot 106 bot 87 gives low to bot 33 and high to bot 106
bot 58 gives low to bot 173 and high to bot 154 bot 58 gives low to bot 173 and high to bot 154

View File

@ -1,6 +1,6 @@
value 5 goes to bot 2 value 5 goes to bot 2
bot 2 gives low to bot 1 and high to bot 0 bot 2 gives low to bot 1 and high to bot 0
value 3 goes to bot 1 value 3 goes to bot 1
bot 1 gives low to output 1 and high to bot 0 bot 1 gives low to output 1 and high to bot 0
bot 0 gives low to output 2 and high to output 0 bot 0 gives low to output 2 and high to output 0
value 2 goes to bot 2 value 2 goes to bot 2

View File

@ -1,23 +1,23 @@
cpy 1 a cpy 1 a
cpy 1 b cpy 1 b
cpy 26 d cpy 26 d
jnz c 2 jnz c 2
jnz 1 5 jnz 1 5
cpy 7 c cpy 7 c
inc d inc d
dec c dec c
jnz c -2 jnz c -2
cpy a c cpy a c
inc a inc a
dec b dec b
jnz b -2 jnz b -2
cpy c b cpy c b
dec d dec d
jnz d -6 jnz d -6
cpy 16 c cpy 16 c
cpy 17 d cpy 17 d
inc a inc a
dec d dec d
jnz d -2 jnz d -2
dec c dec c
jnz c -5 jnz c -5

View File

@ -1,6 +1,6 @@
cpy 41 a cpy 41 a
inc a inc a
inc a inc a
dec a dec a
jnz a 2 jnz a 2
dec a dec a

View File

@ -1,2 +1,2 @@
1350 1350
31,39 31,39

View File

@ -1,2 +1,2 @@
10 10
7,4 7,4

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
aaaaa-bbb-z-y-x-123[abxyz] aaaaa-bbb-z-y-x-123[abxyz]
a-b-c-d-e-f-g-h-987[abcde] a-b-c-d-e-f-g-h-987[abcde]
not-a-real-room-404[oarel] not-a-real-room-404[oarel]
totally-real-room-200[decoy] totally-real-room-200[decoy]

File diff suppressed because it is too large Load Diff

View File

@ -1,16 +1,16 @@
eedadn eedadn
drvtee drvtee
eandsr eandsr
raavrd raavrd
atevrs atevrs
tsrnev tsrnev
sdttsa sdttsa
rasrtv rasrtv
nssdts nssdts
ntnada ntnada
svetve svetve
tesnvt tesnvt
vntsnd vntsnd
vrdear vrdear
dvrsen dvrsen
enarar enarar

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
abba[mnop1]qrst1[mnop2]qrst2 abba[mnop1]qrst1[mnop2]qrst2
abcd[bddb]xyyx abcd[bddb]xyyx
aaaa[qwer]tyui aaaa[qwer]tyui
ioxxoj[asdfgh]zxcvbn ioxxoj[asdfgh]zxcvbn
aba[bab]xyz aba[bab]xyz
xyx[xyx]xyx xyx[xyx]xyx
aaa[kek]eke aaa[kek]eke
zazbz[bzb]cdb zazbz[bzb]cdb

View File

@ -1,154 +1,154 @@
50,6 50,6
rect 1x1 rect 1x1
rotate row y=0 by 2 rotate row y=0 by 2
rect 1x1 rect 1x1
rotate row y=0 by 5 rotate row y=0 by 5
rect 1x1 rect 1x1
rotate row y=0 by 3 rotate row y=0 by 3
rect 1x1 rect 1x1
rotate row y=0 by 3 rotate row y=0 by 3
rect 2x1 rect 2x1
rotate row y=0 by 5 rotate row y=0 by 5
rect 1x1 rect 1x1
rotate row y=0 by 5 rotate row y=0 by 5
rect 4x1 rect 4x1
rotate row y=0 by 2 rotate row y=0 by 2
rect 1x1 rect 1x1
rotate row y=0 by 2 rotate row y=0 by 2
rect 1x1 rect 1x1
rotate row y=0 by 5 rotate row y=0 by 5
rect 4x1 rect 4x1
rotate row y=0 by 3 rotate row y=0 by 3
rect 2x1 rect 2x1
rotate row y=0 by 5 rotate row y=0 by 5
rect 4x1 rect 4x1
rotate row y=0 by 2 rotate row y=0 by 2
rect 1x2 rect 1x2
rotate row y=1 by 6 rotate row y=1 by 6
rotate row y=0 by 2 rotate row y=0 by 2
rect 1x2 rect 1x2
rotate column x=32 by 1 rotate column x=32 by 1
rotate column x=23 by 1 rotate column x=23 by 1
rotate column x=13 by 1 rotate column x=13 by 1
rotate row y=0 by 6 rotate row y=0 by 6
rotate column x=0 by 1 rotate column x=0 by 1
rect 5x1 rect 5x1
rotate row y=0 by 2 rotate row y=0 by 2
rotate column x=30 by 1 rotate column x=30 by 1
rotate row y=1 by 20 rotate row y=1 by 20
rotate row y=0 by 18 rotate row y=0 by 18
rotate column x=13 by 1 rotate column x=13 by 1
rotate column x=10 by 1 rotate column x=10 by 1
rotate column x=7 by 1 rotate column x=7 by 1
rotate column x=2 by 1 rotate column x=2 by 1
rotate column x=0 by 1 rotate column x=0 by 1
rect 17x1 rect 17x1
rotate column x=16 by 3 rotate column x=16 by 3
rotate row y=3 by 7 rotate row y=3 by 7
rotate row y=0 by 5 rotate row y=0 by 5
rotate column x=2 by 1 rotate column x=2 by 1
rotate column x=0 by 1 rotate column x=0 by 1
rect 4x1 rect 4x1
rotate column x=28 by 1 rotate column x=28 by 1
rotate row y=1 by 24 rotate row y=1 by 24
rotate row y=0 by 21 rotate row y=0 by 21
rotate column x=19 by 1 rotate column x=19 by 1
rotate column x=17 by 1 rotate column x=17 by 1
rotate column x=16 by 1 rotate column x=16 by 1
rotate column x=14 by 1 rotate column x=14 by 1
rotate column x=12 by 2 rotate column x=12 by 2
rotate column x=11 by 1 rotate column x=11 by 1
rotate column x=9 by 1 rotate column x=9 by 1
rotate column x=8 by 1 rotate column x=8 by 1
rotate column x=7 by 1 rotate column x=7 by 1
rotate column x=6 by 1 rotate column x=6 by 1
rotate column x=4 by 1 rotate column x=4 by 1
rotate column x=2 by 1 rotate column x=2 by 1
rotate column x=0 by 1 rotate column x=0 by 1
rect 20x1 rect 20x1
rotate column x=47 by 1 rotate column x=47 by 1
rotate column x=40 by 2 rotate column x=40 by 2
rotate column x=35 by 2 rotate column x=35 by 2
rotate column x=30 by 2 rotate column x=30 by 2
rotate column x=10 by 3 rotate column x=10 by 3
rotate column x=5 by 3 rotate column x=5 by 3
rotate row y=4 by 20 rotate row y=4 by 20
rotate row y=3 by 10 rotate row y=3 by 10
rotate row y=2 by 20 rotate row y=2 by 20
rotate row y=1 by 16 rotate row y=1 by 16
rotate row y=0 by 9 rotate row y=0 by 9
rotate column x=7 by 2 rotate column x=7 by 2
rotate column x=5 by 2 rotate column x=5 by 2
rotate column x=3 by 2 rotate column x=3 by 2
rotate column x=0 by 2 rotate column x=0 by 2
rect 9x2 rect 9x2
rotate column x=22 by 2 rotate column x=22 by 2
rotate row y=3 by 40 rotate row y=3 by 40
rotate row y=1 by 20 rotate row y=1 by 20
rotate row y=0 by 20 rotate row y=0 by 20
rotate column x=18 by 1 rotate column x=18 by 1
rotate column x=17 by 2 rotate column x=17 by 2
rotate column x=16 by 1 rotate column x=16 by 1
rotate column x=15 by 2 rotate column x=15 by 2
rotate column x=13 by 1 rotate column x=13 by 1
rotate column x=12 by 1 rotate column x=12 by 1
rotate column x=11 by 1 rotate column x=11 by 1
rotate column x=10 by 1 rotate column x=10 by 1
rotate column x=8 by 3 rotate column x=8 by 3
rotate column x=7 by 1 rotate column x=7 by 1
rotate column x=6 by 1 rotate column x=6 by 1
rotate column x=5 by 1 rotate column x=5 by 1
rotate column x=3 by 1 rotate column x=3 by 1
rotate column x=2 by 1 rotate column x=2 by 1
rotate column x=1 by 1 rotate column x=1 by 1
rotate column x=0 by 1 rotate column x=0 by 1
rect 19x1 rect 19x1
rotate column x=44 by 2 rotate column x=44 by 2
rotate column x=40 by 3 rotate column x=40 by 3
rotate column x=29 by 1 rotate column x=29 by 1
rotate column x=27 by 2 rotate column x=27 by 2
rotate column x=25 by 5 rotate column x=25 by 5
rotate column x=24 by 2 rotate column x=24 by 2
rotate column x=22 by 2 rotate column x=22 by 2
rotate column x=20 by 5 rotate column x=20 by 5
rotate column x=14 by 3 rotate column x=14 by 3
rotate column x=12 by 2 rotate column x=12 by 2
rotate column x=10 by 4 rotate column x=10 by 4
rotate column x=9 by 3 rotate column x=9 by 3
rotate column x=7 by 3 rotate column x=7 by 3
rotate column x=3 by 5 rotate column x=3 by 5
rotate column x=2 by 2 rotate column x=2 by 2
rotate row y=5 by 10 rotate row y=5 by 10
rotate row y=4 by 8 rotate row y=4 by 8
rotate row y=3 by 8 rotate row y=3 by 8
rotate row y=2 by 48 rotate row y=2 by 48
rotate row y=1 by 47 rotate row y=1 by 47
rotate row y=0 by 40 rotate row y=0 by 40
rotate column x=47 by 5 rotate column x=47 by 5
rotate column x=46 by 5 rotate column x=46 by 5
rotate column x=45 by 4 rotate column x=45 by 4
rotate column x=43 by 2 rotate column x=43 by 2
rotate column x=42 by 3 rotate column x=42 by 3
rotate column x=41 by 2 rotate column x=41 by 2
rotate column x=38 by 5 rotate column x=38 by 5
rotate column x=37 by 5 rotate column x=37 by 5
rotate column x=36 by 5 rotate column x=36 by 5
rotate column x=33 by 1 rotate column x=33 by 1
rotate column x=28 by 1 rotate column x=28 by 1
rotate column x=27 by 5 rotate column x=27 by 5
rotate column x=26 by 5 rotate column x=26 by 5
rotate column x=25 by 1 rotate column x=25 by 1
rotate column x=23 by 5 rotate column x=23 by 5
rotate column x=22 by 1 rotate column x=22 by 1
rotate column x=21 by 2 rotate column x=21 by 2
rotate column x=18 by 1 rotate column x=18 by 1
rotate column x=17 by 3 rotate column x=17 by 3
rotate column x=12 by 2 rotate column x=12 by 2
rotate column x=11 by 2 rotate column x=11 by 2
rotate column x=7 by 5 rotate column x=7 by 5
rotate column x=6 by 5 rotate column x=6 by 5
rotate column x=5 by 4 rotate column x=5 by 4
rotate column x=3 by 5 rotate column x=3 by 5
rotate column x=2 by 5 rotate column x=2 by 5
rotate column x=1 by 3 rotate column x=1 by 3
rotate column x=0 by 4 rotate column x=0 by 4

View File

@ -1,5 +1,5 @@
7,3 7,3
rect 3x2 rect 3x2
rotate column x=1 by 1 rotate column x=1 by 1
rotate row y=0 by 4 rotate row y=0 by 4
rotate column x=1 by 1 rotate column x=1 by 1

View File

@ -1,8 +1,8 @@
ADVENT ADVENT
A(1x5)BC A(1x5)BC
(3x3)XYZ (3x3)XYZ
A(2x2)BCD(2x2)EFG A(2x2)BCD(2x2)EFG
(6x1)(1x3)A (6x1)(1x3)A
X(8x2)(3x3)ABCY X(8x2)(3x3)ABCY
(27x12)(20x12)(13x14)(7x10)(1x12)A (27x12)(20x12)(13x14)(7x10)(1x12)A
(25x3)(3x3)ABC(2x3)XY(5x2)PQRSTX(18x9)(3x2)TWO(5x7)SEVEN (25x3)(3x3)ABC(2x3)XY(5x2)PQRSTX(18x9)(3x2)TWO(5x7)SEVEN

4
archive/inputs/input11 Normal file
View File

@ -0,0 +1,4 @@
The first floor contains a strontium generator, a strontium-compatible microchip, a plutonium generator, and a plutonium-compatible microchip.
The second floor contains a thulium generator, a ruthenium generator, a ruthenium-compatible microchip, a curium generator, and a curium-compatible microchip.
The third floor contains a thulium-compatible microchip.
The fourth floor contains nothing relevant.

View File

@ -0,0 +1,4 @@
The first floor contains a hydrogen-compatible microchip and a lithium-compatible microchip.
The second floor contains a hydrogen generator.
The third floor contains a lithium generator.
The fourth floor contains nothing relevant.

64
day01.py Normal file
View File

@ -0,0 +1,64 @@
from tools.aoc import AOCDay
from tools.coordinate import Coordinate, DistanceAlgorithm
from typing import Any
DIRS = [Coordinate(0, -1), Coordinate(1, 0), Coordinate(0, 1), Coordinate(-1, 0)]
class Day(AOCDay):
inputs = [
[
(12, "input1_test"),
(146, "input1"),
],
[
(131, "input1"),
],
]
def parse_input(self) -> list[tuple[int, int]]:
instructions = []
for inst in self.getInput().split(", "):
turn = 1 if inst[0] == "R" else -1
dist = int(inst[1:])
instructions.append((turn, dist))
return instructions
def part1(self) -> Any:
instructions = self.parse_input()
facing = 0
cur_pos = Coordinate(0, 0)
for turn, dist in instructions:
facing = (facing + turn) % 4
cur_pos += DIRS[facing] * dist
return cur_pos.getDistanceTo(
Coordinate(0, 0),
algorithm=DistanceAlgorithm.MANHATTAN,
includeDiagonals=False,
)
def part2(self) -> Any:
instructions = self.parse_input()
facing = 0
cur_pos = Coordinate(0, 0)
seen = set()
for turn, dist in instructions:
facing = (facing + turn) % 4
for _ in range(dist):
cur_pos += DIRS[facing]
if cur_pos in seen:
return cur_pos.getDistanceTo(
Coordinate(0, 0),
algorithm=DistanceAlgorithm.MANHATTAN,
includeDiagonals=False,
)
seen.add(cur_pos)
if __name__ == "__main__":
day = Day(2016, 1)
day.run(verbose=True)

49
day02.py Normal file
View File

@ -0,0 +1,49 @@
from tools.aoc import AOCDay
from tools.coordinate import Coordinate
from tools.grid import Grid
from typing import Any
DIRS = {
"U": Coordinate(0, -1),
"D": Coordinate(0, 1),
"L": Coordinate(-1, 0),
"R": Coordinate(1, 0),
}
class Day(AOCDay):
inputs = [
[
("1985", "input2_test"),
("38961", "input2"),
],
[
("5DB3", "input2_test"),
("46C92", "input2"),
],
]
def get_code(self, keypad: Grid, pos: Coordinate) -> str:
code = ""
for line in self.getInput():
for move in line:
if keypad.get(pos + DIRS[move]):
pos += DIRS[move]
code += keypad.get(pos)
return code
def part1(self) -> Any:
keypad = Grid.from_data(["123", "456", "789"], default=None)
start = Coordinate(1, 1)
return self.get_code(keypad, start)
def part2(self) -> Any:
keypad = Grid.from_data([" 1", " 234", "56789", " ABC", " D"], default=None, translate={" ": None})
start = Coordinate(0, 2)
return self.get_code(keypad, start)
if __name__ == "__main__":
day = Day(2016, 2)
day.run(verbose=True)

43
day03.py Normal file
View File

@ -0,0 +1,43 @@
from tools.aoc import AOCDay
from typing import Any
class Day(AOCDay):
inputs = [
[
(862, "input3"),
],
[
(1577, "input3"),
],
]
def part1(self) -> Any:
ans = 0
for triangle in self.getIntsFromInput():
if (
triangle[0] + triangle[1] <= triangle[2]
or triangle[0] + triangle[2] <= triangle[1]
or triangle[1] + triangle[2] <= triangle[0]
):
continue
ans += 1
return ans
def part2(self) -> Any:
vertical = self.getIntsFromInput()
ans = 0
for x in range(0, len(vertical), 3):
for i in range(3):
if (
vertical[x][i] + vertical[x + 1][i] > vertical[x + 2][i]
and vertical[x][i] + vertical[x + 2][i] > vertical[x + 1][i]
and vertical[x + 1][i] + vertical[x + 2][i] > vertical[x][i]
):
ans += 1
return ans
if __name__ == "__main__":
day = Day(2016, 3)
day.run(verbose=True)

1
inputs/input1 Normal file
View File

@ -0,0 +1 @@
R4, R4, L1, R3, L5, R2, R5, R1, L4, R3, L5, R2, L3, L4, L3, R1, R5, R1, L3, L1, R3, L1, R2, R2, L2, R5, L3, L4, R4, R4, R2, L4, L1, R5, L1, L4, R4, L1, R1, L2, R5, L2, L3, R2, R1, L194, R2, L4, R49, R1, R3, L5, L4, L1, R4, R2, R1, L5, R3, L5, L4, R4, R4, L2, L3, R78, L5, R4, R191, R4, R3, R1, L2, R1, R3, L1, R3, R4, R2, L2, R1, R4, L5, R2, L2, L4, L2, R1, R2, L3, R5, R2, L3, L3, R3, L1, L1, R5, L4, L4, L2, R5, R1, R4, L3, L5, L4, R5, L4, R5, R4, L3, L2, L5, R4, R3, L3, R1, L5, R5, R1, L3, R2, L5, R5, L3, R1, R4, L5, R4, R2, R3, L4, L5, R3, R4, L5, L5, R4, L4, L4, R1, R5, R3, L1, L4, L3, L4, R1, L5, L1, R2, R2, R4, R4, L5, R4, R1, L1, L1, L3, L5, L2, R4, L3, L5, L4, L1, R3

1
inputs/input1_test Normal file
View File

@ -0,0 +1 @@
R5, L5, R5, R3

5
inputs/input2 Normal file
View File

@ -0,0 +1,5 @@
LLLRLLULLDDLDUDRDDURLDDRDLRDDRUULRULLLDLUURUUUDLUUDLRUDLDUDURRLDRRRUULUURLUDRURULRLRLRRUULRUUUDRRDDRLLLDDLLUDDDLLRLLULULRRURRRLDRLDLLRURDULLDULRUURLRUDRURLRRDLLDDURLDDLUDLRLUURDRDRDDUURDDLDDDRUDULDLRDRDDURDLUDDDRUDLUDLULULRUURLRUUUDDRLDULLLUDLULDUUDLDLRRLLLRLDUDRUULDLDRDLRRDLDLULUUDRRUDDDRDLRLDLRDUDRULDRDURRUULLUDURURUUDRDRLRRDRRDRDDDDLLRURULDURDLUDLUULDDLLLDULUUUULDUDRDURLURDLDDLDDUULRLUUDLDRUDRURURRDDLURURDRLRLUUUURLLRR
UUUUURRRURLLRRDRLLDUUUUDDDRLRRDRUULDUURURDRLLRRRDRLLUDURUDLDURURRLUDLLLDRDUDRDRLDRUDUDDUULLUULLDUDUDDRDUUUDLULUDUULLUUULURRUDUULDUDDRDURRLDDURLRDLULDDRUDUDRDULLRLRLLUUDDURLUUDLRUUDDLLRUURDUDLLDRURLDURDLRDUUDLRLLRLRURRUDRRLRDRURRRUULLUDLDURDLDDDUUDRUUUDULLLRDRRDRLURDDRUUUDRRUUDLUDDDRRRRRLRLDLLDDLRDURRURLLLULURULLULRLLDDLDRLDULLDLDDDRLUDDDUDUDRRLRDLLDULULRLRURDLUDDLRUDRLUURRURDURDRRDRULUDURRLULUURDRLDLRUDLUDRURLUDUUULRRLRRRULRRRLRLRLULULDRUUDLRLLRLLLURUUDLUDLRURUDRRLDLLULUDRUDRLLLRLLDLLDUDRRURRLDLUUUURDDDUURLLRRDRUUURRRDRUDLLULDLLDLUDRRDLLDDLDURLLDLLDLLLDR
LRDULUUUDLRUUUDURUUULLURDRURDRRDDDLRLRUULDLRRUDDLLUURLDRLLRUULLUDLUDUDRDRDLUUDULLLLRDDUDRRRURLRDDLRLDRLULLLRUUULURDDLLLLRURUUDDDLDUDDDDLLLURLUUUURLRUDRRLLLUUULRDUURDLRDDDUDLLRDULURURUULUDLLRRURDLUULUUDULLUDUUDURLRULRLLDLUULLRRUDDULRULDURRLRRLULLLRRDLLDDLDUDDDUDLRUURUDUUUDDLRRDLRUDRLLRDRDLURRLUDUULDRRUDRRUDLLLLRURRRRRUULULLLRDRDUDRDDURDLDDUURRURLDRRUDLRLLRRURULUUDDDLLLRDRLULLDLDDULDLUUDRURULLDLLLLDRLRRLURLRULRDLLULUDRDR
RURRRUDLURRURLURDDRULLDRDRDRRULRRDLDDLDUUURUULLRRDRLDRRDRULLURRRULLLDULDDDDLULRUULRURUDURDUDRLRULLLRDURDDUDDRDLURRURUURDLDDDDDURURRURLLLDDLDRRDUDDLLLDRRLDDUUULDLLDRUURUDDRRLDUULRRDDUDRUULRLDLRLRUURLLDRDLDRLURULDLULDRULURLLRRLLDDDURLRUURUULULRLLLULUDULUUULDRURUDDDUUDDRDUDUDRDLLLRDULRLDLRRDRRLRDLDDULULRLRUUDDUDRRLUDRDUUUDRLLLRRLRUDRRLRUUDDLDURLDRRRUDRRDUDDLRDDLULLDLURLUUDLUDLUDLDRRLRRRULDRLRDUURLUULRDURUDUUDDURDDLRRRLUUUDURULRURLDRURULDDUDDLUDLDLURDDRRDDUDUUURLDLRDDLDULDULDDDLDRDDLUURDULLUDRRRULRLDDLRDRLRURLULLLDULLUUDURLDDULRRDDUULDRLDLULRRDULUDUUURUURDDDRULRLRDLRRURR
UDDDRLDRDULDRLRDUDDLDLLDDLUUURDDDLUDRDUDLDURLUURUDUULUUULDUURLULLRLUDLLURUUUULRLRLLLRRLULLDRUULURRLLUDUDURULLLRRRRLRUULLRDRDRRDDLUDRRUULUDRUULRDLRDRRLRRDRRRLULRULUURRRULLRRRURUDUURRLLDDDUDDULUULRURUDUDUDRLDLUULUDDLLLLDRLLRLDULLLRLLDLUUDURDLLRURUUDDDDLLUDDRLUUDUDRDRLLURURLURRDLDDDULUURURURRLUUDUDLDLDDULLURUDLRLDLRLDLDUDULURDUDRLURRRULLDDDRDRURDDLDLULUDRUULDLULRDUUURLULDRRULLUDLDRLRDDUDURRRURRLRDUULURUUDLULDLRUUULUDRDRRUDUDULLDDRLRDLURDLRLUURDRUDRDRUDLULRUDDRDLLLRLURRURRLDDDUDDLRDRRRULLUUDULURDLDRDDDLDURRLRRDLLDDLULULRRDUDUUDUULRDRRDURDDDDUUDDLUDDUULDRDDULLUUUURRRUUURRULDRRDURRLULLDU

4
inputs/input2_test Normal file
View File

@ -0,0 +1,4 @@
ULL
RRDDD
LURDL
UUUUD

1635
inputs/input3 Normal file

File diff suppressed because it is too large Load Diff

41
main.py Normal file
View File

@ -0,0 +1,41 @@
#!/usr/bin/env python3
import tools.aoc
import argparse
import importlib
import os
YEAR = 2024
TIMEIT_NUMBER = 50
argument_parser = argparse.ArgumentParser()
argument_parser.add_argument("-d", "--day", help="specify day to process; leave empty for ALL days", type=int)
argument_parser.add_argument("-p", "--part", help="run only part x", choices=[1, 2], type=int)
argument_parser.add_argument("--timeit", help="measure execution time", action="store_true", default=False)
argument_parser.add_argument(
"--timeit-number",
help="build average time over this many executions",
type=int,
default=TIMEIT_NUMBER
)
argument_parser.add_argument("-v", "--verbose", help="show test case outputs", action="store_true", default=False)
flags = argument_parser.parse_args()
import_day = ""
if flags.day:
import_day = "%02d" % flags.day
imported = []
for _, _, files in os.walk(tools.aoc.BASE_PATH):
for f in files:
if f.startswith('day' + import_day) and f.endswith('.py'):
lib_name = f[:-3]
globals()[lib_name] = importlib.import_module(lib_name)
imported.append(lib_name)
break
for lib in sorted(imported):
day = int(lib[-2:])
day_class = getattr(globals()[lib], "Day")(YEAR, day)
day_class.run(flags.part if flags.part else 3, flags.verbose, flags.timeit, flags.timeit_number)

2
requirements.txt Normal file
View File

@ -0,0 +1,2 @@
shs-tools ~= 0.4
pre-commit

24
skel_day.py Normal file
View File

@ -0,0 +1,24 @@
from tools.aoc import AOCDay
from typing import Any
class Day(AOCDay):
inputs = [
[
(None, "input%DAY%"),
],
[
(None, "input%DAY%"),
]
]
def part1(self) -> Any:
return ""
def part2(self) -> Any:
return ""
if __name__ == '__main__':
day = Day(%YEAR%, %DAY%)
day.run(verbose=True)

58
start_day.py Normal file
View File

@ -0,0 +1,58 @@
#!/usr/bin/env python3
from argparse import ArgumentParser
from datetime import datetime
from os.path import exists
from platform import system
from subprocess import call
from time import sleep
from tools.tools import human_readable_time_from_delta
import webbrowser
YEAR = 2016
CHARMS = {
'Linux': '/usr/local/bin/charm',
'Windows': r'C:\Users\pennywise\AppData\Local\JetBrains\Toolbox\scripts\pycharm.cmd'
}
arg_parser = ArgumentParser()
arg_parser.add_argument("-d", "--day", help="start a specific day (default: today)", type=int)
args = arg_parser.parse_args()
DAY = args.day or datetime.now().day
if YEAR < 2015 or not 1 <= DAY <= 25:
print("Invalid year or day for year: %d, day: %d" % (YEAR, DAY))
exit()
day_file = "day%02d.py" % DAY
if exists(day_file):
print(day_file, "already exists. Use that one!")
exit()
start = datetime(YEAR, 12, DAY, 6, 0, 0)
now = datetime.now()
if start > now:
time_wait = start - now
if time_wait.days > 0:
print("Do you really want to wait %d days?" % time_wait.days)
exit()
while time_wait.seconds > 0:
print("Day %d starts in %s.\r" % (DAY, human_readable_time_from_delta(time_wait)))
if time_wait.seconds > 70:
wait = min(1, time_wait.seconds // 3600) * 3600 + min(1, time_wait.seconds // 60) * 60
sleep(wait)
else:
sleep(1)
time_wait = start - datetime.now()
with open("skel_day.py", "r") as IN:
with open(day_file, "w") as OUT:
while in_line := IN.readline():
OUT.write(in_line.replace("%YEAR%", str(YEAR)).replace("%DAY%", str(DAY)))
call(["git", "add", day_file])
webbrowser.open("https://adventofcode.com/%d/day/%d" % (YEAR, DAY))
call([CHARMS[system()], day_file])