Compare commits
4 Commits
3be30b2a14
...
81eebf8df8
| Author | SHA1 | Date |
|---|---|---|
|
|
81eebf8df8 | |
|
|
ff572f4a36 | |
|
|
32242a43b9 | |
|
|
94201f6868 |
|
|
@ -0,0 +1,141 @@
|
||||||
|
@@.@@.@@.@.@@..@@@@@@@.@@.@@@.@.@@@.@@...@..@@..@@@@.@@@...@@@@@@.@..@...@@.@@@@@@@@@@@@.@@@.@@@.@.@@@@.@.@@..@@@.@..@.@@..@@.....@@.@@@.@@@
|
||||||
|
@@@@@@@.@@.@@.@@@@@..@@@@.@@.@@@@@.@.@..@.@@..@@.@@@@.@.@@@.@@@@@.@@@@@@@.@@@@...@@.@.@@@..@.@@@@@@@@@@@@.@@.@.@..@.@@@@@..@@@@.@.@@@.@..@@@
|
||||||
|
@@.@@@@.@.@.@@@.@@@@@@..@@@....@...@@@..@..@@@@@.....@@..@.@@.@@@@@@@@@.@@@.@@@@@...@@@@@@@@@.@@@@@..@.@.@@..@@..@@.@@.@.@@@@@@@..@@@@@@..@@
|
||||||
|
.@@..@..@@@@.@@@@@..@@...@@@@.@@.@@@@@..@@@@@@@@@@..@@.@@@@.@@.@@@.@@...@@..@@@@...@@@@@@@@@@.@....@@.@@@@@.@@.@..@..@.@@.@.@.@@...@@@@...@.
|
||||||
|
@@@.@.@@@@..@..@@@@@@...@@@@@.@.@.@@...@@@@..@@@@@@@@@.@.@@@@@.@@@.@@@.@.@.@@@.@@@@...@@@@.@@.@@.@@.@@..@@.@@@..@@.@.@@@..@@@@@@@@@.@@.@@..@
|
||||||
|
.@@@@.@.@@@..@@@..@@@@...@@.@@@@.@@.@@@@@@..@..@@@@@.@@@@..@@@@@@@@.@...@..@.@.@@..@.@.@@.@@.@.@@@@@@@@...@@@.@@@@@@.@@.@..@@@..@...@.@@@@@@
|
||||||
|
@@@@@.@@..@@@@@@@@@@@@@@@@@.@@..@@@..@@.@@.@...@@@@..@@@@.@..@.@.@..@.@.@@...@.@@@@@..@.@.@.@...@@..@@@@@...@@.@@@@@@.@@.@@......@@@@.@..@.@
|
||||||
|
.@..@@@@.@..@@@.@@.@@.@.....@.@@@@@.@@@@@@@..@@@@.@..@.@.@@.@...@@@@.@@.@@.@@@@@..@.@@@@.@..@..@@@@.@.@@@@.@@..@.@.@@@@.@@.@@..@.@@@@@@@@@@@
|
||||||
|
@@....@.....@@..@@@@@@@@..@@@@@@.@..@..@@.@@.@@@@@@.@@@@@@@.@@...@.@@@.@@.@@.@@@@@@@..@@@...@@@@@@@..@@@@@@@@@@.@@...@@@@.@@@...@@.@.@@@@.@@
|
||||||
|
@@@@@@@@.@.@@@..@@..@@...@@@@@@.@.@.@@@.@@@@@..@@@@.@@@.@..@@.@@.@.@@@@..@@@@.@@.@...@@.@@@@..@@.@@.@..@@@@..@.@@.@.@@@...@.@@@.@@@..@@@.@@@
|
||||||
|
@@@@@@@.@@@@@@@@@@@@.@@@..@.@@..@@@.@@.@.@@@.@.@@@@@.@@@@@@.@@@@@@@@@@....@.@@@@@.@@@@@.@@@...@@@..@@@...@@@@@..@@@.@@@@@@@@@@..@@..@.@..@..
|
||||||
|
.@@..@@.@@@@@@@.@.@..@..@.@@..@..@@.@@@@@@.@@@@@.@@..@@@@...@@.@..@@@@.@..@@@.@.@@@@...@@@@@.@..@@.@.@@@..@.@.@.@@@..@.@@@.@.@..@@@@@@.@@@@@
|
||||||
|
@@@@@@@.@.@@@@@.@@@@@@@@@@.@@..@@@.@@.@@@@@@@@.@...@.@@@@.@@@@..@.@@.@@..@...@@@.@..@@@.@@@..@@@.@@.@@..@@@@@@.@@@.@@@.@.@@...@.@....@@.@.@.
|
||||||
|
@@@@@@..@.@@@..@@..@@@@.@@@@@@@...@@@.@@@..@@@.@.@.@@.@@@@@.@@@.@@@.@@@@@@@...@@...@.@.@..@.@.@@@@@@@@@.@@@.@.@@@.@@..@@@@.@...@.@@@@@@@@@@@
|
||||||
|
@@@..@.@@.@@@.@@.@@.@.@@@@@@.@@@@...@@@@@@..@.@.@@@@.@@@@.@@@@.@@@..@@@@@.@@....@.@@..@@.@@@@@..@@..@@@.@@@@@.@@.@.@@..@@....@.@@@..@@@@@@..
|
||||||
|
..@..@.@@@@....@.@..@...@.@.@@@@@@@@..@@@@@@@..@@@@@.@..@@@@@@@......@..@@.@@@.@@..@@.@@@.@@.@.@.@@.@@@.@@.@@..@..@@.@@@@.@.@.@.@.@@@@@@.@@@
|
||||||
|
@@@@@.@@@....@@@@@.@@@..@@@@@.@@.@.@@@@@@.@@@@@.@@.@...@.@@@.@@@..@.@.@@@..@..@@.@@@@@@@@@@..@@@@@@@@@@@@@@...@@@.@@@.@.@@@@.@@.@@....@@@@.@
|
||||||
|
@.@@..@@@.@@@@@..@@@@@@@@@@.@@.@.@@.@@...@@.@@@@@..@@@@@@.@..@.@@.@@.@...@..@@.@@.@.@@..@@..@@.@@@.....@@@..@@...@@@...@@.@.@.@.@@@@@@@@@.@@
|
||||||
|
@.@...@..@@.@@.@@@@.@.@.@@.@@.@@....@.@@@...@@.@@@@@@@..@@@@.@@@@@.@.@@...@@@.@@@@@.@@@.....@.@@@@..@.@@@@@@@@..@..@.@.@@.@..@@@@.@.@@@.@..@
|
||||||
|
@.@@@@@@@@.@.....@@@@@@.@...@@@.@@@...@.@@..@@@@@@@@@@.@.@@.@@@@@.@.@@..@@.@.@@@@.@@.@@@.@@@@@.@.@@.@@@..@@@@.@.@..@@@.@..@@..@.@@.@@@@@@@@@
|
||||||
|
@@@..@@@@@@@@@.@.@.@@.@@@@...@@@@@@@@.@@.@@...@@@.@...@@..@@.@@@..@@..@@@.@@@@@@@@@@@@.@@.@.@@@@@@@.@..@@.@@..@@@@@...@...@@@@@@@@.@..@.@@.@
|
||||||
|
@@@@@..@@..@...@@@@@@@@.@...@@@@.@.@@.@@@.@@@.@@@.@@..@@@@@@.@.@@@@@@@@@@@@@.@.@@.@@@..@@@.@@@@@@.@@.@..@@..@@.@@@..@@@@@@.@@@@.@...@@@.@@@.
|
||||||
|
@@.@..@.@@@@@.@@@@.@...@@.@@@@.@.@@@@@...@@.@@@.@.@.@.@@.@@@@@..@@@@@@@..@@@@.@@.@@@@@.@@@@@.@@@...@@@@.@@@@@@.@@@..@...@.@@@@@.@.@@.@@.@@..
|
||||||
|
.@.@@@@.@@@@..@@@@@.@@@@@@@.@@@@@..@@...@.@.@@@@@.@.@@@@@.@@@@@@@@@.@@@@.@@@@@@..@@@@...@@@@@...@@...@@@@@@.@@@.@.@..@@@@@.@@@@..@@@..@@.@@@
|
||||||
|
@@@@@.@.@@@@.@@@@@@@.....@..@@.@@.@@@@@..@.@.@.@.@@.@@@@@@@@@.@.@@@@@@@@@@@....@.@@@@@.@@@.@@@@@.@@@@.@.@@@@.@@@@@@.@.@.@@..@..@.@@..@@@.@@@
|
||||||
|
@@@@@@@@@@@@..@@@@@@@@....@@.@@@.@@.@.@.@@@@...@...@@.@.@@.@@@.@@@@.@@@@....@...@..@...@.@.@@@@.@...@@@.@..@@@@@@@@...@@@@@.@.@@..@@..@@@..@
|
||||||
|
@...@@@@@.@.@.@@@@@@.@@.@..@@@@....@@@...@..@@@..@@@@.@@@..@@@@@@...@@@@@.@.@@@@.@.@@@@@.@@.@@@.@@..@@@@@@..@@@.@@.@.@..@@....@.@..@@.@..@.@
|
||||||
|
@@@@@@..@@.@.@.@...@..@@..@.@@@@..@@@@.@..@.@@@@....@@.@@@.....@.........@@@@.@.@@@@@@@.@@..@...@.@.@@@@.......@.@.@@...@.@@@@.@.@@@@.@.@@.@
|
||||||
|
@@@@@@.@@.@.@@..@.@.@@....@.@@.@@@@..@.@@@.@@@.@...@.@@.@.@@.@@@...@.@@.@.@@@.@...@@@.....@.@.@.@@.@@...@.@@@@@.@@@@.@.@.@@.@..@@@.@.@..@@@@
|
||||||
|
.@@.@@@@@....@.@@@....@@@..@.@..@..@@@@@@@@...@@@.@.@.@.@@@.@@.@....@@@@.@@@@@@@.@..@..@@@..@@@@@.@@@@@@..@....@..@.@@....@@@@.@.@@.@@@...@.
|
||||||
|
@@@@.@@@.@@@@@@..@.@@.@..@@..@@@.@@@@@@.@@..@@...@@@.@@@.@.@@..@@.@@@.@@@@@@@@@@@@@@..@.@@.@@.@@@@..@....@@@@@.@.@.@@@@.@.@@@@@@...@..@..@.@
|
||||||
|
@.@@.@@.@@@@@@...@@.@@.@@...@@.@@.@@@@@@@@..@.@@@..@@.@@..@@.@.@...@.@@.@@@.@@@@@.@@@@@.@@@@..@@.@@..@.@.@@.@@@@@....@.@.@@.@@@.@@@@@@@.@@.@
|
||||||
|
@@.@@@@@@.@.@@@@.@..@.@..@..@@.@@@...@@.@@@.@.@.@@..@@.@@.@@@.@.@@@@@...@@@@@.@.@@@@.@.@@.@@@..@..@@@..@@@..@@@..@@@@@.@.@.@@@@..@@@@@@@@@..
|
||||||
|
@@@@@@.@.@@@@@.@.@..@@@.@@@@.@...@.@@.@..@@@@@@@@.@@.@...@@.@@@@@.@@@@@@@@@.@.@..@.@@@@@.@@@@.@@..@.@.@...@@@@@@@@@@@.@.@@@@@@@.@@@@@@.@@@.@
|
||||||
|
@@@@.@@@@@@@.@@.@.@@.@@...@....@@@@@.@.@.@@@@@..@@.@.@@.@@@...@@@@.@@@@@@@...@@...@@@.@@@@@@@.@.@..@..@@@@@@@@...@.@@@.@@@@@@@@@..@.@@.@.@@@
|
||||||
|
.@@.@@@..@@.@@@@@.@@@..@@@.@@..@@@.@@@.@@.@@@.@@.@.....@@@.@@@.@....@@.@@.@...@@..@....@.@@.@.@.@@.@..@@..@@...@@.@@.@.@@..@@@@.@@@.@@.@@...
|
||||||
|
@@.@@.@@@@@@..@@@@@@.@@@@@@..@@.@..@@@@@..@@.@@..@.@@@@@@..@@@.@@@@@@.@@@@@@..@@....@@.@@@@@@.@.@@@.@@@@@.@@@.@..@.@@@.@.@@.@@.@.@@@@@@@.@@@
|
||||||
|
@@.@.@.@@@@@..@@..@@@...@@@@@@@.@@......@.@...@@@@.@@@@@@@@@@..@@@.@.@@@..@.@..@@.@@@..@...@.@@@@@@@.@@@..@..@@.@.@@@.@@.@@@@@@@@...@..@...@
|
||||||
|
@@@.@.@@@@..@@..@@@@.@.@@@@.@@.@.@...@@@@@@@@.@@@@@@@.@@..@..@@@@@@@@@..@@@@..@@@.@@.@...@@@@@@@.@@.@@@@@.@@@@@@@@@@.@@@.@...@@@@..@...@@@@@
|
||||||
|
.@@...@@@.@@.@..@@.@@.@.@@...@@@.@@@.@@..@@.@@..@...@.@@..@@@@.@.@@.@@@@@..@@@@..@..@.@@@.@@@@.@...@@.@@@@...@@@@@@@..@.@@@.@..@@@.@.@@@@@@.
|
||||||
|
.@@.@@.@@@@@@@@@@@.@@.@.@.@@@@.@@@@@@@@@@@...@@@@@@..@..@@...@@....@@@@@...@..@.@..@@@@@.@@@....@@@.@@..@.@@..@@@@@.@@@@@@@.@@.@@.@@.@..@@@@
|
||||||
|
@@@@@.@@@@@@@@.@..@@.@.@.@.@.@@@.@@@@.@@@@@@.@@..@.@..@.@.@.@.@@@@.@@..@@.@@.@@@..@@.@@.@@@@@@@.@.@.@@@..@.@@@@@@.@.@....@.@.@@@..@@@@@@@...
|
||||||
|
@@@...@@..@@.@@....@.@..@.@@@.@@@@..@@...@@@@@.@@.@...@@.@.@@@.@@@@.@@@.@.@..@@@@@@.@.@@.@@@.@@.@@@@.@@@@.@@@@@.@@.....@@.@...@@@@.@..@.@@@.
|
||||||
|
.@@.@@.@..@@@@@@@.@.@@.@.@...@.@.@@@@@.@@..@@@.@.@@@@@@...@.@..@...@.@@.@.@@@@.@@@..@@@@@@...@.@@@@@@@@.@.@..@..@.@@@@@@@@@@@@@@.@....@@@@@@
|
||||||
|
@@..@@@@.@@....@@.@@@.@@@@@@.@..@@@.@......@@@.@@@@.@@.@@@@.@@@@.@..@@..@@@.@.@.@@@@..@@..@@@@@@.@@@.....@....@@.@@.@.@@@@@@.@.@@@@...@@.@@.
|
||||||
|
@@@.@@@@@@.@@...@@..@@..@@@@@@@@@..@..@@@@@.@@.@@@...@@@.@@.@@@@.@@.@@@@@@@@@..@..@..@@.@@@@@.@.@..@@@.@..@@@@@@@.@@@@..@@@@@@@.@@..@@..@..@
|
||||||
|
......@@@.@@@@.@@...@.@@@@@@.@@.@..@.@.@.@.@..@@.@@.@@...@@@@@@..@@@@..@.@.@@@@@@@.@.@@@@..@@@@@@@@@.@@.@@@@@.@@..@@@@@@..@@.@..@@@.@@@@@.@.
|
||||||
|
@.@@@@@@@.@@@@@..@@@.@.@@@@..@@@@.@@...@.@.@@@@.@.@@@@@@@@@..@@..@..@@@.@@..@@@.@@@.@@@@.@@..@@@@.@@@@@@.@...@@.@@@.@.@@@.@..@.@@@...@.@.@@@
|
||||||
|
@..@@@..@..@@@@@@@@..@@@@@@@@@@..@@@@@@@@@@@@.@.@@@..@.@@@...@.@@.@@@@@.@@...@@@@@@.@.@.@@@@@@@@..@...@@.@@@..@@.@@@@@.@......@@@@@@..@@@..@
|
||||||
|
..@.@.@..@..@..@.@.@@@@@...@.@@@@@@@@@@..@..@...@@@@@@@...@@@@@@@@@@..@@@@..@.@..@@@@@@@.@@@.@.@@.@@.@@@@@.@.....@.@...@@......@@.@.@@@@.@.@
|
||||||
|
@@@@.@@@.@.@@.@@@@@...@@..@@@@.@.@@@..@@@.@.@@@.@@@@.@@@@@@.@@@@...@@@@..@.@..@.@@@@.@.@...@@@@.@@@@@@@..@..@@...@.@@@@@.@@@@.@@@@.@@@@.@@..
|
||||||
|
@.@@@@@@@@....@.@@@.@..@.@.@@@@@..@@@.@@...@.@.@@@.@@@@@.@@@......@@@.@@@.@.@@.@@@@@@.@@..@.@.@.@@..@@@.@@.@.@..@@...@..@@.@@.@@.@@.@.@.@@@@
|
||||||
|
......@@@@@..@@@@@@@@@@@...@..@@.@@@@@@.@@@@@..@@@@@@.@.@...@@@@@.@@@.@..@@@@@@.@@@@.@@@...@@.@@@@@....@@..@.@@@@.@@@@@@..@@..@@@@@.@.@..@@.
|
||||||
|
@@..@@@..@@.@@@@..@@@@.@@@@..@.@.@@@.....@.@@.@@@..@.@@...@..@...@.@@@.@.....@@.@@.@@.@@@@@@@@@@..@......@@@@.@@@.@.@.@@@@.@.@@@@@@...@..@@@
|
||||||
|
@@@.@.@@@@@.@.@@@..@.@@@.@@@@.@.@@@@@@@.@@@@@@@@@@.@@@@.@..@.@@@@@@@.@..@@..@@@@..@.@.@@@.@...@.@@.@@@@@.@@@@@.@@.@.@@@....@@@@@@@@@..@@.@.@
|
||||||
|
.@@@@.@@.@.@@..@@..@@@@.@@@.@.@@@.@@@.@@.@@.@....@.@.@@..@.@.@..@@@@.@....@@@@@..@@@.@.@@@@@@@..@.@..@@..@@..@@..@@..@@@..@.@@@.@@@.@.@@@@@.
|
||||||
|
@..@.@@@.@@...@@@@.@@.@..@@@@@...@@@@.@...@.@@@@.....@.@..@@.....@.@.@@.@@..@@.@@.@@@@@@..@@.@.@@@....@@..@.@@....@@@@@@@...@.@..@@.@..@@@.@
|
||||||
|
.@.@@.@.@@@@.@.@..@..@@@.@..@.@.@@.@.@@@.@@@.@@.@@@@@@@.@@@.@.@@.@.@..@..@@@@@..@@.@@@.@@@@@@.@@@@@.@..@@@..@@@@@.@@@@@@@@@@@@@@@@@@@.@.@@..
|
||||||
|
@.@@@@@@@@@@@@.@@@@@@...@@@@@@@.@@@.@.@@@@.@@.@.@@@@.@@.@.@...@@@..@.@@@@.@.@@.@@..@@@@@@@@..@@@@@..@@@@@@@@@@...@@..@@.@.@.@@@@@.@@@@.@@.@.
|
||||||
|
@@..@.@@.@@@.@...@@.@@.@..@@@.@@...@@..@@@@@.@..@.@.@@@@@@@..@@.@@.@@@..@@@@..@@@@@..@.@@.@@@..@@@..@.@@@.@.@@.@@@@@........@@..@@@.@@@@@@@@
|
||||||
|
@..@....@.....@.@.@@@.@.@...@@...@..@@@..@@@@.@.@@@.@@@..@@@@@@...@@.@@..@@.@.@@.@@@.@@@@@@@@@.@@..@.@.....@@.....@@@@.@@@@@.....@..@@..@@@@
|
||||||
|
@@@@.@@@@@@.@@@@@@@@@@.@@@@@@@..@@@@@@.@@.@@.@@.@@@@@@@@@@@@@@.@...@@.@.@@@@@@.@@...@@@@@@.@@@@.@.@@@@@.@@@@.@@@@@@@@@@@@@.@@@.@@.@@@@@@.@@@
|
||||||
|
@@@@@@@.@.@.@@.@@@@.@..@@.@..@@@@.@@.@@@@..@@@..@@.@.@@..@..@@@@@...@@.....@@@@@@@@@@@@@.@.@@@@..@@@.@@@..@.@...@@@@@@.@@@.@....@...@.@..@@@
|
||||||
|
@@@@@@.@.@@@@@@@.@@@.@@.@@.@.@...@.@@..@@@@@.@@..@..@@.@@@..@.@...@@@@..@.@@.@.@...@@@@.@.@@..@@.@.@@@@@@@@@@@@@@@.@.@..@.@.@@@@@..@@@@.@.@@
|
||||||
|
@@..@@...@@.@@...@@.@@.@@@@.@@@@..@@.@@@@@@..@@.@@....@@.@..@@..@.@@@@.@@@@@.@@.@@.@.@.@@@@@@@..@@.@@.@@@@@.@@@@...@.@@..@@@@@@@@@...@@..@.@
|
||||||
|
@.@@@@@@.@..@.@@@@@..@@.@..@@.@.@.@...@@.@.@@@..@@.@@@@...@@.@@@@@..@.@..@.@@@@@@@@@@@@.@@.@...@@@.@@@@.@@@@@.@..@@@@@@..@@@@.@.@@@@.@@..@@@
|
||||||
|
@@@@..@..@...@@@.@@..@..@@@@@@.@@@@@.@.@.@...@@.@@@.@@..@@@@@@.@.@..@.@@.@@@@.@@@@.@@@....@@.@.@.@.@@.@@@@@@@.@@@.@.@@.@.@@.@@@.@@@.@@.@..@@
|
||||||
|
@@.@@@..@@.....@@@@.@@@@@@@@@.@.@@@@..@@.@@@@@...@@@.@@@.@..@@@..@@@..@@@@...@.@.@.@.@@@@.@@@.@.@@@@..@.@@.@@...@.@.@@..@@@@@@.@.@..@@.@.@..
|
||||||
|
.@.@@@@@@.@@@@.@@@.@@..@@@@@@.@@@@@@...@@@@@@.@.@@@@...@.@@@@@.@@@.@@@@.@.@@.@@.@@.@@@@@@@..@@@..@@@..@@@..@@@@@.@.@@@@@@..@@@.@@@@.@..@.@@.
|
||||||
|
@...@@@@@.@.@@@..@@..@@@@@..@@@@@@@@.@@@.@.@@@@..@.@@@@@.@..@@@..@@@@@.@@..@@@..@@@@@@@@.@..@@.....@@.@@.@@@...@....@@....@....@..@@@@@@@@.@
|
||||||
|
@.@@@@@@@.@@@....@@..@@..@@..@@.@.@.@@@@@@.@...@.@@@...@@@..@@.@@@@@@.@@@@@@@.@@@@..@@..@@@@@..@..@@.@@@......@@@.@@@@.@@.@..@.@@..@.@@@@@@.
|
||||||
|
@@@..@@@@@@.@@...@.@@.@..@.@..@@@@@@@.@@@@@@@@@@@@@@.@@@@@.@@@.@...@.@..@.@.@@@@..@@@@.@@..@..@@@.@@@@@....@@@....@@.@@@@.@@@..@@@.@.@@@@@@@
|
||||||
|
@...@...@@@@@@.@@@@@@.@@@@@...@.@@@@@@@@@@..@@.@@@.@.@@@@.@.@.@.@...@@@.@@.@@..@@.@@@.@..@@@@.@@@@@...@.@@@.@@..@.@@@@.@@@@@..@@@@@@.@@.@@@.
|
||||||
|
@.@@.@@.@@..@.@@@.@..@@@@@@.@.@@@@@@@..@@@@@..@.@@@...@.@@.@@@.@.@.@@.@@@@@@@.@@.@.@@.@...@@.@@@@@@..@.@@@@@@@@.@@.@@@.@@@@@@@..@.@@@.@@...@
|
||||||
|
@@@@@.@..@@.@@.@.@.....@@@.@..@.@.@@@@@@.@@@@@...@@@@@...@.@@..@@@@@@@@.@@....@@@@@@@@@..@....@@@.@@..@.@@@@@.@.@@@@.@@@@@@.@@@@@.@.@@.@@.@@
|
||||||
|
@@@..@@@@@@@@@@....@@.@@.@@@.@...@.@@@@.@@@..@.@.@@@.@.@@@.@@@@@@.@@@.@....@@@@..@@@@@@@@@@@.@@@@.@.@@@@@...@@@.@@@@@@.@@@@@.@@@@@.@@@.@.@@@
|
||||||
|
..@.@@@.@@@@@@@.@...@@@@@.@@@@@....@@.@@@@@.@..@@@@.@@@@.@@@@@@@@..@@@@...@@.@@@@.@.@..@..@.@@@.@@@@@@.@.@...@@@@.@....@@@@@@@..@..@.@@@...@
|
||||||
|
@@..@@@.@@@@@@@.@@@@@@.@@.@.@.@.@@@@@@@...@@.@...@@@.@@.@@@.@.@@@@@..@.@.@@..@@..@.@@@@@.....@@.@@.@.@@@@@@@@@@@..@@.@.@@@@@@@@.@@@...@@@@@.
|
||||||
|
@.@@@@@.@..@@..@@@@.@@@@.@@@.@@.@@@@..@@.@@..@@@@@@.@@@@@@@@.@.@.@@..@.@.@..@@@@@@@@.@@.@@@.@@.@....@..@@@@.@.@@.@....@@.@@@.@@@@@@@@.@.@@@@
|
||||||
|
..@@....@.@@.@@..@..@.@.@.@...@..@@.@.@@@...@....@@.@@.......@..@@@@@@@@.@@..@...@...@@@@@@.@...@@@.@.@@..@.@@@.@@@@.@@@@@.@@@@.@@.@.@@@...@
|
||||||
|
.@.@@...@@@@..@@@@@..@@@...@@@@@@.@...@@@...@@@..@@..@.@@@@@.@.@.@@@@@...@@@.@@@.@@.@@@.@@.@@@@@@@@.@@@@.@@@@@@.@@.@.@.@@@@@@.@@@@@@@@@@@@@@
|
||||||
|
@@@.@@.@@@..@@.@@@...@@@@@..@.@.@@@@@..@@@@@@@@@..@@..@.@@@.@.@@.@....@@@@@@.@@@.@.@@@.@@@..@@@..@@.@..@@@.@@@.@@@@@@@@.@@@@@.@@.@..@.@@.@@@
|
||||||
|
@@@@@.@.@@@..@@@.@.@.@@@@@@@@@@@@@@.@.@.@..@@.@.....@...@.@..@@@@@@@@@.@.@.@@@@.@@@.@@@..@@.@...@..@@@@.@@.@@@@..@@.@.@@.@.@@@.@.@@@@@@@@@@.
|
||||||
|
.@@@@@@..@@@@@.@@.@@@@.@@.@..@.@.@..@......@.@@@@@@@.@@.@@@@...@@@@@@@@@@@.@@@@.@@.@.@@@.@@@@@.@..@.@@@@.@@.@@@@..@@@@@@@.@@.@.@.@.@@@@@....
|
||||||
|
.@.@@@@.@@@@@@@@.@@@@@@.@.@@@@.@..@@@@@@@@@.@@@..@..@@....@..@@..@@@@.@@.@@@@.@@@@@@@@@@.@.@@.@@.@.@@.@@@.@@.@@.@.@.@@@.@@@..@@@@.@.@@..@@@.
|
||||||
|
..@@..@@@.@@..@@@.@.@.@.@@@@..@@@@@@.@@..@..@@@@..@@.@@.......@.@@@.@..@...@....@@@@@@@.@@..@.@....@.@@.@@.@....@@...@@.@.@@.@@@@@..@@@@.@.@
|
||||||
|
.@.@@.@.@@@@..@@.@..@..@@@.@@@.@.......@@@@..@.@@@.@@@...@@@@@@@@...@@.@@@@@@..@.@...@..@.@@@@@@@@@@@@.@@@.@@@@@.@@..@@..@@.@@@.@@@@..@@..@.
|
||||||
|
@.@.@@@@@.@.@@..@@@@@@..@@.@.@@.@..@..@@.@@.@@@..@.@@...@@@.@@@....@@..@@@@@..@@@..@@@..@@@@@@...@@@@@@@..@@@@@..@@@..@.@@.@..@.@.@@..@@..@.
|
||||||
|
@@@@..@..@.@@.....@@.@.@@@.@@@.@@@@@@@@@@@@..@.@.@@.@@...@.@@@.@.@.@.@@.@@..@.@.@@..@.@..@.@@@@.@..@.@@@@@.@..@@@.@.@.@@@@@...@.@@@...@.@@.@
|
||||||
|
.@.@...@@.@.@@@@..@@@@@@@.@.@@.@....@.@@..@...@@@@@@@@..@.@@.@.@@@@.@@.@.@.@@@@@@@@@..@@@@@@@@...@.@..@@@@@@@@@@.@@@@@@@@.@@@@@.@@.@...@@@@@
|
||||||
|
@@@@@@.@@..@.@..@@@@.@@@@@.@@@@@@@@@@.@@@..@@@.@@@@.@@@@.@@@@@@@..@@@..@.@..@@@@@@@@.@.@@@@@...@@.@@@.@@@@@@@.@..@@@.@.@@@@@...@..@@@..@..@@
|
||||||
|
.@.@@@@@@@@.....@.@@@.@@.@@@@@..@@.@.@.@.@.@.@..@@.@@..@.@@.@.@..@@@@@@@.@.@.@.@@@.@@.@@@@..@.@@.@@@@@.@.@@@.@.@.@@.@@@@@@@.@@@@.@.@@@@.@@.@
|
||||||
|
@@@@@.@@.@@@@@@@@@@@@@.@@@@@@@..@@.@@@@@@.@....@..@.@.@@@@@..@..@@.@@@@@@@@.@.@.@...@@@@.@.@@..@@@@@.@@@@@..@@@@@@.@@@@@..@@..@@@@.@.@@@@@.@
|
||||||
|
..@@.@@@@@@...@@@.@.@.@@..@@@@@@@@@@@@@..@@@...@@@.@@@.@.@@@.@@.@@..@....@@@.@@@@@.@.......@@.@.@@@@@.@@@@@.@@@@..@@@.@@.@@@@@.@@..@@@@@.@..
|
||||||
|
@..@@.@@..@@@.@@@@.@@.@@...@@@@@@@@@@..@@@.@..@..@.@.@.@@@.@@@.@@@.@@.@@@@.@@@@@@.@@@@@@@...@@.@.@@@@@@.@@.@@@.@..@....@@@.@..@.@@@@@@@.@.@@
|
||||||
|
.@@.@.@.@@@@@@@@.@@.@@@@@.@@@.@.@@...@.@@@..@@@......@@@...@@...@@@....@@@...@@@@.@....@.@@.@@.@@@@@@@@.@@.@@.@@@@@@@@.@.@@.@@....@...@.@@@@
|
||||||
|
@@.@..@.@.@@@@@@.@...@@.@@@@@@@@.@@@@@.@@@.@.@@@@..@@@@@@.@.@@@.....@..@....@@@@.@@@.@@@.@@@.@.@@@.@@@@....@.@.@@@.@@.@@..@...@..@@.@@..@@@@
|
||||||
|
@@@@@@..@..@.@@.@@@@.@.@@.@@@@...@@@.@@@@@@@@...@@@@...@@.@@.@.@@@@.@@@@@@.@@@@..@@..@@@@@@.@.@@..@@@@@@@@@..@.@@..@....@@@....@.@@..@@.@@@.
|
||||||
|
..@@@...@@.@..@.@@@@@@@@@@@@.@@.@@@..@..@@@@@.@.@@@@@.@@@@@@..@.@@.....@...@@@.@@@.@@@@@@.@..@@@.@@.....@@.....@@@..@@.@@.@@@.@@@@@@..@@@..@
|
||||||
|
...@@@@..@@.@@..@@@@@@.@.@@@@@.@.@.@@.@..@@.@@@..@@@@@@.@@.@@@.@..@@@@@@@.@@@@.@..@..@@@...@@@@.@@.@@@@@@@@@..@@@@@@@@...@@@@.@@@.@@..@@.@@@
|
||||||
|
@@..@..@.@..@@...@@.@@@@@@@@@@@.@.@@.@.@@@@..@@@@@.@..@@..@@@@.@@@@@.@...@@...@@@.@@@@.@@@@@@@.@..@.@@@@@.@@@.@@@@.@@..@@.@.@..@.@@@@..@@@@.
|
||||||
|
@@.@.@@@@@@@@@.@@@@.@.@..@.....@@..@.@.@@.@.@@@.@@@@@@@@@.@@@@@.@@.@.@@.@.@..@.@@@@.@.@@..@@...@@@@..@.@..@....@@@@@.@@@@@.@@.@@@.@..@.@@...
|
||||||
|
@.@@@@.@@@@.@@@@...@@@@@@@@.@@@@.@@.@@@@.@@.@@.@..@.@@@.@@@@.@@@..@...@..@..@@@@@@.@..@.@@@..@@@@@@@@@..@@...@..@@@@@@.@@@@@.@@@@@@..@.@..@.
|
||||||
|
..@.@@.@..@@@@@@@..@@.@...@.@..@@@@..@.@@.@.@@...@@@@@.@@@..@@@@@@@.@.@@@..@.@@@@@.@@@@.@@@@.@@@@.@.@.@@@@...@..@@.@@.@@@...@..@@..@.@@@@@@@
|
||||||
|
.@@@@@....@.@@..@.@.@.@@@.@@@@@@@@@@...@@@@@@@.@@@.@@@@.@@@..@@@.@@..@@@..@.@@.@@@.@@.@@@@@.@....@@@@@@@@@..@..@.@@@@@@@..@@@@@@@@@.@@@.@.@@
|
||||||
|
@.@@@@...@.@@..@@@....@@@..@....@@@.@@..@..@.@@.@@..@@@@@@@@.@@.@..@.@@@@@@@..@@@.@.@@@..@@@.@.@.@@@@@.@..@@.@@.@.@@@@.@@..@@@.@.@@@..@@..@.
|
||||||
|
.@.@..@.@@@@@.@@.@@@@@.@@@..@.@@.@@@.@@..@@@@..@@...@.@@@.@..@@.@@...@@.@..@@@.@@@.@@@..@..@..@@.@@@@.@.@@.@@.@.@@@@@@.@.@..@@@@@@..@@.@@@..
|
||||||
|
@@@..@@@@...@@..@..@@@@.@@@@...@@@@.@@@@@@....@@.@@.@@@@@@....@@@...@@@@.@.@.@.@@@@@@@.@.@@...@.@@@.@@.@.@@....@..@.@.@@@.@@@@@@@@@.@@@@@...
|
||||||
|
.@.@@@@.@@.@@@@@@.@@@@@.@@@@.@.@@@@@@@.@@@@@@.@.@..@.@....@@@@.@.@...@..@@.@..@.@@@@@.@@@@@@@@@@@@..@.@@.@@.@.@@@@..@@@@@.....@..@.@.@.@....
|
||||||
|
@@@...@..@.@@@..@..@...@@@.@.@@@@@@.@@.@@..@@@@@@.@@@@.@.@.@@@.@.@.@@..@.@@@@@@@@.@@.@..@..@@.@@.@@@@@...@@.@.@@@@@@..@@@..@.@@@@@@@@@@@@@@@
|
||||||
|
@@.@.@..@@@@.@..@@@.@..@.@@@@..@@..@@@@@@@@@@@@@@@@.@@@@@...@.@@..@@.@..@@.@..@..@@.@@@@@.@@..@@@......@@.@@@.@..@.@@.@@@@@..@.@@@@..@@.@@@@
|
||||||
|
@@@@@@...@@@.@@.@@.@@@.@@@@@.@@@@.....@@..@..@@.@@.@...@@@@..@@.@@@.@.@@.@@@@...@@@@@@.@@@@@.@.@@.@@..@@.@@.@.@@@@..@@@..@.@.@@.@@.@.@..@@.@
|
||||||
|
@@.@@@.@.@..@@@@@@@.@@.@@@@@@@.@@.@.@.@@@.@@@@...@@@....@@@..@@@@@.@@@..@@@@@@.@@..@@@@@@@@@@.@@...@@@@@@@@@.@.@@@@@@@@.@@@..@.@..@@..@...@@
|
||||||
|
@@@@..@@.@@@@@@@@@...@.@@..@@@.@..@@@@@@..@@@@@.@@@@.@@.@@.@...@@...@..@.@.@@@@@@@.@@@@@@@@....@@@@@@...@@@@@@.@@...@@@.@...@@@@...@.@.....@
|
||||||
|
@@@@@@@@@@@.@.@@@@@@.@.@@@@@@@.@@@..@@@@@@.@.@......@..@@@.@@.@@@@@@.....@..@@.@..@@@@@@@.@..@.@@@@@@@@@@@@@.@@.@@@.@.@.@@@..@.@....@@@@..@.
|
||||||
|
@@@@...@@@..@@@@@@@@@..@@@@@@@@.@..@@@...@.@..@@@..@.@..@@@@@.@@@.@@@@..@.@@@.@@@@.@@@.@@@.@@.@.@.@.@@.@.@@@@@..@@..@.@@@@.@.@.@@.@.@@@@.@..
|
||||||
|
@@@.@.@@..@@.@..@@@.@@@@@.@@@.@@@@@..@@.@.@@.@..@.@.@..@...@..@@@@@@.@@..@@@..@@.@.@.@...@@@@@@...@@.@..@@...@@..@@@.@@.@..@.@@.@..@@@@@..@.
|
||||||
|
.@@@@@..@@.@.@@@@.@@@........@@@@@.@@@@...@.@@@@.@@.@.@@@.@..@@..@@@@@@.@..@@.@@@.@@@.@.@@@.@@@@@.@@....@@.@@@@@.@@@.@@@.@..@..@....@...@@@.
|
||||||
|
...@@.@.@@@.@.@@@.@@.@.@@...@@@@@@@.@@@.@@.@@@.@@@@.@.@.@@@@@@@@@@@@@@@@@.@@@@@@@@@.@@@@.@.@@@@..@.@@@@....@@.@@@.@..@@.@@@.@..@..@@@@@@@.@@
|
||||||
|
.@@@@...@@@@@@@@.@@@@@.@@..@..@@@@@@@@@@@.@@...@@@..@@.@@.@@.@@@@@.@@@@.@@@.@@@@.@..@.@.@.@@@@.@@@.@@...@..@.@@@@.@@.@..@.@.@@@@@@@@@@@..@..
|
||||||
|
...@.@@@@@.@@.@@@@@@@@@@@@@.@@....@@@.@@.@@.@@@@@..@..@.@@@@@@@@@@....@@@@@.@@@@.@.@.@@.@..@@@@@@@@.@.@.@.@.@@@@......@@..@..@@.@.@@@@.@@@@.
|
||||||
|
@@@@@.@@@@@@@.@.@..@@@@.@@@....@@@@.@.@@@@@@..@@@@@.@@@@@.@@..@..@.@.@.@..@@@@@@....@..@@@.@.@@@@@@@.@....@...@.@...@@....@@..@@.@@.@@.@@@..
|
||||||
|
@.@@@@@@@@.@@@.@.@@@@@@..@.@.@@@.@@@.@.@.@@.@@@.@...@@...@.@@@@...@.@.@.@@..@@@@@.@.@@@@..@..@...@@@@@@@@@@.@..@@..@@..@.@.@.@..@@@@@@...@@@
|
||||||
|
@.@@@@@@@@@..@@.@..@....@@@@.@..@@@.@@@@@@@@....@.@.@@@.@@..@..@@...@@@@..@.@@..@@.@@..@@@.@@@.@.@.@.@@@.@.@@@@..@@@@@.@.@@@@.@@@@@@.@..@@@@
|
||||||
|
@@.@..@@.@@.@.@.@.@@@..@...@..@@@.@@@@..@.@@@..@@..@@.@@.@@.@@@@@..@@...@@@@@.@@@@@@@@@@@@.@@...@@...@@@@@.@.@@.@..@...@@@@.@@@.@@...@@@@.@@
|
||||||
|
.@@.@@..@@@@.@@@@@@@@@@@..@.@@@@@@@..@.@..@@@@@@@.@@...@@@@@..@@@@@.@@.@.@@...@.@.@@@.@@@@@@..@@.@@@@.@@.@.@@...@@@@....@.@.@@@.@@.@@@..@@@@
|
||||||
|
@.@.@@.@@.@...@@....@@@@@@..@...@@@@@@.@@@.@@@@.@@@..@..@@.@@@.@.@@@@@@@@@..@@..@.@..@@.@@@@.@.@@@..@@@@@@@@@..@@.@...@.@@@.@@..@...@@.@@..@
|
||||||
|
@@@@@@@@..@@@@@.@@@@@@..@.@.@....@@@@.@@@@@@@..@@@@@@@@@..@.@@@@@@.@.@@@@@@@.....@@@@@.@@@@@@@..@..@@@.@@@@@..@@@.@@@..@@@@@@@.@.@@@@@.@@@@@
|
||||||
|
.@@@@@@.@...@@@@@@@..@@@@.@@@.@@@@@..@.@..@@@@@@@@@@.@.@@...@@.....@@@@@..@@@.@@.@@@@@..@@.@...@@@@@@@@@.@@.@...@@...@.@@@@@@@.@.@@@@@@@@..@
|
||||||
|
@..@@.@@@@@.@@@.@@@@@@@..@@@@@@@...@@@@..@@.@.@.@@@...@@@.@..@@..@@.@.@.@@@@..@.@.@.@.@@.@@.@@.@@@@.@@@@.@@@@@@....@@@....@@@@@..@.@..@..@@@
|
||||||
|
@@@@@@.@.@@.@@@@@@@..@.@...@.@@.@.@@@@.@@@@@@.@..@@.@@@.@@@@@...@@@@...@@@@@@@...@@.@@.@...@...@.@@..@@@@@..@@@@@@.@@@.@...@@..@.@.@@@@...@@
|
||||||
|
@@@@@@.@@.@@.@@@.@.@...@@@.@.@@@@@@.@.@@@@.@@@.@.@...@@@@.@@.@.@.@@@@.@@@@..@@@..@@@@.@.@@..@.@@@@@@...@@.@...@.@@@@@@.@.@.@@.@@.@@@@@@@@@.@
|
||||||
|
@@@@@@@@@.@@.@@@@@..@@@@@@..@@@..@@@@@@@@.@..@..@..@@@.@@@@@@@..@@.@@.@@@@@.@@..@@..@.@.@@@@@@@.@@@.@.@@@@..@..@@@@.@@.@@..@@.@..@.@@.@..@.@
|
||||||
|
@@..@@@..@.@@@.@.@@@.@.@@@..@..@.@@.@.@.@.@@@.@@..@@@@@@.@@@@@@@@.@@@.@@.@@.@@@...@..@..@@@@@.@..@@@.@@..@@@@.@@@@..@@.@@@@@@@.@@@@@....@@@@
|
||||||
|
@..@..@..@.@@.@@@@@.@@@.@@.@.@@..@@@@.@@@.@@@@@@.@@@@.@.@@@@.@@.@@@.@@.@.@.@@@.@.@@.@@.@..@@..@...@@..@@@@.@@.@..@.@@.@.@@@@@@@..@.@@.@@.@@.
|
||||||
|
@..@.....@@..@.@.@@.@@@.@@..@@@.@@@.@@@@..@..@..@.@@@@@@.@@@....@@.@.@.@@@@...@@@@@..@@@@@@@.@@@@@..@@..@...@@@.@@@@@@@@@@@@...@@@.@@.@.@@@@
|
||||||
|
@.@@@@@.@@..@@@@@@.@@@...@@.@.@.@.@@@.....@@..@.@@@@@...@.@..@.@.@@...@@@@@@@@.@@@..@@.@@.@..@@.@@@@.@@@.@@.@..@..@.@@@@@@@@@@@@.@.@@@@@@.@.
|
||||||
|
...@@@.@...@@..@@@@...@.@@@@.@.@.@@@@@@@.@..@@@@.@.@.@...@@.@@.@.@.@.@@@@@@.@@.@.@@@@@...@@@@.@@....@.@@@@.@@@..@@.@.@@@@.@@@@@@.@@@@@..@..@
|
||||||
|
.@..@...@..@@@@@..@@@@.@.@..@..@@.@.@.@@@@@@@@@@.@@@@.@.@@@@@@@.@@@.@@@@..@@@@@@.@@@.@.@.@@@@.@.@@@.....@@.@@..@@@@@@...@@@@@@@.@.@@.@@.@..@
|
||||||
|
@@@@..@@@@@@@@@@@@.@@.@..@@.@.@.@@@.@@@@@.@@.@..@..@@@@@.@@@..@...@@@@@@@@@@.@.@.@@@.@@.@.@..@.@.@..@@.@.@@@@@..@.@@.@.@@@@@@@@@@.@@@@.@.@@@
|
||||||
|
|
||||||
|
|
@ -1,50 +1,189 @@
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use crate::utils;
|
use crate::utils;
|
||||||
use std::ops::RangeInclusive;
|
|
||||||
|
|
||||||
pub fn answer(text : String) -> ( u64, u64 ) {
|
pub fn answer(text : String) -> ( u128, u128 ) {
|
||||||
( text.split(",").flat_map(to_range).filter(|x| is_invalid_by(x, 2)).sum()
|
text.trim()
|
||||||
, text.split(",").flat_map(to_range).filter(is_invalid).sum()
|
.split(",")
|
||||||
)
|
.flat_map(Range::from)
|
||||||
|
.map(|range| range.invalid_id_sum())
|
||||||
|
.fold((0, 0), |(x1, y1), (x2, y2)| (x1 + x2, y1 + y2))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_invalid(n : &u64) -> bool {
|
struct Range {
|
||||||
for b in 2..=10 {
|
low : String,
|
||||||
if is_invalid_by(n, b) {
|
high : String,
|
||||||
return true;
|
}
|
||||||
|
impl Range {
|
||||||
|
fn from(s : &str) -> Vec<Range> {
|
||||||
|
let mut ranges : Vec<Range> = Vec::new();
|
||||||
|
|
||||||
|
let (low, high) = match s.split_once("-") {
|
||||||
|
Some(pair) => pair,
|
||||||
|
None => return Vec::new(),
|
||||||
|
};
|
||||||
|
|
||||||
|
// Sanitize input - for AoC, optional
|
||||||
|
if low.len() > high.len() { return Vec::new() }
|
||||||
|
if low.bytes().any(|c| c < b'0' || c > b'9') { return Vec::new() }
|
||||||
|
if high.bytes().any(|c| c < b'0' || c > b'9') { return Vec::new() }
|
||||||
|
|
||||||
|
for size in low.len()..=high.len() {
|
||||||
|
let range = Range::new(
|
||||||
|
if low.len() == size {
|
||||||
|
String::from(low)
|
||||||
|
} else {
|
||||||
|
std::iter::once('1')
|
||||||
|
.chain(std::iter::repeat('0').take(size - 1))
|
||||||
|
.collect()
|
||||||
|
},
|
||||||
|
if high.len() == size {
|
||||||
|
String::from(high)
|
||||||
|
} else {
|
||||||
|
std::iter::repeat('9').take(size).collect()
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
ranges.push(range);
|
||||||
|
}
|
||||||
|
|
||||||
|
ranges
|
||||||
|
}
|
||||||
|
|
||||||
|
fn has_pattern(&self, s : &str) -> bool {
|
||||||
|
assert!(s.len() > 0);
|
||||||
|
assert!(s.len() < self.len());
|
||||||
|
assert_eq!(self.len() % s.len(), 0);
|
||||||
|
|
||||||
|
for (l, c) in self.low.chars().zip(s.chars().cycle()) {
|
||||||
|
if l < c {
|
||||||
|
break;
|
||||||
|
} else if l > c {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
false
|
for (h, c) in self.high.chars().zip(s.chars().cycle()) {
|
||||||
}
|
if c < h {
|
||||||
|
break;
|
||||||
fn is_invalid_by(n : &u64, by : usize) -> bool {
|
} else if c > h {
|
||||||
let s : String = n.to_string();
|
|
||||||
let size : usize = s.len() / by;
|
|
||||||
|
|
||||||
if s.len() % by == 0 {
|
|
||||||
for i in 1..by {
|
|
||||||
if s[0..size] != s[i * size..(i + 1) * size] {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
true
|
true
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn to_range(s : &str) -> RangeInclusive<u64> {
|
fn invalid_id_sum(&self) -> ( u128, u128 ) {
|
||||||
let empty = 1..=0;
|
// Part 1
|
||||||
if let Some((low, high)) = s.split_once("-") {
|
( if self.len() % 2 == 0 {
|
||||||
match ( utils::str_to_u64(low), utils::str_to_u64(high) ) {
|
self.total_of_pattern_size(self.len() / 2)
|
||||||
( Some(l), Some(h) ) =>
|
|
||||||
l..=h,
|
|
||||||
_ =>
|
|
||||||
// Empty iterator
|
|
||||||
empty,
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
empty
|
0
|
||||||
|
}
|
||||||
|
// Part 2
|
||||||
|
, self.pattern_hashmap().values().sum()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn len(&self) -> usize {
|
||||||
|
self.low.len()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new(low : String, high : String) -> Range {
|
||||||
|
// Verify they're the same length
|
||||||
|
assert_eq!(low.len(), high.len());
|
||||||
|
|
||||||
|
// Verify they're all 0-9
|
||||||
|
assert!(low.chars().all(|c| '0' <= c && c <= '9'));
|
||||||
|
assert!(high.chars().all(|c| '0' <= c && c <= '9'));
|
||||||
|
|
||||||
|
// Verify they're in order
|
||||||
|
for (l, h) in low.chars().zip(high.chars()) {
|
||||||
|
assert!(l <= h);
|
||||||
|
|
||||||
|
if l < h {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Range{ low : low, high : high }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a HashMap that counts the number of patterns for each value
|
||||||
|
fn pattern_hashmap(&self) -> HashMap<usize, u128> {
|
||||||
|
let mut h : HashMap<usize, u128> = HashMap::new();
|
||||||
|
|
||||||
|
// Populate the HashMap
|
||||||
|
for size in 1..=(self.len() / 2) {
|
||||||
|
if self.len() % size == 0 {
|
||||||
|
let mut patterns : u128 = self.total_of_pattern_size(size);
|
||||||
|
|
||||||
|
// We'll double count a few patterns.
|
||||||
|
// For example,
|
||||||
|
//
|
||||||
|
// 247247 247247
|
||||||
|
// |------|------|
|
||||||
|
//
|
||||||
|
// this number is a pattern of 6, but it is also a pattern of 3! (lol)
|
||||||
|
// 6-patterns always catch ALL 3-patterns. In fact, all
|
||||||
|
// k-patterns are always caught by n-patterns iff k | n.
|
||||||
|
// Therefore, if we want to accurately count the number of
|
||||||
|
// 6-patterns that AREN'T already counted as 1-patterns,
|
||||||
|
// 2-patterns or 3-patterns, we must subtract our total by
|
||||||
|
// those amounts.
|
||||||
|
for (key, value) in h.iter() {
|
||||||
|
|
||||||
|
if size % key == 0 {
|
||||||
|
patterns -= value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
h.insert(size, patterns);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
h
|
||||||
|
}
|
||||||
|
|
||||||
|
// Count all invalid IDs where the pattern is of a given size.
|
||||||
|
// Then count the numbers of those chunks.
|
||||||
|
// These can then be re-used to count the full value efficiently.
|
||||||
|
fn total_of_pattern_size(&self, size : usize) -> u128 {
|
||||||
|
// 1. Find the range of all patterns of size `size`
|
||||||
|
let inf_str: &str = self.low.get(0..size).unwrap();
|
||||||
|
let sup_str: &str = self.high.get(0..size).unwrap();
|
||||||
|
|
||||||
|
let inf : u128 = if self.has_pattern(inf_str) {
|
||||||
|
utils::str_to_u128(inf_str).unwrap()
|
||||||
|
} else {
|
||||||
|
utils::str_to_u128(inf_str).unwrap() + 1
|
||||||
|
};
|
||||||
|
let sup : u128 = if self.has_pattern(sup_str) {
|
||||||
|
utils::str_to_u128(sup_str).unwrap()
|
||||||
|
} else {
|
||||||
|
utils::str_to_u128(sup_str).unwrap() - 1
|
||||||
|
};
|
||||||
|
|
||||||
|
// No patterns exist!
|
||||||
|
if inf > sup {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Calculate the sum of the pattern snippets
|
||||||
|
let pattern_sum : u128 = ((sup - inf + 1) * (inf + sup)) / 2;
|
||||||
|
|
||||||
|
// 3. Calculate the sum of the patterns when they repeat themselves.
|
||||||
|
// For example:
|
||||||
|
// Step 2 calculated the sum of x = 123 + 124 + 125
|
||||||
|
// Step 3 calculates the sum of
|
||||||
|
// y = 123123123 + 124124124 + 125125125
|
||||||
|
// by realizing that:
|
||||||
|
// y = 1001001 * (123 + 124 + 125) = 100100100 * x
|
||||||
|
// = (10^6 + 10^3 + 10^0) * x
|
||||||
|
let layers : usize = self.len() / size;
|
||||||
|
let factor : u128 = (0..layers).map(|layer| 10u128.pow((size * layer) as u32)).sum();
|
||||||
|
|
||||||
|
factor * pattern_sum
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,119 @@
|
||||||
|
// use crate::utils;
|
||||||
|
use std::collections::{HashMap, HashSet};
|
||||||
|
|
||||||
|
pub fn answer(text : String) -> ( u32, u32 ) {
|
||||||
|
let mut rolls = PaperRolls::from(&text);
|
||||||
|
let part_1 = rolls.remove();
|
||||||
|
|
||||||
|
while rolls.remove() > 0 {};
|
||||||
|
|
||||||
|
( part_1, rolls.rolls_moved )
|
||||||
|
}
|
||||||
|
|
||||||
|
struct PaperRolls {
|
||||||
|
paper : HashMap<( u8, u8 ), u8>,
|
||||||
|
prev_move : Option<Vec<(u8, u8)>>,
|
||||||
|
rolls_moved : u32,
|
||||||
|
}
|
||||||
|
impl PaperRolls {
|
||||||
|
fn remove(&mut self) -> u32 {
|
||||||
|
let to_remove: Vec<(u8, u8)>;
|
||||||
|
|
||||||
|
if let Some(prev_move) = &self.prev_move {
|
||||||
|
// We have already moved before. If we couldn't remove a roll last
|
||||||
|
// time, we won't be able to move it now unless it was a neighbour
|
||||||
|
// of a roll that was moved last turn.
|
||||||
|
let mut items = HashSet::new();
|
||||||
|
|
||||||
|
for (x, y) in prev_move {
|
||||||
|
let x1 = if x == &u8::MIN { u8::MIN } else { x - 1 };
|
||||||
|
let x2 = if x == &u8::MAX { u8::MAX } else { x + 1 };
|
||||||
|
let y1 = if y == &u8::MIN { u8::MIN } else { y - 1 };
|
||||||
|
let y2: u8 = if y == &u8::MAX { u8::MAX } else { y + 1 };
|
||||||
|
|
||||||
|
for nx in x1..=x2 {
|
||||||
|
for ny in y1..=y2 {
|
||||||
|
self.paper
|
||||||
|
.entry((nx, ny))
|
||||||
|
.and_modify(|e| {
|
||||||
|
let x: u8 = *e;
|
||||||
|
if x > 4 {
|
||||||
|
*e -= 1;
|
||||||
|
} else {
|
||||||
|
items.insert((nx, ny));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
to_remove = items.into_iter().collect();
|
||||||
|
} else {
|
||||||
|
// This is (likely) the first time we remove rolls!
|
||||||
|
// Hence, do the less optimized option of finding all rolls
|
||||||
|
// with few neighbours directly in the HashMap.
|
||||||
|
to_remove = self.paper
|
||||||
|
.iter()
|
||||||
|
.filter(|(_, v)| **v < 4)
|
||||||
|
.map(|(k, _)| *k)
|
||||||
|
.collect();
|
||||||
|
}
|
||||||
|
|
||||||
|
for r in &to_remove {
|
||||||
|
self.paper.remove(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
let size: u32 = to_remove.len() as u32;
|
||||||
|
|
||||||
|
self.prev_move = Some(to_remove);
|
||||||
|
self.rolls_moved += size;
|
||||||
|
size
|
||||||
|
}
|
||||||
|
|
||||||
|
fn from(s : &str) -> PaperRolls {
|
||||||
|
let rolls : HashSet<( u8, u8 )> = s
|
||||||
|
.split_whitespace()
|
||||||
|
.enumerate()
|
||||||
|
.flat_map(move |(row, s)|
|
||||||
|
s.chars().enumerate().filter_map(move |(col, c)|
|
||||||
|
if c == '@' { Some(( col as u8, row as u8 )) } else { None }
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
|
||||||
|
PaperRolls {
|
||||||
|
paper: rolls
|
||||||
|
.iter()
|
||||||
|
.map(|(x, y)|
|
||||||
|
((*x, *y), count_neighbours(&rolls, x, y))
|
||||||
|
)
|
||||||
|
.collect(),
|
||||||
|
prev_move : None,
|
||||||
|
rolls_moved: 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn count_neighbours(rolls : &HashSet<(u8, u8)>, x : &u8, y : &u8) -> u8 {
|
||||||
|
let x1 : u8 = if x == &u8::MIN { u8::MIN } else { x - 1 };
|
||||||
|
let x2 : u8 = if x == &u8::MAX { u8::MAX } else { x + 1 };
|
||||||
|
let y1 : u8 = if y == &u8::MIN { u8::MIN } else { y - 1 };
|
||||||
|
let y2 : u8 = if y == &u8::MAX { u8::MAX } else { y + 1 };
|
||||||
|
|
||||||
|
let mut total = 0;
|
||||||
|
|
||||||
|
for nx in x1..=x2 {
|
||||||
|
for ny in y1..=y2 {
|
||||||
|
if x == &nx && y == &ny {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if rolls.contains(&(nx, ny)) {
|
||||||
|
total += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
total
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
mod day_01;
|
mod day_01;
|
||||||
mod day_02;
|
mod day_02;
|
||||||
mod day_03;
|
mod day_03;
|
||||||
// mod day_04;
|
mod day_04;
|
||||||
// mod day_05;
|
// mod day_05;
|
||||||
// mod day_06;
|
// mod day_06;
|
||||||
// mod day_07;
|
// mod day_07;
|
||||||
|
|
@ -40,12 +40,12 @@ pub fn day_03() -> DailyOutput {
|
||||||
( p1 as u128, p2 as u128, d )
|
( p1 as u128, p2 as u128, d )
|
||||||
}
|
}
|
||||||
|
|
||||||
// pub fn day_04() -> DailyOutput {
|
pub fn day_04() -> DailyOutput {
|
||||||
// let s : String = read_from_file("inputs/04.txt");
|
let s : String = read_from_file("inputs/04.txt");
|
||||||
// let (p1, p2, d) = diagnostics::benchmark(s, day_04::answer);
|
let (p1, p2, d) = diagnostics::benchmark(s, day_04::answer);
|
||||||
|
|
||||||
// ( p1 as u128, p2 as u128, d )
|
( p1 as u128, p2 as u128, d )
|
||||||
// }
|
}
|
||||||
|
|
||||||
// pub fn day_05() -> DailyOutput {
|
// pub fn day_05() -> DailyOutput {
|
||||||
// let s : String = read_from_file("inputs/05.txt");
|
// let s : String = read_from_file("inputs/05.txt");
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,9 @@ fn main() {
|
||||||
|
|
||||||
match day {
|
match day {
|
||||||
Some(1) => run_day(aoc2025::day_01),
|
Some(1) => run_day(aoc2025::day_01),
|
||||||
// Some(2) => run_day(aoc2025::day_02),
|
Some(2) => run_day(aoc2025::day_02),
|
||||||
// Some(3) => run_day(aoc2025::day_03),
|
Some(3) => run_day(aoc2025::day_03),
|
||||||
// Some(4) => run_day(aoc2025::day_04),
|
Some(4) => run_day(aoc2025::day_04),
|
||||||
// Some(5) => run_day(aoc2025::day_05),
|
// Some(5) => run_day(aoc2025::day_05),
|
||||||
// Some(6) => run_day(aoc2025::day_06),
|
// Some(6) => run_day(aoc2025::day_06),
|
||||||
// Some(7) => run_day(aoc2025::day_07),
|
// Some(7) => run_day(aoc2025::day_07),
|
||||||
|
|
@ -31,7 +31,7 @@ fn run_all_days() {
|
||||||
aoc.insert(1, aoc2025::day_01());
|
aoc.insert(1, aoc2025::day_01());
|
||||||
aoc.insert(2, aoc2025::day_02());
|
aoc.insert(2, aoc2025::day_02());
|
||||||
aoc.insert(3, aoc2025::day_03());
|
aoc.insert(3, aoc2025::day_03());
|
||||||
// aoc.insert(4, aoc2025::day_04());
|
aoc.insert(4, aoc2025::day_04());
|
||||||
// aoc.insert(5, aoc2025::day_05());
|
// aoc.insert(5, aoc2025::day_05());
|
||||||
// aoc.insert(6, aoc2025::day_06());
|
// aoc.insert(6, aoc2025::day_06());
|
||||||
// aoc.insert(7, aoc2025::day_07());
|
// aoc.insert(7, aoc2025::day_07());
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ use std::fs;
|
||||||
|
|
||||||
pub mod diagnostics;
|
pub mod diagnostics;
|
||||||
|
|
||||||
pub fn char_to_u8(s : char) -> Option<u8> {
|
pub fn char_to_u8(c : char) -> Option<u8> {
|
||||||
s.to_string().parse::<u8>().ok()
|
c.to_digit(10).and_then(|n| u8::try_from(n).ok())
|
||||||
}
|
}
|
||||||
|
|
||||||
// pub fn char_to_u64(s : char) -> Option<u64> {
|
// pub fn char_to_u64(s : char) -> Option<u64> {
|
||||||
|
|
@ -40,6 +40,10 @@ pub fn str_to_i16(s : &str) -> Option<i16> {
|
||||||
// s.trim().to_string().parse::<u32>().ok()
|
// s.trim().to_string().parse::<u32>().ok()
|
||||||
// }
|
// }
|
||||||
|
|
||||||
pub fn str_to_u64(s : &str) -> Option<u64> {
|
// pub fn str_to_u64(s : &str) -> Option<u64> {
|
||||||
s.trim().to_string().parse::<u64>().ok()
|
// s.trim().to_string().parse::<u64>().ok()
|
||||||
|
// }
|
||||||
|
|
||||||
|
pub fn str_to_u128(s : &str) -> Option<u128> {
|
||||||
|
s.trim().to_string().parse::<u128>().ok()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue