day12, part1
This commit is contained in:
@@ -6,3 +6,89 @@ i take length of the mask, that's max size
|
||||
then for each step, either put . or put n # from the input.
|
||||
|
||||
add to current string, and do 2 recursive calls, one with diminished 'queue', one with same
|
||||
* wrong answer on input
|
||||
it's too high
|
||||
|
||||
and log shows:
|
||||
|
||||
2023/12/12 15:07:52 for line ???#?.?#?#.?#???#..? blocks [4 4 5 1] matches 2
|
||||
|
||||
and it should be 0
|
||||
** huh, nope this looks good:
|
||||
testMask := "???#?.?#?#.?#???#..?"
|
||||
testBlocks := []int{4,4,5,1}
|
||||
testVariants := generatePermutations("", len(testMask), testBlocks, 14, testMask)
|
||||
fmt.Printf("for mask %s and blocks %+v\n", testMask, testBlocks)
|
||||
fmt.Println(testVariants)
|
||||
|
||||
for mask ???#?.?#?#.?#???#..? and blocks [4 4 5 1]
|
||||
[####..####..#####..# .####.####..#####..#]
|
||||
** let's check this : for line ??????#???????? blocks [7 2] matches 21
|
||||
** or this for line ?????.??#????? blocks [3 3 2 1] matches 3
|
||||
looks ok
|
||||
** this for line ??..??#?????#?##? blocks [1 1 1 1 4] matches 15
|
||||
looks good
|
||||
** for line ?#??#??#???.??.??.? blocks [1 2 3 1 1 1] matches 20
|
||||
seems ok
|
||||
** for line ???????#??.????####? blocks [1 1 1 1 1 6] matches 58
|
||||
bingo?
|
||||
|
||||
for mask ???????#??.????####? and blocks [1 1 1 1 1 6]
|
||||
#.#.#..#.#.######...
|
||||
#.#.#..#.#..######..
|
||||
#.#.#..#.#...######.
|
||||
#.#.#..#.#....######
|
||||
#.#.#..#...#.######.
|
||||
#.#.#..#...#..######
|
||||
#.#.#..#....#.######
|
||||
#.#..#.#.#.######...
|
||||
#.#..#.#.#..######..
|
||||
#.#..#.#.#...######.
|
||||
#.#..#.#.#....######
|
||||
#.#..#.#...#.######.
|
||||
#.#..#.#...#..######
|
||||
#.#..#.#....#.######
|
||||
#.#....#.#.#.######.
|
||||
#.#....#.#.#..######
|
||||
#.#....#.#..#.######
|
||||
#..#.#.#.#.######...
|
||||
#..#.#.#.#..######..
|
||||
#..#.#.#.#...######.
|
||||
#..#.#.#.#....######
|
||||
#..#.#.#...#.######.
|
||||
#..#.#.#...#..######
|
||||
#..#.#.#....#.######
|
||||
#..#...#.#.#.######.
|
||||
#..#...#.#.#..######
|
||||
#..#...#.#..#.######
|
||||
#...#..#.#.#.######.
|
||||
#...#..#.#.#..######
|
||||
#...#..#.#..#.######
|
||||
#....#.#.#.#.######.
|
||||
#....#.#.#.#..######
|
||||
#....#.#.#..#.######
|
||||
.#.#.#.#.#.######...
|
||||
.#.#.#.#.#..######..
|
||||
.#.#.#.#.#...######.
|
||||
.#.#.#.#.#....######
|
||||
.#.#.#.#...#.######.
|
||||
.#.#.#.#...#..######
|
||||
.#.#.#.#....#.######
|
||||
.#.#...#.#.#.######.
|
||||
.#.#...#.#.#..######
|
||||
.#.#...#.#..#.######
|
||||
.#..#..#.#.#.######.
|
||||
.#..#..#.#.#..######
|
||||
.#..#..#.#..#.######
|
||||
.#...#.#.#.#.######.
|
||||
.#...#.#.#.#..######
|
||||
.#...#.#.#..#.######
|
||||
..#.#..#.#.#.######.
|
||||
..#.#..#.#.#..######
|
||||
..#.#..#.#..#.######
|
||||
..#..#.#.#.#.######.
|
||||
..#..#.#.#.#..######
|
||||
..#..#.#.#..#.######
|
||||
...#.#.#.#.#.######.
|
||||
...#.#.#.#.#..######
|
||||
...#.#.#.#..#.######
|
||||
|
||||
Reference in New Issue
Block a user