This is not claimed to be an optimized walkthrough, but it comes reasonably close and, if you don't get killed by a little dwarf and if the pirate shows up before you finish, you can get all the points.

When you get well into the cave you will encounter some nasty dwarves. The first one simply tosses an axe at you and runs away. The axe misses. Get the axe; you'll need it when you see the dwarves again. On your second encounter with the dwarves, you'll see one or more, who will throw knives at you. The first salvo always misses. Toss the axe at a dwarf, fetch it again, and keep tossing until you have killed all the dwarves present. You'll need to do this each time a dwarf appears. If you don't, you'll get killed. (Be sure to retrieve the axe after you have killed the last dwarf that is with you.)

Don't worry if a pirate appears and steals your treasures from you.
You'll find them again later on.

Walkthrough: Answer "no" when you are asked if you want instructions.

You are standing in front of a building. Enter the commands as listed below (first column only; the second column shows what the command does or where it takes you), except deal with dwarves whenever they appear.

1. in inside building
2. get lamp
3. on turn on lamp
4. plugh y2
5. plover plover room
6. ne dark room
7. get pyramid
8. s plover room
9. plover y2
10. s low n/s passage
11. get silver
12. n y2
13. plugh inside building
14. drop pyramid
15. drop silver
16. get water in bottle
17. plugh y2
18. s low n/s passage
19. d dirty passage
20. bedquilt bedquilt
21. slab slab room
22. s west end of twopit room
23. d west pit
24. water plant
25. u west end of twopit room
26. w slab room
27. u secret n/s canyon
28. reservoir reservoir
29. get water
30. s mirror canyon
31. s secret n/s canyon
32. d slab room
33. s west end of twopit room
34. d west pit
35. water plant
36. u west end of twopit room
37. e east end of twopit room
38. d east pit
39. get oil
40. u east end of twopit room
41. w west end of twopit room
42. d west pit
43. climb narrow corridor
44. w giant room
45. n immense n/s passage (iron door)
46. oil door
47. drop bottle you no longer need it
48. n waterfall cavern
49. get trident
50. w steep incline
51. d large low room
52. se oriental room
53. n misty cavern
54. w alcove
55. drop trident to get through narrow passage
56. drop lamp
57. drop axe (if carrying it)
58. e plover room
59. get emerald
60. w alcove
61. get trident
62. get lamp
63. get axe (if here)
64. nw misty cavern
65. s oriental room
66. get vase
67. se swiss cheese
68. e soft room
69. get pillow needed for vase
70. w swiss cheese
71. ne bedquilt
72. e complex junction
73. n shell room
74. open clam with trident
75. d well, it will roll down, won't it?
76. d
77. get pearl
78. u
79. u shell room
80. s complex junction
81. u dusty rock room
82. e dirty passage
83. u low n/s
84. n y2
85. plugh inside building
86. drop pillow pillow first, then vase
87. drop vase
88. drop trident
89. drop pearl
90. drop emerald
91. xyzzy debris room
92. get rod
93. e cobble crawl
94. get cage
95. pit top of small pit
96. e bird chamber
97. drop rod rod scares bird
98. get bird
99. get rod
100. w top of small pit
101. d hall of mists
102. n hall of mt king
103. free bird bird drives away snake
104. drop cage no longer needed
105. sw secret e/w canyon
106. w secret canyon
107. kill dragon no weapon needed
108. yes yes, with bare hands
109. get rug
110. e secret e/w canyon
111. e hall of mt king
112. w west side chamber
113. get coins
114. e hall of mt king
115. s south side chamber
116. get jewelry
117. n hall of mt king
118. e hall of mists
119. w east bank of fissure
120. wave rod create bridge
121. drop rod no longer needed
122. w west bank of fissure
123. get diamonds
124. e east bank of fissure
125. e hall of mists
126. s nugget room
127. get gold
128. n hall of mists
129. y2 rock jumble (not y2)
130. d y2
131. plugh inside building
132. drop rug
133. drop coins
134. drop jewelry
135. drop diamonds
136. drop gold
137. get food for bear
138. get keys for locked chain
139. plugh y2
140. s low n/s
141. d dirty passage
142. bedquilt bedquilt
143. w swiss cheese
144. w east end of twopit room
145. w west end of twopit room
146. d west pit
147. climb narrow corridor
148. w giant room
149. get eggs for troll
150. n immense n/s
151. n waterfall cavern
152. w steep incline
153. d large low room
154. sw sloping corridor
155. u s/w side of chasm
156. toss eggs pay troll
157. ne n/e side of chasm
158. ne corridor
159. barren outside barren room
160. in bear in room
161. feed bear calm him a little
162. unlock chain with key, of course
163. get chain
164. get bear to scare troll
165. w outside barren room
166. fork fork in path
167. ne warm walls
168. e boulders
169. get spices
170. fork fork in path
171. w corridor
172. w n/e side of chasm
173. sw troll appears again
174. free bear scare off troll
175. sw s/w side of chasm
176. sw sloping corridor
177. d large low room
178. se oriental room
179. se swiss cheese
180. w east end of twopit room
181. w west end of twopit room
182. d west pit
183. climb narrow corridor
184. w giant room
185. fee
186. fie
187. foe
188. foo that's what it says
189. get eggs magic
190. s narrow corridor
191. d west pit
192. u west end of twopit room
193. w slab room
194. u secret n/s
195. s secret canyon
196. e secret e/w canyon
197. e hall of mt king
198. n low n/s
199. n y2
200. plugh inside building
201. drop spices
202. drop chain
203. drop eggs
204. plugh y2
205. s low n/s
206. s hall of mt king
207. e hall of mists
208. w east bank of fissure
209. w west bank of fissure
210. w west end hall of mists
211. s all alike maze
212. e maze
213. s maze
214. s maze
215. s maze
216. n maze
217. e maze
218. e maze
219. nw dead end
220. get chest (and anything else the pirate may have stolen)
221. se maze
222. n maze
223. d bird chamber
224. e e/w canyon
225. e debris room
226. xyzzy inside building
227. drop chest
228. plugh y2 (why two?)
229. s low n/s
230. d dirty passage
231. w dusty rock room
232. d complex junction
233. e ante room
234. get magazine it's addressed to witt
235. e witt's end
236. drop magazine the elusive one point
237. Just do anything, but don't go west from here; you'll never get out
way. Any other direction will eventually (with low probability) get you
out. Move around in the cave until something interesting happens.
238. sw s/w end
239. get rod this one is dynamite
240. ne n/e end
241. drop rod plant explosive
242. sw stand clear
243. blast make a hole in wall to main office

If all went well, you have finished with a maximum score.

If the pirate never appears, you probably won't make it. When you reach
the dead end where the chest is supposed to be, you could backtrack (if you
know how) through the maze and then forward again until he appears. If this
takes too many turns your lamp batteries will wear out before the end game,
and then it's tough beans.