@@ -75,7 +75,19 @@ L.#.L..#..
75
75
#.#L#L#.##`
76
76
)
77
77
78
- const testDataPart2 = testData . slice ( 0 , 2 )
78
+ const testDataPart2 = [ testData [ 0 ] ]
79
+ testDataPart2 . push (
80
+ `#.##.##.##
81
+ #######.##
82
+ #.#.#..#..
83
+ ####.##.##
84
+ #.##.##.##
85
+ #.#####.##
86
+ ..#.#.....
87
+ ##########
88
+ #.######.#
89
+ #.#####.##`
90
+ )
79
91
testDataPart2 . push (
80
92
`#.LL.LL.L#
81
93
#LLLLLL.LL
@@ -171,14 +183,14 @@ describe('--- Day 11: Seating System ---', () => {
171
183
.........
172
184
#........
173
185
...#.....`
174
- expect ( occupiedLineOfSite ( { x : 1 , y : 1 , seatMap : data } ) ) . to . equal ( 8 )
186
+ expect ( occupiedLineOfSite ( { x : 3 , y : 4 , seatMap : parse ( data ) } ) ) . to . equal ( 8 )
175
187
} )
176
188
it ( 'cannot see occupied seats past an available seat' , ( ) => {
177
189
const data =
178
190
`.............
179
191
.L.L.#.#.#.#.
180
192
.............`
181
- expect ( occupiedLineOfSite ( { x : 3 , y : 4 , seatMap : data } ) ) . to . equal ( 0 )
193
+ expect ( occupiedLineOfSite ( { x : 1 , y : 1 , seatMap : parse ( data ) } ) ) . to . equal ( 0 )
182
194
} )
183
195
it ( 'can look in all compass directions' , ( ) => {
184
196
const data =
@@ -189,21 +201,22 @@ describe('--- Day 11: Seating System ---', () => {
189
201
##...##
190
202
#.#.#.#
191
203
.##.##.`
192
- expect ( occupiedLineOfSite ( { x : 3 , y : 3 , seatMap : data } ) ) . to . equal ( 0 )
204
+ expect ( occupiedLineOfSite ( { x : 3 , y : 3 , seatMap : parse ( data ) } ) ) . to . equal ( 0 )
193
205
} )
194
206
} )
195
207
describe ( 'advance()' , ( ) => {
196
208
it ( 'accepts visibility rules instead of proximity' , ( ) => {
197
209
const results = testDataPart2 . map ( ( data ) => {
198
210
return format (
199
211
advance (
200
- parse ( data ) , 'visible '
212
+ parse ( data ) , 'visibility '
201
213
)
202
214
)
203
215
} )
204
216
205
217
for ( let x = 1 ; x < testDataPart2 . length ; x ++ ) {
206
218
console . debug ( 'Step' , x )
219
+ console . debug ( results [ x - 1 ] )
207
220
expect ( results [ x - 1 ] ) . to . equal ( testDataPart2 [ x ] )
208
221
}
209
222
const finalOccupancy = ( results [ results . length - 1 ] . match ( / # / g) || [ ] ) . length
0 commit comments