File tree Expand file tree Collapse file tree 2 files changed +119
-0
lines changed Expand file tree Collapse file tree 2 files changed +119
-0
lines changed Original file line number Diff line number Diff line change 1+ import { cardShuffle , parseActions } from './cardshuffle'
2+ import * as fs from 'fs'
3+ import * as path from 'path'
4+
5+ const actions = fs . readFileSync (
6+ path . resolve ( process . cwd ( ) , 'day22/input.txt' ) ,
7+ 'utf-8' ,
8+ )
9+
10+ describe ( 'Day 21: Part 1' , ( ) => {
11+ it ( 'should solve the puzzle' , async ( ) => {
12+ const deck = [ ]
13+ for ( let i = 0 ; i < 10007 ; i ++ ) {
14+ deck . push ( i )
15+ }
16+ const shuffled = cardShuffle ( parseActions ( actions ) ) ( deck )
17+ expect ( shuffled . indexOf ( 2019 ) ) . toEqual ( 3749 )
18+ } )
19+ } )
Original file line number Diff line number Diff line change 1+ cut 578
2+ deal with increment 25
3+ cut -3085
4+ deal with increment 16
5+ cut -6620
6+ deal with increment 17
7+ cut -1305
8+ deal with increment 71
9+ cut -4578
10+ deal with increment 44
11+ cut 5639
12+ deal with increment 74
13+ deal into new stack
14+ deal with increment 39
15+ cut 7888
16+ deal with increment 17
17+ deal into new stack
18+ cut 6512
19+ deal with increment 46
20+ cut -8989
21+ deal with increment 46
22+ cut -8518
23+ deal with increment 75
24+ cut -870
25+ deal into new stack
26+ deal with increment 53
27+ cut 7377
28+ deal with increment 60
29+ cut -4733
30+ deal with increment 25
31+ cut -6914
32+ deal with increment 23
33+ cut -4379
34+ deal into new stack
35+ cut 582
36+ deal with increment 35
37+ cut 9853
38+ deal with increment 2
39+ cut -142
40+ deal with increment 74
41+ cut 328
42+ deal into new stack
43+ deal with increment 75
44+ deal into new stack
45+ cut -8439
46+ deal into new stack
47+ deal with increment 34
48+ cut 2121
49+ deal with increment 2
50+ cut 8335
51+ deal with increment 65
52+ cut -1254
53+ deal into new stack
54+ cut -122
55+ deal with increment 75
56+ cut -9227
57+ deal into new stack
58+ deal with increment 24
59+ cut 3976
60+ deal into new stack
61+ deal with increment 8
62+ cut -3292
63+ deal with increment 4
64+ deal into new stack
65+ cut -8851
66+ deal with increment 2
67+ deal into new stack
68+ cut 4333
69+ deal with increment 73
70+ deal into new stack
71+ deal with increment 9
72+ cut -7880
73+ deal with increment 49
74+ cut 9770
75+ deal with increment 30
76+ cut 2701
77+ deal with increment 59
78+ cut 4292
79+ deal with increment 37
80+ deal into new stack
81+ cut -184
82+ deal with increment 25
83+ cut 9907
84+ deal with increment 46
85+ deal into new stack
86+ cut 902
87+ deal with increment 46
88+ cut 2622
89+ deal into new stack
90+ cut 637
91+ deal with increment 58
92+ cut 7354
93+ deal with increment 69
94+ deal into new stack
95+ deal with increment 49
96+ deal into new stack
97+ deal with increment 19
98+ cut -8342
99+ deal with increment 68
100+ deal into new stack
You can’t perform that action at this time.
0 commit comments