Skip to content

Commit bff8f23

Browse files
committed
day 9 rockstar
1 parent 85bc774 commit bff8f23

File tree

3 files changed

+201
-1
lines changed

3 files changed

+201
-1
lines changed

9/9.rock

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
listen to data
2+
3+
solve takes part2
4+
x = 0
5+
while x < 10
6+
rock gaps at x
7+
build x up
8+
end
9+
pos = 0
10+
b_id = 0
11+
burn data
12+
for size and idx in data
13+
size = size - 48
14+
if size
15+
if idx at 0 = 0
16+
if part2
17+
cur = pos
18+
rock cur with b_id, size
19+
rock blocks with cur
20+
else
21+
x = 0
22+
while x < size
23+
cur = pos + x
24+
rock cur with b_id, 1
25+
rock blocks with cur
26+
build x up
27+
end
28+
end
29+
build b_id up
30+
else
31+
if part2
32+
rock pos into gaps at size
33+
else
34+
x = 0
35+
while x < size
36+
cur = pos + x
37+
rock gaps at 1 cur
38+
build x up
39+
end
40+
end
41+
end
42+
end
43+
pos = pos+size
44+
end
45+
checksum = 0
46+
b = blocks / 1
47+
while b
48+
knock b down
49+
block = blocks at b
50+
bpos = block at 0
51+
bid = block at 1
52+
bsize = block at 2
53+
bestpos = bpos
54+
gpos = 999999
55+
glen = 0
56+
for curgaps and x in gaps
57+
curgaps = gaps at x
58+
if curgaps != 0 and x >= bsize
59+
if curgaps at 0 < gpos
60+
gpos = curgaps at 0
61+
glen = x
62+
end
63+
end
64+
end
65+
if glen
66+
if gpos < bpos
67+
bestpos = gpos
68+
temp = gaps at glen
69+
roll temp
70+
if part2
71+
cur = glen - bsize
72+
old = gaps at cur
73+
val = gpos + bsize
74+
cut "" into new
75+
prev = 0
76+
for item in old
77+
if prev <= val and val < item
78+
rock new val
79+
end
80+
rock new item
81+
prev = item
82+
end
83+
gaps at cur = new
84+
end
85+
end
86+
blocks at b at 0 = bestpos
87+
end
88+
additional = 2*bestpos + bsize - 1
89+
additional = additional * bid * bsize
90+
additional = additional / 2
91+
turn it down
92+
checksum = checksum + additional
93+
end
94+
end
95+
96+
say solve taking 0
97+
say solve taking 1

9/9_lyrics.rock

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
Listen to the night
2+
Cast it into the flames
3+
The night is devastated
4+
The fire takes the darkness
5+
Put the night into the tide
6+
Until it is like a fire-storm
7+
Rock the ocean at the tide
8+
Build the tide up
9+
10+
Put the night into the flame
11+
Flooding is unstoppable
12+
The drops are now flooding without it
13+
Control is soon erupting
14+
For every spark and shadow in the flames
15+
The spark is without control
16+
If it isn't nowhere
17+
Put the night into the water
18+
If the shadow at the night is silent
19+
If the darkness is nowhere
20+
While the water is weaker than the spark
21+
Put the flame with the water into battle
22+
Rock it with the drops, flooding
23+
Rock the waves with battle
24+
Build the water up
25+
26+
Otherwise
27+
Put the flame into power
28+
Rock it with the drops, the spark
29+
Rock the waves with power
30+
31+
Build the drops up
32+
Otherwise
33+
If the darkness is nowhere
34+
While the water is weaker than the spark
35+
Put the flame with the water into battle
36+
Rock the ocean at flooding battle
37+
Build the water up
38+
39+
Otherwise
40+
Rock the flame into the ocean at the spark
41+
42+
43+
44+
The flame is with the spark
45+
46+
Put nobody into the battle
47+
Let the storm be the waves over flooding
48+
Until the storm is gone
49+
Knock the storm down
50+
Put the waves at the storm into fire
51+
Roll fire into the sea
52+
Roll fire into the blaze
53+
Roll fire into the tide
54+
The fight is flaming hot
55+
Cast it into the fog
56+
The light is gone
57+
For the current and shadows in the ocean
58+
If the current isnt gone and shadows are as strong as the tide
59+
If the current at the night is weaker than the fog
60+
Let the fog be the current at the night
61+
Put shadows into the light
62+
63+
64+
65+
If the light is right
66+
If the fog is weaker than the sea
67+
Put the fog into the sea
68+
Rage is now the ocean at the light
69+
Roll it into tornadoes
70+
If the darkness isn't gone
71+
The light is without the tide
72+
Let the surge be the ocean at the light
73+
The fog is with the tide
74+
Shatter silence into sparks
75+
The flames are so consuming
76+
The flames are of the night
77+
For every wave in the surge
78+
If the fog is as strong as the flames
79+
If the wave is stronger than the fog
80+
Rock sparks with the fog
81+
82+
83+
Push sparks with the wave
84+
Put the wave into the flames
85+
86+
Put sparks into the ocean at the light
87+
88+
89+
The waves at the storm at the night are the sea
90+
91+
Put the sea into inferno
92+
It is with the tide without flooding with the sea
93+
It is of the blaze of the tide
94+
Powers are destructions
95+
Inferno is between powers
96+
Turn it down
97+
The battle is with inferno
98+
99+
100+
101+
Shout the fire taking the tide
102+
Shout the fire taking the tide

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,5 @@ For this year's rockstar solutions, I will be publishing AI generated songs base
3333
- [Day 5](https://youtu.be/TkAg9HrpGWc)
3434
- [Day 6](https://youtu.be/goFwjuJg8qI)
3535
- [Day 7](https://youtu.be/o-HCagXnqc8)
36-
- [Day 8](https://youtu.be/ZbV8wVI0bKU)
36+
- [Day 8](https://youtu.be/ZbV8wVI0bKU)
37+
- [Day 9](https://youtu.be/bpxZd4WatWU)

0 commit comments

Comments
 (0)