Puzzle #12
Labyrinth
Author
HuffHuff's logo.Puzzle
Curtacallsverify()
1
/// ╦ ╔═╗╔╗ ╦ ╦╦═╗╦╔╗╔╔╦╗╦ ╦
2
/// ║ ╠═╣╠╩╗╚╦╝╠╦╝║║║║ ║ ╠═╣
3
/// ╩═╝╩ ╩╚═╝ ╩ ╩╚═╩╝╚╝ ╩ ╩ ╩
4
/// ██████████████████████████████████████████████████████████████
5
/// "The labyrinth is a living symbol in our world, in our cult ██
6
/// █████████████████████████████████████████████████████████ u ██
7
/// ██ the meandering journey of our life path, of pilgr ██ r ██
8
/// ██ f ███████████████████████████████████████████████ i ██ e ██
9
/// ██ o ██ ██ m ██ , ██
10
/// ██ ██ █████████████████████████████████████ ██ a ██ ██
11
/// ██ , ██ ██ ██ ██ g ██ a ██
12
/// ██ h ██ ██ ███████████████████████████ ██ ██ e ██ n ██
13
/// ██ t ██ ██ ██ ██ ██ ██ , ██ d ██
14
/// ██ r ██ ██ ██ █████████████████ ██ ██ ██ ██ ██
15
/// ██ i ██ ██ ██ ██ ██ ██ ██ ██ o ██ i ██
16
/// ██ b ██ ██ ██ ██ ███████ ██ ██ ██ ██ f ██ n ██
17
/// ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
18
/// ██ f ██ ██ ██ ██ ██ ██ ██ ██ ██ t ██ o ██
19
/// ██ o ██ ██ ██ ██ ████████████ ██ ██ ██ r ██ u ██
20
/// ██ ██ ██ ██ ██ ██ ██ ██ a ██ r ██
21
/// ██ , ██ ██ ██ ██████████████████████ ██ ██ n ██ ██
22
/// ██ e ██ ██ ██ ██ ██ s ██ m ██
23
/// ██ g ██ ██ ████████████████████████████████ ██ f ██ i ██
24
/// ██ a ██ ██ ██ o ██ n ██
25
/// ██ i ██ ██████████████████████████████████████████ r ██ d ██
26
/// ██ r ██ nreK nnamreH - ".emit fo dna ,noitam ██ s ██
27
/// ██ r ████████████████████████████████████████████████████ . ██
28
/// ██ am fo ,somsoc eht fo ,htaed dna efil fo lobmys a si tI ██
29
/// ██████████████████████████████████████████████████████████████
30
31
/// @title Labyrinth
32
/// @author https://github.com/kadenzipfel
33
/// @dev lost?
34
35
/// @notice Returns the puzzle's name.
36
#define function name() view returns (string memory)
37
/// @notice Generates the puzzle's starting position based on a seed.
38
#define function generate(address _seed) view returns (uint256)
39
/// @notice Verifies that a solution is valid for the puzzle.
40
#define function verify(uint256 _start, uint256 _solution) nonpayable returns (bool)
41
42
/// name()
43
#define macro NAME() = takes (0) returns (0) {
44
0x20 push0 mstore
45
0x4c61627972696e7468
46
0x29 mstore
47
0x09 0x20 mstore
48
0x60 push0 return
49
}
50
51
/// generate(address _seed)
52
#define macro GENERATE() = takes (0) returns (0) {
53
0x04 calldataload
54
push0 mstore
55
number 0x20 mstore
56
0x40 push0 sha3
57
push0 mstore
58
0x20 push0 return
59
}
60
61
/// verify(uint256 _start, uint256 _solution)
62
#define macro VERIFY() = takes (0) returns (0) {
63
0x04 calldataload
64
0x24 calldataload
65
push0 push0
66
a jump
67
68
/// Lost in the annals of time, an enigmatic labyrinth waits, its character as mutable as the
69
/// river's course. Among its winding passages, a rhythm beats, like the steady tick-tock of a
70
/// grand cosmic clock. Beneath the labyrinth's complex facade, choices become consequences, and
71
/// barriers become opportunities. Yet, deep within its belly, a treasure lies, protected by the
72
/// formidable Minotaur. Rules in this mystical realm, they whisper, are a dance of duality, a
73
/// journey into the twilight zone of decision-making. Into this realm of twos, you must step with
74
/// wisdom and courage. Navigate wisely, for every choice, every twist and turn could bring you
75
/// closer to the heart of the labyrinth. Triumph awaits those who can decipher the labyrinth's
76
/// song and dance to its cryptic tune. Herein lies the ultimate challenge, only the cunning and
77
/// the brave will emerge victorious.
78
f3: 0x01 p1 jump /******/ /******/ o: y1 jumpi u1 /******/ jump w2: /******/ /******/
79
dup1 b jump o2: /******/ /******/ push0 q1 jump w: /******/ j jumpi /******/ /******/
80
s2 jump a1: /******/ /******/ addmod i1 jump /******/ v1: j /******/ /******/
81
82
/******/ jumpi h2 /******/ jump i: 0x02 b2 /******/ jump n: /******/ mstore g jump x1:
83
/******/ dup1 p2 /******/ jump b1: dup3 o1 /******/ jump p1: /******/ push0 n jump y:
84
/******/ add e1 /******/ jump u2: swap2 s1 /******/ jump e1: /******/ swap1 g2 jump q1:
85
86
return f1: 0x01 /******/ m2 jump /******/ n1: 0x10 /******/ v2 jump /******/ /******/
87
e2: dup4 b3 jump /******/ r1: /******/ swap4 d3 /******/ jump b2: /******/ /******/
88
eq a2 jump m2: /******/ add m1 /******/ jump p2: /******/ 0x01 z2 /******/ /******/
89
90
/******/ jump b: 0x03 h1 /******/ jump m1: /******/ swap2 k2 jump e3: /******/ /******/
91
/******/ return v2: dup4 /******/ c3 jump /******/ d1: mul t jump /******/ /******/
92
/******/ o1: 0xff d jump /******/ w1: lt h /******/ jump g1: dup4 c1 /******/ /******/
93
94
jump t1: /******/ and m jump j: /******/ /******/ 0x20 s jump j1: /******/ q jumpi
95
x1 jump /******/ t:shr k jump h1: /******/ /******/ eq l1 jump u1: /******/ dup1 i
96
jump k2: /******/ n2 jump s1: n2 /******/ /******/ jump c3: mod u /******/ jump z:
97
98
/******/ sub u2 jump i2: /******/ and r jump y2: /******/ swap1 r2 /******/ /******/
99
/******/ jump q2: dup2 d2 /******/ jump x2: swap2 g3 /******/ jump d3: /******/ /******/
100
/******/ lt l jump e: /******/ add v jump z1: /******/ f3 jumpi /******/ /******/
101
102
/******/ y2 jump /******/ r: j /******/ jumpi b1 /******/ jump d: /******/ eq z1
103
/******/ jump u: /******/ iszero /******/ v1 jump /******/ b3: shr /******/ c jump
104
/******/ k1: /******/ iszero /******/ j1 jump /******/ g: 0x20 /******/ o2 jump
105
106
/******/ q: 0x10 q2 jump /******/ g2: pop /******/ j2 jump /******/ i1: /******/
107
/******/ iszero w jump c1: /******/ 0x01 a1 /******/ jump f: /******/ 0x02 d1 /******/
108
/******/ jump v: dup1 t2 /******/ jump g3: /******/ 0x10 e /******/ jump l: /******/
109
110
j jumpi /******/ l2 jump f2: /******/ swap2 p /******/ jump a2: /******/ /******/
111
n1 jumpi /******/ w2 jump a3: dup1 /******/ r1 jump /******/ t2: 0xff /******/ /******/
112
w1 jump /******/ a: dup3 c2 jump /******/ j2: a /******/ jump x: /******/ /******/
113
114
0x01 z jump y1: /******/ 0x10 g1 jump r2: 0x01 y /******/ jump c: /******/ /******/
115
0x01 i2 jump z2: /******/ eq o jump m: dup1 k1 /******/ jump h: /******/ /******/
116
j jumpi f2 jump /******/ h2: swap2 x jump n2: /******/ dup5 e2 /******/ /******/
117
118
/******/ /******/ /******/ /******/ /******/ jump k: 0x03 t1 jump l2: n2 jump c2: dup2
119
/******/ /******/ /******/ /******/ /******/ f jump p: n2 jump s: push0 e3 jump d2:
120
/******/ /******/ /******/ /******/ /******/ sub a3 jump s2: swap2 f1 jump l1: x2 jumpi
121
}
122
123
#define macro MAIN() = takes (0) returns (0) {
124
push0 calldataload 0xe0 shr
125
dup1 0x06fdde03 eq name jumpi
126
dup1 0x2fa61cd8 eq generate jumpi
127
dup1 0x41161b10 eq verify jumpi
128
129
push0 push0 revert
130
131
name:
132
NAME()
133
generate:
134
GENERATE()
135
verify:
136
VERIFY()
137
}
138
First Blood
minimooger.eth
04:48:24
17
Time Left

Solve locally (WIP)

  1. Clone GitHub repo + install deps
git clone https://github.com/waterfall-mkt/curta-puzzles.git && cd curta-puzzles && forge install
  1. Set RPC_URL_MAINNET in .env
.env
RPC_URL_MAINNET=""
  1. Write solution + run script
forge script <PATH_TO_PUZZLE> -f mainnet -vvv
This is still WIP.
Waterfall