scottkit 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. data/.gitignore +4 -0
  2. data/GPL-2 +339 -0
  3. data/Makefile +5 -0
  4. data/README +75 -0
  5. data/Rakefile +58 -0
  6. data/VERSION +1 -0
  7. data/bin/scottkit +96 -0
  8. data/bin/scottkit.rb +96 -0
  9. data/data/.gitignore +1 -0
  10. data/data/adams/.gitignore +2 -0
  11. data/data/adams/AdamsGames.zip +0 -0
  12. data/data/adams/Makefile +18 -0
  13. data/data/crystal/crystal.map +112 -0
  14. data/data/crystal/crystal.sck +598 -0
  15. data/data/crystal/crystal.solution +82 -0
  16. data/data/dan-and-matt.sck +180 -0
  17. data/data/dan-and-matt.solution +32 -0
  18. data/data/howarth/.gitignore +2 -0
  19. data/data/howarth/Makefile +14 -0
  20. data/data/howarth/mysterious.tar.gz +0 -0
  21. data/data/test/Makefile +18 -0
  22. data/data/test/adams/Makefile +13 -0
  23. data/data/test/adams/adv01.solution +186 -0
  24. data/data/test/adams/adv01.transcript +869 -0
  25. data/data/test/adams/adv01.transcript.md5 +1 -0
  26. data/data/test/adams/adv02.solution +225 -0
  27. data/data/test/adams/adv02.transcript +970 -0
  28. data/data/test/adams/adv02.transcript.md5 +1 -0
  29. data/data/test/adams/adv04.solution +187 -0
  30. data/data/test/adams/adv04.transcript +876 -0
  31. data/data/test/adams/adv04.transcript.md5 +1 -0
  32. data/data/test/crystal.decompile +628 -0
  33. data/data/test/crystal.sao +373 -0
  34. data/data/test/crystal.save-file +62 -0
  35. data/data/test/crystal.save-script +41 -0
  36. data/data/test/crystal.sck +598 -0
  37. data/data/test/crystal.solution +82 -0
  38. data/data/test/crystal.transcript +413 -0
  39. data/data/test/t6.pretty-print +225 -0
  40. data/data/test/t7.sao +110 -0
  41. data/data/test/t7.solution +28 -0
  42. data/data/test/t7.transcript +147 -0
  43. data/data/tutorial/t1.sck +5 -0
  44. data/data/tutorial/t2.sck +14 -0
  45. data/data/tutorial/t3.sck +38 -0
  46. data/data/tutorial/t4.sck +62 -0
  47. data/data/tutorial/t5.sck +87 -0
  48. data/data/tutorial/t6.sck +119 -0
  49. data/data/tutorial/t7.sck +135 -0
  50. data/lib/scottkit/compile.rb +661 -0
  51. data/lib/scottkit/decompile.rb +175 -0
  52. data/lib/scottkit/game.rb +409 -0
  53. data/lib/scottkit/play.rb +474 -0
  54. data/notes/Definition +147 -0
  55. data/notes/Definition.saved-game +9 -0
  56. data/notes/Definition.scottfree-1.14 +142 -0
  57. data/notes/adventureland-maze +20 -0
  58. data/notes/continue-action +51 -0
  59. data/test/test_canonicalise.rb +94 -0
  60. data/test/test_compile.rb +54 -0
  61. data/test/test_decompile.rb +13 -0
  62. data/test/test_play.rb +20 -0
  63. data/test/test_playadams.rb +36 -0
  64. data/test/test_save.rb +31 -0
  65. data/test/withio.rb +15 -0
  66. data/test/withio_test.rb +31 -0
  67. metadata +118 -0
@@ -0,0 +1,598 @@
1
+ # Modified from crystal.sac v1.7 (2006-11-11) from Games::ScottAdams
2
+
3
+ # crystal.sck -- Scott Adams source file for _Crystal of Chaos_
4
+
5
+ # ----------------------------------------------------------------------------
6
+ # Global configuration
7
+
8
+ ident 18400
9
+ version 1
10
+ wordlen 3
11
+ maxload 5
12
+ lighttime 100
13
+ start hut
14
+ treasury hut
15
+
16
+ # Standard synonyms
17
+ verbgroup go enter follow run walk
18
+ verbgroup take get
19
+ verbgroup leave drop
20
+ #verbgroup cut chop ### currently causes a collision
21
+ verbgroup batter ram
22
+
23
+ # ----------------------------------------------------------------------------
24
+ # Infrastructure actions (I don't think any game would ever omit these)
25
+
26
+ action inventory: inventory
27
+ action take inventory: inventory
28
+ action score: score
29
+ action save game: save_game
30
+ action look: look
31
+
32
+ # The path is dark; nowhere else is
33
+ occur when "at" path
34
+ set_dark
35
+ ###look # Hard to make this work right in a non-curses driver
36
+
37
+ occur when !at path
38
+ clear_dark
39
+ ###look # Hard to make this work right in a non-curses driver
40
+
41
+ occur when !flag 1
42
+ set_flag 1
43
+ print "Welcome to `CRYSTAL OF CHAOS`"
44
+ print "Written by Mike Taylor, starting Monday 10th April 2001"
45
+ print "This is a demo for the `ScottKit` adventure system"
46
+ print ""
47
+ print "Your task is to find the six crown jewels of the"
48
+ print "kingdom and store them in this hut. They are:"
49
+ print "a platinum chain, a gold crown, a silver medallion"
50
+ print "a bronze sceptre, a zinc goblet and a tin stoat."
51
+
52
+
53
+ # ----------------------------------------------------------------------------
54
+ # Use of flags
55
+ # flag 1: Set forever once welcome message has been printed.
56
+ # flag 2: True immediately after balsa wood is lit.
57
+ # flag 3: True immediately after plywood is lit.
58
+ # flag 4: True immediately after oak is lit.
59
+ # flag 5: True while under water.
60
+ # flag 6: Set true forever when first in the treasure clearing.
61
+ # flag 7: True if all treasures but the stoat have been stored.
62
+ # flag 8: True once the missing stoat message has been printed.
63
+ #
64
+ # Use of saved locations
65
+ # location 1: when in vase, contains room player was in before.
66
+ #
67
+ # Use of counters:
68
+ # counter 1: number of turns remaining to hold breath
69
+
70
+ # ----------------------------------------------------------------------------
71
+ # Preamble actions (must fire after body actions)
72
+
73
+ occur when "at" clearing and !flag 6
74
+ set_flag 6
75
+ print "Oh, there they are. That wasn't as hard as I expected."
76
+
77
+ # Check whether we have stored all treasures except the stoat
78
+ occur when "at" hut
79
+ set_flag 7
80
+ #print "setting flag 7 (in hut)"
81
+
82
+ occur when !here chain
83
+ clear_flag 7
84
+ #print "clearing flag 7 (no chain)"
85
+
86
+ occur when !here crown
87
+ clear_flag 7
88
+ #print "clearing flag 7 (no crown)"
89
+
90
+ occur when !here medallion
91
+ clear_flag 7
92
+ #print "clearing flag 7 (no medallion)"
93
+
94
+ occur when !here sceptre
95
+ clear_flag 7
96
+ #print "clearing flag 7 (no sceptre)"
97
+
98
+ occur when !here goblet
99
+ clear_flag 7
100
+ #print "clearing flag 7 (no goblet)"
101
+
102
+ occur when flag 7 and !flag 8
103
+ set_flag 8
104
+ print "Ah, looks like I'm still missing the stoat."
105
+ ### This message appears even if the stoat is already stored.
106
+
107
+ # Check whether we're under water ...
108
+ occur when "at" pool set_flag 5
109
+ occur when "at" river1 set_flag 5
110
+ occur when "at" river2 set_flag 5
111
+ occur when "at" river3 set_flag 5
112
+ occur when "at" river4 set_flag 5
113
+
114
+ # ... or whether we've just emerged from under water
115
+ occur when "at" forest2 clear_flag 5
116
+ occur when "at" chamber clear_flag 5
117
+ occur when "at" vase clear_flag 5
118
+ occur when "at" dead clear_flag 5
119
+
120
+ occur when counter_eq 1
121
+ print "I have to breathe NOW!"
122
+
123
+ occur when counter_gt 0
124
+ dec_counter
125
+
126
+ occur when counter_gt 0
127
+ print "I can only hold my breath for"
128
+ print_counter
129
+ print "more turns."
130
+
131
+ occur when counter_eq 0 and flag 5
132
+ print "I can't breathe ..."
133
+ pause
134
+ clear_flag 5
135
+ die
136
+ comment "Death due to lack of breath"
137
+
138
+ # We'd like the next three occurs to go after the action for LIGHT
139
+ # BALSA below. But that doesn't work, because although any number of
140
+ # occurs may fire on a given turn, action-and-occur processing stops
141
+ # immediately after the first successful action. (I determined this
142
+ # by experiment: I couldn't determine the intent of the scottfree
143
+ # source to save my life.) Instead, we do these occur's at the very
144
+ # start of the _next_ turn -- which from the player's perspective is
145
+ # indistinguishable from the end of the previous one.
146
+
147
+ occur when flag 2 and here plywood
148
+ print "The plywood also catches fire and burns quickly."
149
+ destroy plywood
150
+ set_flag 3
151
+
152
+ occur when flag 3 and here oak
153
+ print "The oak catches, and becomes a roaring fire."
154
+ print "Smoke pours upwards."
155
+ destroy oak
156
+ drop fire
157
+ set_flag 4
158
+
159
+ occur when flag 4 and "at" glade
160
+ destroy bees
161
+ put drowsy_bees beech
162
+
163
+ occur
164
+ clear_flag 2
165
+ clear_flag 3
166
+ clear_flag 4
167
+ comment "Fire-building must happen all in one go"
168
+
169
+ action chop when !present axe
170
+ print "I can't chop anything without an axe."
171
+
172
+ action ram when !present trunk
173
+ print "I don't have a battering ram."
174
+
175
+ action light when !present match
176
+ print "I don't have anything to light it with."
177
+
178
+
179
+ # ----------------------------------------------------------------------------
180
+ # Rooms, Items and associated Actions
181
+
182
+ room hut "small wooden hut."
183
+ exit east clearing
184
+
185
+ item sign "Sign"
186
+
187
+ action read sign when present sign
188
+ print "It says - `Leave *TREASURES* here, then say: SCORE`"
189
+
190
+ item axe "Axe"
191
+ called axe
192
+ noungroup axe ax
193
+
194
+ item match "Single match"
195
+ called match
196
+
197
+ room clearing "clearing. There's a small hut to the west."
198
+ exit north swamp
199
+ exit east glade
200
+ exit south forest
201
+ exit west hut
202
+
203
+ item chain "*Platinum chain*"
204
+ called chain
205
+
206
+ item crown "*Gold crown*"
207
+ called crown
208
+
209
+ item medallion "*Silver medallion*"
210
+ called medallion
211
+
212
+ item sceptre "*Bronze sceptre*"
213
+ called sceptre
214
+
215
+ item goblet "*Zinc goblet*"
216
+ called goblet
217
+
218
+ room glade "glade"
219
+ exit west clearing
220
+ exit north outcrop
221
+ exit south forest2
222
+
223
+ item beech "Beech tree"
224
+
225
+ action climb tree when here beech
226
+ goto beech
227
+ look2
228
+
229
+ room beech "the top of a beech tree"
230
+ exit down glade
231
+
232
+ item nest "Bees' nest"
233
+
234
+ item honey "Wild honey"
235
+ called honey
236
+
237
+ action get honey when here bees
238
+ print "No! Bees would sting me!"
239
+
240
+ item bees "Killer bees"
241
+
242
+ item drowsy_bees "Drowsy bees"
243
+ nowhere
244
+
245
+ action help when here bees
246
+ print "Smoke 'em out!"
247
+
248
+ room swamp "dismal swamp"
249
+ exit east outcrop
250
+ exit south clearing
251
+
252
+ item cypress "Cypress tree"
253
+
254
+ action chop tree when here cypress
255
+ print "TIMBER!"
256
+ swap cypress trunk
257
+ drop stump
258
+ look2
259
+
260
+ item stump "-SOLID- stump"
261
+ nowhere
262
+
263
+ action examine stump when here stump
264
+ print "There's nothing there all right! Maybe I should forget it?"
265
+
266
+ item trunk "Trunk of cypress tree"
267
+ called trunk
268
+ nowhere
269
+
270
+ item mud "Evil smelling mud"
271
+ called mud
272
+
273
+ item gas "Swamp gas"
274
+
275
+ item slime "Patches of `OILY` slime"
276
+ called oil
277
+
278
+ item chiggers "Chiggers"
279
+ called chiggers
280
+
281
+ room outcrop "rocky area by an outcrop"
282
+ exit west swamp
283
+ exit south glade
284
+
285
+ item bdoor "Balsa-wood door set into the rock"
286
+
287
+ item lamp "Old-fashioned brass lamp"
288
+ called lamp
289
+ lightsource lamp
290
+
291
+ action open door when here bdoor
292
+ print "It's locked."
293
+
294
+ verbgroup kick smash break
295
+
296
+ action kick door when here bdoor
297
+ swap bdoor tunnel
298
+ drop balsa
299
+ print "It splinters easily."
300
+ print "There's a tunnel beyond."
301
+ look2
302
+
303
+ action chop door when here bdoor
304
+ swap bdoor tunnel
305
+ print "CRUNCH! It's smashed to smithereens!"
306
+ print "There's a tunnel beyond."
307
+ look2
308
+ comment "no balsa wood"
309
+
310
+ action ram door when here bdoor
311
+ destroy bdoor
312
+ drop tunnel
313
+ print "DOOSH! It's absolutely annihilated!"
314
+ print "There's a tunnel beyond."
315
+ look2
316
+ comment "no balsa wood"
317
+
318
+ item balsa "Balsa wood"
319
+ called balsa
320
+ nowhere
321
+
322
+ item tunnel "Tunnel disappears into the rock"
323
+ nowhere
324
+
325
+ action go tunnel when here tunnel
326
+ goto tunnel
327
+ look2
328
+
329
+ room tunnel "dingy north-south tunnel"
330
+ exit south outcrop
331
+
332
+ item pdoor "Plywood door blocks the way north"
333
+
334
+ action open door when here pdoor
335
+ print "It's also locked."
336
+
337
+ action kick door when here pdoor
338
+ print "Ouch!"
339
+
340
+ action chop door when here pdoor
341
+ swap pdoor passage
342
+ drop plywood
343
+ print "CRUNCH!"
344
+ print "There's a passage beyond."
345
+ look2
346
+
347
+ action ram door when here pdoor
348
+ swap pdoor passage
349
+ print "DOOSH! It's absolutely annihilated!"
350
+ print "There's a passage beyond."
351
+ look2
352
+ comment "no plywood"
353
+
354
+ item plywood "Plywood"
355
+ called plywood
356
+ nowhere
357
+
358
+ item passage "Passage disappears into the rock"
359
+ nowhere
360
+
361
+ action go passage when here passage
362
+ goto passage
363
+ look2
364
+
365
+ room passage "gloomy north-south passage"
366
+ exit south tunnel
367
+
368
+ item odoor "Oak door blocks the way north"
369
+
370
+ action open door when here odoor
371
+ print "OF COURSE it's locked!"
372
+
373
+ action kick door when here odoor
374
+ print "Ouch!"
375
+
376
+ action chop door when here odoor
377
+ print "It's too solid for the axe to make much impression."
378
+
379
+ action ram door when here odoor
380
+ swap odoor entrance
381
+ drop oak
382
+ print "DOOSH!"
383
+ print "There's an entrance beyond."
384
+ look2
385
+
386
+ item oak "Oak"
387
+ called oak
388
+ nowhere
389
+
390
+ item entrance "Entrance to the north"
391
+ nowhere
392
+
393
+ action go entrance when here entrance
394
+ goto empty
395
+ look2
396
+
397
+ room empty "empty room"
398
+ exit south passage
399
+
400
+ item fire "Blazing hot fire"
401
+ nowhere
402
+
403
+ action light plywood when "carried" plywood
404
+ print "Not while I'm carrying it!"
405
+
406
+ action light plywood when here plywood
407
+ print "I can't get it to catch fire."
408
+ print "My match goes out."
409
+ destroy match
410
+
411
+ action light oak when here oak
412
+ print "There's no way it will catch fire."
413
+ print "My match goes out."
414
+ destroy match
415
+
416
+ action light oak when "carried" oak
417
+ print "Not while I'm carrying it!"
418
+
419
+ action light balsa when "carried" balsa
420
+ print "Not while I'm carrying it!"
421
+
422
+ action light balsa when here balsa
423
+ print "OK. It burns up very quickly."
424
+ print "My match goes out."
425
+ destroy match
426
+ destroy balsa
427
+ set_flag 2
428
+
429
+ room forest "forest"
430
+ exit north clearing
431
+ exit east forest2
432
+
433
+ item path "Path leads south into the forest"
434
+
435
+ action go path when here bear
436
+ print "Bear won't let me"
437
+
438
+ action go path when "at" forest
439
+ goto path
440
+ look2
441
+
442
+ item bear "Very thin black bear"
443
+
444
+ action give honey when here bear and present honey
445
+ destroy bear
446
+ destroy honey
447
+ drop sleeping
448
+ print "Bear eats the honey and falls asleep."
449
+
450
+ item sleeping "Sleeping bear"
451
+ nowhere
452
+
453
+ room path "overgrown path in a dark forest"
454
+ exit north forest
455
+
456
+ item vase "Huge vase"
457
+ called vase
458
+
459
+ action examine vase when present vase
460
+ print "It's bigger than I am."
461
+
462
+ action go vase when here vase
463
+ swap_specific_room 1
464
+ goto vase
465
+ look2
466
+
467
+ action leave vase when "at" vase
468
+ swap_specific_room 1
469
+ look2
470
+
471
+ action get out when "at" vase
472
+ swap_specific_room 1
473
+ look2
474
+
475
+ room vase "*I'm INSIDE a huge vase!"
476
+
477
+ item key "Iron key"
478
+ called key
479
+
480
+ room forest2 "forest"
481
+ exit north glade
482
+ exit west forest
483
+
484
+ item pool "Bubbling pool"
485
+
486
+ action go pool when here pool
487
+ goto pool
488
+ look2
489
+
490
+ action hold breath when counter_gt 0
491
+ print "I'm already holding my breath!"
492
+
493
+ action hold breath
494
+ set_counter 6
495
+ print "OK"
496
+
497
+ room pool "bubbling pool, just below the water level"
498
+ exit up forest2
499
+
500
+ item inflow "inflow from the south"
501
+
502
+ action go inflow when here inflow
503
+ goto river1
504
+ look2
505
+
506
+ room river1 "*I'm swimming in an underground river.
507
+ Light pours from the north."
508
+ exit north pool
509
+ exit south river2
510
+
511
+ room river2 "*I'm swimming in an underground river.
512
+ There's a faint glimmer of light to the north."
513
+ exit north river1
514
+ exit south river3
515
+
516
+ room river3 "*I'm swimming in an underground river.
517
+ There's a faint glimmer of light to the south."
518
+ exit north river2
519
+ exit south river4
520
+
521
+ room river4 "*I'm swimming in an underground river.
522
+ Light pours from the south."
523
+ exit north river3
524
+ exit south chamber
525
+
526
+ room chamber "brightly lit underground chamber.
527
+ An underground river disappears into the north wall."
528
+ exit north river4
529
+ # exit south central
530
+
531
+ item stoat "*Tin stoat*"
532
+ called stoat
533
+
534
+ room central "central underground chamber. Passages leave in all directions."
535
+ exit north chamber
536
+ exit west prison
537
+ exit east junction
538
+
539
+ room prison "prison in an undergound complex. Doors lead to prison cells"
540
+ exit east central
541
+
542
+ item idoor "Iron door leads south"
543
+
544
+ item brdoor "Bronze door leads west"
545
+
546
+ action knock door when "at" prison
547
+ print "Which door? Use `knock iron` or `knock bronze`."
548
+
549
+ action knock iron when here idoor
550
+ print "Nothing happens."
551
+
552
+ action knock bronze when here brdoor
553
+ print "Nothing seems to happen."
554
+
555
+ room cell1 "dirty prison cell with muddy straw on the ground"
556
+ exit east prison
557
+ exit north hut
558
+
559
+ item goblin "small goblin"
560
+
561
+ room junction "junction between an east-west passage and one that leads south"
562
+ exit west central
563
+ exit east control
564
+ exit south steel
565
+
566
+ room control "control room filled with humming, crackling machinery"
567
+ exit west junction
568
+
569
+ item red "Red button"
570
+
571
+ item blue "Blue button"
572
+
573
+ item level "Lever"
574
+
575
+ room steel "square room with a steel floor"
576
+ exit north junction
577
+ exit south chasm
578
+
579
+ room chasm "vast hall which is split by a deep chasm running from east to west"
580
+ exit north steel
581
+
582
+ room dead "*I'm dead. Great. Try again."
583
+ exit east hut
584
+
585
+
586
+ # ----------------------------------------------------------------------------
587
+ # Postamble actions (must fire after body actions)
588
+
589
+ action help:
590
+ print "You'll have to figure it out for yourself."
591
+
592
+ action examine:
593
+ print "It looks like a pretty average"
594
+ println_noun
595
+
596
+ action wait:
597
+ print "OK"
598
+
@@ -0,0 +1,82 @@
1
+ read sign
2
+ east
3
+ get chain
4
+ get crown
5
+ get medallion
6
+ get sceptre
7
+ get goblet
8
+ west
9
+ drop chain
10
+ drop crown
11
+ drop medallion
12
+ drop sceptre
13
+ drop goblet
14
+ get axe
15
+ get match
16
+ east
17
+ north
18
+ chop tree
19
+ get trunk
20
+ east
21
+ kick door
22
+ go tunnel
23
+ chop door
24
+ go passage
25
+ ram door
26
+ go entrance
27
+ drop trunk
28
+ drop axe
29
+ south
30
+ get oak
31
+ south
32
+ get plywood
33
+ south
34
+ get balsa
35
+ south
36
+ drop oak
37
+ drop plywood
38
+ drop balsa
39
+ light balsa
40
+ climb tree
41
+ get honey
42
+ down
43
+ north
44
+ get lamp
45
+ west
46
+ south
47
+ south
48
+ give honey
49
+ follow path
50
+ get vase
51
+ north
52
+ east
53
+ examine vase
54
+ hold breath
55
+ go pool
56
+ go inflow
57
+ south
58
+ drop vase
59
+ go vase
60
+ get key
61
+ hold breath
62
+ get out
63
+ south
64
+ south
65
+ south
66
+ get stoat
67
+ hold breath
68
+ north
69
+ north
70
+ north
71
+ go vase
72
+ wait
73
+ hold breath
74
+ get out
75
+ north
76
+ north
77
+ up
78
+ north
79
+ west
80
+ west
81
+ drop stoat
82
+ score