scottkit 1.5.0 → 1.6.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.
- checksums.yaml +4 -4
- data/.travis.yml +9 -0
- data/.yardopts +1 -1
- data/ChangeLog.md +14 -4
- data/Gemfile +6 -0
- data/README.md +6 -5
- data/Rakefile +0 -2
- data/VERSION +1 -1
- data/bin/scottkit +3 -2
- data/{notes → docs/notes}/Definition-saved-game.txt +0 -0
- data/{notes → docs/notes}/Definition-scottfree-1.14.txt +0 -0
- data/{notes → docs/notes}/Definition.txt +0 -0
- data/{notes → docs/notes}/adventureland-maze +0 -0
- data/{notes → docs/notes}/continue-action +0 -0
- data/{manual → docs}/reference.md +1 -1
- data/{data/tutorial → docs}/tutorial.md +43 -13
- data/{data → games}/.gitignore +0 -0
- data/{data → games}/adams/.gitignore +0 -0
- data/{data → games}/adams/AdamsGames.zip +0 -0
- data/{data → games}/adams/Makefile +0 -0
- data/{data → games}/crystal/crystal.map +19 -5
- data/{data/test → games/crystal}/crystal.sck +12 -8
- data/{data → games}/crystal/crystal.solution +3 -1
- data/{data → games}/dan-and-matt/dan-and-matt.sck +0 -0
- data/{data → games}/dan-and-matt/dan-and-matt.solution +0 -0
- data/{data → games}/howarth/.gitignore +0 -0
- data/{data → games}/howarth/Makefile +0 -0
- data/{data → games}/howarth/mysterious.tar.gz +0 -0
- data/{data → games}/nosferatu/.gitignore +0 -0
- data/{data → games}/nosferatu/Makefile +0 -0
- data/{data → games}/nosferatu/README +0 -0
- data/{data → games}/nosferatu/TODO +0 -0
- data/{data → games}/nosferatu/nosferatu.map +0 -0
- data/{data → games}/nosferatu/nosferatu.regression +0 -0
- data/{data → games}/nosferatu/nosferatu.sck +0 -0
- data/{data → games}/nosferatu/nosferatu.sol +0 -0
- data/{data → games}/nosferatu/nosferatu.transcript +1 -10
- data/{data → games}/test/Makefile +0 -0
- data/{data → games}/test/adams/Makefile +0 -0
- data/{data → games}/test/adams/adv01.solution +0 -0
- data/{data → games}/test/adams/adv01.transcript +2 -20
- data/games/test/adams/adv01.transcript.md5 +1 -0
- data/{data → games}/test/adams/adv02.solution +0 -0
- data/{data → games}/test/adams/adv02.transcript +31 -39
- data/games/test/adams/adv02.transcript.md5 +1 -0
- data/{data → games}/test/adams/adv04.solution +0 -0
- data/{data → games}/test/adams/adv04.transcript +19 -42
- data/games/test/adams/adv04.transcript.md5 +1 -0
- data/{data → games}/test/crystal.decompile +0 -0
- data/{data → games}/test/crystal.sao +0 -0
- data/{data → games}/test/crystal.save-file +0 -0
- data/{data → games}/test/crystal.save-script +0 -0
- data/{data/crystal → games/test}/crystal.sck +0 -0
- data/{data → games}/test/crystal.solution +0 -0
- data/{data → games}/test/crystal.transcript +34 -33
- data/{data → games}/test/t6.pretty-print +0 -0
- data/{data/tutorial/t7.sck → games/test/t6.sck} +6 -26
- data/{data → games}/test/t7.sao +0 -0
- data/{data → games}/test/t7.solution +0 -0
- data/{data → games}/test/t7.transcript +8 -18
- data/games/tutorial/Makefile +5 -0
- data/{data → games}/tutorial/t1.map +0 -0
- data/{data → games}/tutorial/t1.sck +0 -0
- data/{data → games}/tutorial/t2.map +0 -0
- data/{data → games}/tutorial/t2.sck +0 -0
- data/{data → games}/tutorial/t3.map +0 -0
- data/{data → games}/tutorial/t3.sck +0 -0
- data/{data → games}/tutorial/t4.map +0 -0
- data/{data → games}/tutorial/t4.sck +0 -0
- data/{data → games}/tutorial/t5.map +0 -0
- data/{data → games}/tutorial/t5.sck +2 -2
- data/games/tutorial/t6.sck +149 -0
- data/{data/tutorial/t6.sck → games/tutorial/t7.sck} +4 -2
- data/{data → games}/tutorial/tutorial.source.md +1 -1
- data/lib/scottkit/compile.rb +0 -1
- data/lib/scottkit/play.rb +76 -41
- data/scottkit.gemspec +135 -0
- data/test/test_canonicalise.rb +1 -1
- data/test/test_compile.rb +5 -5
- data/test/test_decompile.rb +2 -2
- data/test/test_play.rb +3 -3
- data/test/test_playadams.rb +3 -3
- data/test/test_save.rb +6 -6
- metadata +113 -67
- data/data/test/adams/adv01.transcript.md5 +0 -1
- data/data/test/adams/adv02.transcript.md5 +0 -1
- data/data/test/adams/adv04.transcript.md5 +0 -1
- data/data/tutorial/Makefile +0 -7
data/lib/scottkit/play.rb
CHANGED
@@ -1,9 +1,25 @@
|
|
1
1
|
module ScottKit
|
2
2
|
class Game
|
3
|
-
private
|
4
|
-
|
5
3
|
# Returns 1 if the game was won, 0 otherwise
|
6
4
|
def play
|
5
|
+
prepare_to_play
|
6
|
+
|
7
|
+
while !finished?
|
8
|
+
prompt_for_turn
|
9
|
+
|
10
|
+
if !(line = gets)
|
11
|
+
# End of file -- we're done
|
12
|
+
puts
|
13
|
+
break
|
14
|
+
end
|
15
|
+
|
16
|
+
process_turn(line)
|
17
|
+
end
|
18
|
+
|
19
|
+
return @finished
|
20
|
+
end
|
21
|
+
|
22
|
+
def prepare_to_play
|
7
23
|
@finished = nil
|
8
24
|
@items.each { |x| x.loc = x.startloc }
|
9
25
|
@flags = Array.new(NFLAGS) { false } # weird way to set a default
|
@@ -13,6 +29,7 @@ module ScottKit
|
|
13
29
|
@saved_room = 0
|
14
30
|
@loc = defined?(@startloc) ? @startloc : 1
|
15
31
|
@lampleft = defined?(@lamptime) ? @lamptime : 0
|
32
|
+
@need_to_look = true;
|
16
33
|
|
17
34
|
puts "ScottKit, a Scott Adams game toolkit in Ruby."
|
18
35
|
puts "(C) 2010-2017 Mike Taylor <mike@miketaylor.org.uk>"
|
@@ -34,31 +51,48 @@ module ScottKit
|
|
34
51
|
raise "#$0: can't read input file '#{file}': #$!" if !@fh
|
35
52
|
end
|
36
53
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
54
|
+
actually_look
|
55
|
+
end
|
56
|
+
|
57
|
+
def prompt_for_turn
|
58
|
+
run_matching_actions(0, 0)
|
59
|
+
|
60
|
+
actually_look if @need_to_look
|
61
|
+
|
62
|
+
print "Tell me what to do ? "
|
63
|
+
end
|
64
|
+
|
65
|
+
def process_turn(line)
|
66
|
+
words = line.chomp.split
|
67
|
+
if words.length == 0
|
68
|
+
puts "I don't understand your command."
|
69
|
+
return
|
70
|
+
end
|
71
|
+
|
72
|
+
execute_command(words[0], words[1])
|
73
|
+
|
74
|
+
process_lighting
|
75
|
+
end
|
76
|
+
|
77
|
+
def finished?
|
78
|
+
!@finished.nil?
|
79
|
+
end
|
80
|
+
|
81
|
+
private
|
82
|
+
|
83
|
+
def process_lighting
|
84
|
+
if items.size > ITEM_LAMP && items[ITEM_LAMP].loc != ROOM_NOWHERE && @lampleft > 0
|
85
|
+
@lampleft -= 1
|
86
|
+
if @lampleft == 0
|
87
|
+
puts "Your light has run out"
|
88
|
+
@flags[FLAG_LAMPDEAD] = true
|
89
|
+
if is_dark
|
90
|
+
need_to_look
|
58
91
|
end
|
92
|
+
elsif @lampleft < 25 && @lampleft % 5 == 0
|
93
|
+
puts("Your light is growing dim.");
|
59
94
|
end
|
60
95
|
end
|
61
|
-
0
|
62
96
|
end
|
63
97
|
|
64
98
|
# Get a line from @fh if defined, otherwise $stdin
|
@@ -134,14 +168,10 @@ module ScottKit
|
|
134
168
|
newloc = @rooms[@loc].exits[i-1]
|
135
169
|
if newloc != 0
|
136
170
|
@loc = newloc
|
137
|
-
|
138
|
-
# When moving from a light place to a dark one or vice
|
139
|
-
# versa, this look should not happen, because we'll get a
|
140
|
-
# correct version of the display after the flag gets set.
|
141
|
-
# I'm not sure what can be done about this. ### Think
|
171
|
+
need_to_look
|
142
172
|
elsif is_dark
|
143
173
|
puts "I fell down and broke my neck."
|
144
|
-
|
174
|
+
finish(0)
|
145
175
|
else
|
146
176
|
puts "I can't go in that direction."
|
147
177
|
end
|
@@ -210,7 +240,7 @@ module ScottKit
|
|
210
240
|
puts "#{i} out of range 0..#{@rooms.count}"
|
211
241
|
else
|
212
242
|
@loc = i
|
213
|
-
|
243
|
+
need_to_look
|
214
244
|
end
|
215
245
|
elsif verb.upcase == "#WHERE" # find an item
|
216
246
|
i = Integer(noun)
|
@@ -263,7 +293,13 @@ module ScottKit
|
|
263
293
|
end
|
264
294
|
end
|
265
295
|
|
266
|
-
def
|
296
|
+
def need_to_look(val = :always)
|
297
|
+
@need_to_look = val
|
298
|
+
end
|
299
|
+
|
300
|
+
def actually_look #:nodoc:
|
301
|
+
@need_to_look = nil;
|
302
|
+
|
267
303
|
puts
|
268
304
|
if is_dark
|
269
305
|
return print "I can't see. It is too dark!\n\n"
|
@@ -304,7 +340,7 @@ module ScottKit
|
|
304
340
|
puts "On a scale of 0 to 100, that rates #{100*count/@ntreasures}."
|
305
341
|
if (count == @ntreasures)
|
306
342
|
puts "Well done."
|
307
|
-
|
343
|
+
finish(1)
|
308
344
|
end
|
309
345
|
end
|
310
346
|
|
@@ -315,7 +351,7 @@ module ScottKit
|
|
315
351
|
save(name)
|
316
352
|
end
|
317
353
|
|
318
|
-
def
|
354
|
+
def finish(win) #:nodoc:
|
319
355
|
puts "The game is now over."
|
320
356
|
sleep 2 if !options[:no_wait]
|
321
357
|
@finished = win
|
@@ -332,9 +368,8 @@ module ScottKit
|
|
332
368
|
@flags[15] && loc != ROOM_CARRIED && loc != @loc
|
333
369
|
end
|
334
370
|
|
335
|
-
|
336
|
-
public :prompt_and_save, :
|
337
|
-
|
371
|
+
# Invoked from Instruction.execute()
|
372
|
+
public :prompt_and_save, :need_to_look, :score, :ncarried, :inventory, :finish
|
338
373
|
|
339
374
|
class Condition
|
340
375
|
def evaluate
|
@@ -401,10 +436,10 @@ module ScottKit
|
|
401
436
|
when 60 then @game.flags[args.shift] = false
|
402
437
|
when 61 then
|
403
438
|
puts "I am dead."; @game.flags[15] = false;
|
404
|
-
@game.loc = @game.rooms.size-1; @game.
|
439
|
+
@game.loc = @game.rooms.size-1; @game.need_to_look
|
405
440
|
when 62 then i = args.shift; @game.items[i].loc = args.shift
|
406
|
-
when 63 then @game.
|
407
|
-
when 64 then @game.
|
441
|
+
when 63 then @game.finish(0)
|
442
|
+
when 64 then @game.need_to_look
|
408
443
|
when 65 then @game.score
|
409
444
|
when 66 then @game.inventory
|
410
445
|
when 67 then @game.flags[0] = true
|
@@ -423,7 +458,7 @@ module ScottKit
|
|
423
458
|
when 74 then @game.items[args.shift].loc = ROOM_CARRIED
|
424
459
|
when 75 then i1 = args.shift; i2 = args.shift
|
425
460
|
@game.items[i1].loc = @game.items[i2].loc
|
426
|
-
when 76 then @game.
|
461
|
+
when 76 then @game.need_to_look
|
427
462
|
when 77 then @game.counter -= 1
|
428
463
|
when 78 then print @game.counter, " "
|
429
464
|
when 79 then @game.counter = args.shift
|
data/scottkit.gemspec
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: scottkit 1.6.0 ruby lib
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "scottkit".freeze
|
9
|
+
s.version = "1.6.0"
|
10
|
+
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib".freeze]
|
13
|
+
s.authors = ["Mike Taylor".freeze]
|
14
|
+
s.date = "2017-10-24"
|
15
|
+
s.description = "ScottKit is a toolkit for compiling, decompiling and playing adventure games in the Scott Adams format.".freeze
|
16
|
+
s.email = "mike@miketaylor.org.uk".freeze
|
17
|
+
s.executables = ["md5ruby".freeze, "scottkit".freeze]
|
18
|
+
s.extra_rdoc_files = [
|
19
|
+
"ChangeLog.md",
|
20
|
+
"README.md"
|
21
|
+
]
|
22
|
+
s.files = [
|
23
|
+
".travis.yml",
|
24
|
+
".yardopts",
|
25
|
+
"ChangeLog.md",
|
26
|
+
"GPL-2.txt",
|
27
|
+
"Gemfile",
|
28
|
+
"README.md",
|
29
|
+
"Rakefile",
|
30
|
+
"VERSION",
|
31
|
+
"bin/md5ruby",
|
32
|
+
"bin/scottkit",
|
33
|
+
"docs/notes/Definition-saved-game.txt",
|
34
|
+
"docs/notes/Definition-scottfree-1.14.txt",
|
35
|
+
"docs/notes/Definition.txt",
|
36
|
+
"docs/notes/adventureland-maze",
|
37
|
+
"docs/notes/continue-action",
|
38
|
+
"docs/reference.md",
|
39
|
+
"docs/tutorial.md",
|
40
|
+
"games/.gitignore",
|
41
|
+
"games/adams/.gitignore",
|
42
|
+
"games/adams/AdamsGames.zip",
|
43
|
+
"games/adams/Makefile",
|
44
|
+
"games/crystal/crystal.map",
|
45
|
+
"games/crystal/crystal.sck",
|
46
|
+
"games/crystal/crystal.solution",
|
47
|
+
"games/dan-and-matt/dan-and-matt.sck",
|
48
|
+
"games/dan-and-matt/dan-and-matt.solution",
|
49
|
+
"games/howarth/.gitignore",
|
50
|
+
"games/howarth/Makefile",
|
51
|
+
"games/howarth/mysterious.tar.gz",
|
52
|
+
"games/nosferatu/.gitignore",
|
53
|
+
"games/nosferatu/Makefile",
|
54
|
+
"games/nosferatu/README",
|
55
|
+
"games/nosferatu/TODO",
|
56
|
+
"games/nosferatu/nosferatu.map",
|
57
|
+
"games/nosferatu/nosferatu.regression",
|
58
|
+
"games/nosferatu/nosferatu.sck",
|
59
|
+
"games/nosferatu/nosferatu.sol",
|
60
|
+
"games/nosferatu/nosferatu.transcript",
|
61
|
+
"games/test/Makefile",
|
62
|
+
"games/test/adams/Makefile",
|
63
|
+
"games/test/adams/adv01.solution",
|
64
|
+
"games/test/adams/adv01.transcript",
|
65
|
+
"games/test/adams/adv01.transcript.md5",
|
66
|
+
"games/test/adams/adv02.solution",
|
67
|
+
"games/test/adams/adv02.transcript",
|
68
|
+
"games/test/adams/adv02.transcript.md5",
|
69
|
+
"games/test/adams/adv04.solution",
|
70
|
+
"games/test/adams/adv04.transcript",
|
71
|
+
"games/test/adams/adv04.transcript.md5",
|
72
|
+
"games/test/crystal.decompile",
|
73
|
+
"games/test/crystal.sao",
|
74
|
+
"games/test/crystal.save-file",
|
75
|
+
"games/test/crystal.save-script",
|
76
|
+
"games/test/crystal.sck",
|
77
|
+
"games/test/crystal.solution",
|
78
|
+
"games/test/crystal.transcript",
|
79
|
+
"games/test/t6.pretty-print",
|
80
|
+
"games/test/t6.sck",
|
81
|
+
"games/test/t7.sao",
|
82
|
+
"games/test/t7.solution",
|
83
|
+
"games/test/t7.transcript",
|
84
|
+
"games/tutorial/Makefile",
|
85
|
+
"games/tutorial/t1.map",
|
86
|
+
"games/tutorial/t1.sck",
|
87
|
+
"games/tutorial/t2.map",
|
88
|
+
"games/tutorial/t2.sck",
|
89
|
+
"games/tutorial/t3.map",
|
90
|
+
"games/tutorial/t3.sck",
|
91
|
+
"games/tutorial/t4.map",
|
92
|
+
"games/tutorial/t4.sck",
|
93
|
+
"games/tutorial/t5.map",
|
94
|
+
"games/tutorial/t5.sck",
|
95
|
+
"games/tutorial/t6.sck",
|
96
|
+
"games/tutorial/t7.sck",
|
97
|
+
"games/tutorial/tutorial.source.md",
|
98
|
+
"lib/scottkit/compile.rb",
|
99
|
+
"lib/scottkit/decompile.rb",
|
100
|
+
"lib/scottkit/game.rb",
|
101
|
+
"lib/scottkit/play.rb",
|
102
|
+
"lib/scottkit/withio.rb",
|
103
|
+
"scottkit.gemspec",
|
104
|
+
"test/test_canonicalise.rb",
|
105
|
+
"test/test_compile.rb",
|
106
|
+
"test/test_decompile.rb",
|
107
|
+
"test/test_play.rb",
|
108
|
+
"test/test_playadams.rb",
|
109
|
+
"test/test_save.rb",
|
110
|
+
"test/withio_test.rb"
|
111
|
+
]
|
112
|
+
s.homepage = "http://github.com/MikeTaylor/scottkit".freeze
|
113
|
+
s.licenses = ["GPL-2.0".freeze]
|
114
|
+
s.rubygems_version = "2.6.11".freeze
|
115
|
+
s.summary = "Toolkit for Scott Adams-format adventure games".freeze
|
116
|
+
|
117
|
+
if s.respond_to? :specification_version then
|
118
|
+
s.specification_version = 4
|
119
|
+
|
120
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
121
|
+
s.add_runtime_dependency(%q<rake>.freeze, ["~> 12.0"])
|
122
|
+
s.add_runtime_dependency(%q<jeweler>.freeze, ["~> 2.0"])
|
123
|
+
s.add_runtime_dependency(%q<test-unit>.freeze, ["~> 3.2.0"])
|
124
|
+
else
|
125
|
+
s.add_dependency(%q<rake>.freeze, ["~> 12.0"])
|
126
|
+
s.add_dependency(%q<jeweler>.freeze, ["~> 2.0"])
|
127
|
+
s.add_dependency(%q<test-unit>.freeze, ["~> 3.2.0"])
|
128
|
+
end
|
129
|
+
else
|
130
|
+
s.add_dependency(%q<rake>.freeze, ["~> 12.0"])
|
131
|
+
s.add_dependency(%q<jeweler>.freeze, ["~> 2.0"])
|
132
|
+
s.add_dependency(%q<test-unit>.freeze, ["~> 3.2.0"])
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
data/test/test_canonicalise.rb
CHANGED
@@ -50,7 +50,7 @@ class TestCanonicalise < Test::Unit::TestCase #:nodoc:
|
|
50
50
|
|
51
51
|
def canonicalise(name, type, options = {})
|
52
52
|
#puts "#{name}: options=#{options}"
|
53
|
-
filename = "
|
53
|
+
filename = "games/#{name}"
|
54
54
|
|
55
55
|
if !File::readable?(filename)
|
56
56
|
if self.respond_to? :skip
|
data/test/test_compile.rb
CHANGED
@@ -23,7 +23,7 @@ class TestCompile < Test::Unit::TestCase #:nodoc:
|
|
23
23
|
|
24
24
|
def test_lexer
|
25
25
|
game = ScottKit::Game.new({})
|
26
|
-
lexer = ScottKit::Game::Compiler::Lexer.new(game, "
|
26
|
+
lexer = ScottKit::Game::Compiler::Lexer.new(game, "games/tutorial/t1.sck")
|
27
27
|
EXPECTED.each do |x| token, lexeme = *x
|
28
28
|
got = lexer.lex
|
29
29
|
assert_equal(token, got)
|
@@ -34,10 +34,10 @@ class TestCompile < Test::Unit::TestCase #:nodoc:
|
|
34
34
|
def test_parser
|
35
35
|
game = ScottKit::Game.new({})
|
36
36
|
# It's a clumsy API, but then we're peeking where we're not invited
|
37
|
-
compiler = ScottKit::Game::Compiler.new(game, "
|
37
|
+
compiler = ScottKit::Game::Compiler.new(game, "games/test/t6.sck")
|
38
38
|
tree = compiler.parse
|
39
39
|
got = tree.pretty_inspect
|
40
|
-
expected = File.read("
|
40
|
+
expected = File.read("games/test/t6.pretty-print")
|
41
41
|
# Remove hex object addresses from pretty-printed trees
|
42
42
|
assert_equal(got.gsub(/0x\h+/, ""), expected.gsub(/0x\h+/, ""))
|
43
43
|
end
|
@@ -46,9 +46,9 @@ class TestCompile < Test::Unit::TestCase #:nodoc:
|
|
46
46
|
game = ScottKit::Game.new({})
|
47
47
|
f = StringIO.new
|
48
48
|
withIO(nil, f) do
|
49
|
-
game.compile_to_stdout("
|
49
|
+
game.compile_to_stdout("games/test/crystal.sck") or
|
50
50
|
raise "couldn't compile crystal.sck"
|
51
51
|
end
|
52
|
-
assert_equal(f.string, File.read("
|
52
|
+
assert_equal(f.string, File.read("games/test/crystal.sao"))
|
53
53
|
end
|
54
54
|
end
|
data/test/test_decompile.rb
CHANGED
@@ -5,9 +5,9 @@ require 'stringio'
|
|
5
5
|
class TestDecompile < Test::Unit::TestCase #:nodoc:
|
6
6
|
def test_decompile_crystal
|
7
7
|
game = ScottKit::Game.new({})
|
8
|
-
game.load(IO.read("
|
8
|
+
game.load(IO.read("games/test/crystal.sao"))
|
9
9
|
f = StringIO.new()
|
10
10
|
game.decompile(f)
|
11
|
-
assert_equal(f.string, File.read("
|
11
|
+
assert_equal(f.string, File.read("games/test/crystal.decompile"))
|
12
12
|
end
|
13
13
|
end
|
data/test/test_play.rb
CHANGED
@@ -9,12 +9,12 @@ class TestPlay < Test::Unit::TestCase #:nodoc:
|
|
9
9
|
|
10
10
|
def play(name)
|
11
11
|
game = ScottKit::Game.new({ :read_file =>
|
12
|
-
"
|
12
|
+
"games/test/#{name}.solution",
|
13
13
|
:random_seed => 12368, :no_wait => true })
|
14
|
-
game.load(IO.read("
|
14
|
+
game.load(IO.read("games/test/#{name}.sao"))
|
15
15
|
f = StringIO.new
|
16
16
|
withIO(nil, f) { game.play }
|
17
|
-
expected = File.read("
|
17
|
+
expected = File.read("games/test/#{name}.transcript")
|
18
18
|
assert_equal(expected, f.string)
|
19
19
|
end
|
20
20
|
end
|
data/test/test_playadams.rb
CHANGED
@@ -12,17 +12,17 @@ class TestPlayAdams < Test::Unit::TestCase #:nodoc:
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def play(name)
|
15
|
-
gamefile = "
|
15
|
+
gamefile = "games/adams/#{name}.dat"
|
16
16
|
|
17
17
|
if(File::readable?(gamefile))
|
18
18
|
game = ScottKit::Game.new({ :read_file =>
|
19
|
-
"
|
19
|
+
"games/test/adams/#{name}.solution",
|
20
20
|
:random_seed => 12368, :no_wait => true })
|
21
21
|
game.load(IO.read gamefile)
|
22
22
|
f = StringIO.new
|
23
23
|
withIO(nil, f) { game.play }
|
24
24
|
digest = Digest::MD5.hexdigest(f.string)
|
25
|
-
expected = File.read("
|
25
|
+
expected = File.read("games/test/adams/#{name}.transcript.md5").chomp
|
26
26
|
assert_equal(expected, digest)
|
27
27
|
else
|
28
28
|
if self.respond_to? :skip
|
data/test/test_save.rb
CHANGED
@@ -9,23 +9,23 @@ class TestSave < Test::Unit::TestCase #:nodoc:
|
|
9
9
|
|
10
10
|
def test_save_crystal
|
11
11
|
game = ScottKit::Game.new({ :random_seed => 12368, :echo_input => true })
|
12
|
-
game.load(IO.read("
|
13
|
-
withIO(File.new("
|
12
|
+
game.load(IO.read("games/test/crystal.sao"))
|
13
|
+
withIO(File.new("games/test/crystal.save-script"),
|
14
14
|
File.new("/dev/null", "w")) do
|
15
15
|
game.play()
|
16
16
|
end
|
17
|
-
assert_equal(File.read("TMP"), File.read("
|
17
|
+
assert_equal(File.read("TMP"), File.read("games/test/crystal.save-file"))
|
18
18
|
File.unlink "TMP"
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_resave_crystal
|
22
22
|
game = ScottKit::Game.new({ :random_seed => 12368, :echo_input => true,
|
23
|
-
:restore_file => "
|
24
|
-
game.load(IO.read("
|
23
|
+
:restore_file => "games/test/crystal.save-file" })
|
24
|
+
game.load(IO.read("games/test/crystal.sao"))
|
25
25
|
withIO(StringIO.new("save game\nTMP"), File.new("/dev/null", "w")) do
|
26
26
|
game.play()
|
27
27
|
end
|
28
|
-
assert_equal(File.read("TMP"), File.read("
|
28
|
+
assert_equal(File.read("TMP"), File.read("games/test/crystal.save-file"))
|
29
29
|
File.unlink "TMP"
|
30
30
|
end
|
31
31
|
end
|
metadata
CHANGED
@@ -1,15 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scottkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Taylor
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
12
|
-
dependencies:
|
11
|
+
date: 2017-10-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '12.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '12.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: jeweler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: test-unit
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.2.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.2.0
|
13
55
|
description: ScottKit is a toolkit for compiling, decompiling and playing adventure
|
14
56
|
games in the Scott Adams format.
|
15
57
|
email: mike@miketaylor.org.uk
|
@@ -21,83 +63,87 @@ extra_rdoc_files:
|
|
21
63
|
- ChangeLog.md
|
22
64
|
- README.md
|
23
65
|
files:
|
66
|
+
- ".travis.yml"
|
24
67
|
- ".yardopts"
|
25
68
|
- ChangeLog.md
|
26
69
|
- GPL-2.txt
|
70
|
+
- Gemfile
|
27
71
|
- README.md
|
28
72
|
- Rakefile
|
29
73
|
- VERSION
|
30
74
|
- bin/md5ruby
|
31
75
|
- bin/scottkit
|
32
|
-
-
|
33
|
-
-
|
34
|
-
-
|
35
|
-
-
|
36
|
-
-
|
37
|
-
-
|
38
|
-
-
|
39
|
-
-
|
40
|
-
-
|
41
|
-
-
|
42
|
-
-
|
43
|
-
-
|
44
|
-
-
|
45
|
-
-
|
46
|
-
-
|
47
|
-
-
|
48
|
-
-
|
49
|
-
-
|
50
|
-
-
|
51
|
-
-
|
52
|
-
-
|
53
|
-
-
|
54
|
-
-
|
55
|
-
-
|
56
|
-
-
|
57
|
-
-
|
58
|
-
-
|
59
|
-
-
|
60
|
-
-
|
61
|
-
-
|
62
|
-
-
|
63
|
-
-
|
64
|
-
-
|
65
|
-
-
|
66
|
-
-
|
67
|
-
-
|
68
|
-
-
|
69
|
-
-
|
70
|
-
-
|
71
|
-
-
|
72
|
-
-
|
73
|
-
-
|
74
|
-
-
|
75
|
-
-
|
76
|
-
-
|
77
|
-
-
|
78
|
-
-
|
79
|
-
-
|
80
|
-
-
|
81
|
-
-
|
82
|
-
-
|
83
|
-
-
|
84
|
-
-
|
85
|
-
-
|
86
|
-
-
|
87
|
-
-
|
88
|
-
-
|
89
|
-
-
|
76
|
+
- docs/notes/Definition-saved-game.txt
|
77
|
+
- docs/notes/Definition-scottfree-1.14.txt
|
78
|
+
- docs/notes/Definition.txt
|
79
|
+
- docs/notes/adventureland-maze
|
80
|
+
- docs/notes/continue-action
|
81
|
+
- docs/reference.md
|
82
|
+
- docs/tutorial.md
|
83
|
+
- games/.gitignore
|
84
|
+
- games/adams/.gitignore
|
85
|
+
- games/adams/AdamsGames.zip
|
86
|
+
- games/adams/Makefile
|
87
|
+
- games/crystal/crystal.map
|
88
|
+
- games/crystal/crystal.sck
|
89
|
+
- games/crystal/crystal.solution
|
90
|
+
- games/dan-and-matt/dan-and-matt.sck
|
91
|
+
- games/dan-and-matt/dan-and-matt.solution
|
92
|
+
- games/howarth/.gitignore
|
93
|
+
- games/howarth/Makefile
|
94
|
+
- games/howarth/mysterious.tar.gz
|
95
|
+
- games/nosferatu/.gitignore
|
96
|
+
- games/nosferatu/Makefile
|
97
|
+
- games/nosferatu/README
|
98
|
+
- games/nosferatu/TODO
|
99
|
+
- games/nosferatu/nosferatu.map
|
100
|
+
- games/nosferatu/nosferatu.regression
|
101
|
+
- games/nosferatu/nosferatu.sck
|
102
|
+
- games/nosferatu/nosferatu.sol
|
103
|
+
- games/nosferatu/nosferatu.transcript
|
104
|
+
- games/test/Makefile
|
105
|
+
- games/test/adams/Makefile
|
106
|
+
- games/test/adams/adv01.solution
|
107
|
+
- games/test/adams/adv01.transcript
|
108
|
+
- games/test/adams/adv01.transcript.md5
|
109
|
+
- games/test/adams/adv02.solution
|
110
|
+
- games/test/adams/adv02.transcript
|
111
|
+
- games/test/adams/adv02.transcript.md5
|
112
|
+
- games/test/adams/adv04.solution
|
113
|
+
- games/test/adams/adv04.transcript
|
114
|
+
- games/test/adams/adv04.transcript.md5
|
115
|
+
- games/test/crystal.decompile
|
116
|
+
- games/test/crystal.sao
|
117
|
+
- games/test/crystal.save-file
|
118
|
+
- games/test/crystal.save-script
|
119
|
+
- games/test/crystal.sck
|
120
|
+
- games/test/crystal.solution
|
121
|
+
- games/test/crystal.transcript
|
122
|
+
- games/test/t6.pretty-print
|
123
|
+
- games/test/t6.sck
|
124
|
+
- games/test/t7.sao
|
125
|
+
- games/test/t7.solution
|
126
|
+
- games/test/t7.transcript
|
127
|
+
- games/tutorial/Makefile
|
128
|
+
- games/tutorial/t1.map
|
129
|
+
- games/tutorial/t1.sck
|
130
|
+
- games/tutorial/t2.map
|
131
|
+
- games/tutorial/t2.sck
|
132
|
+
- games/tutorial/t3.map
|
133
|
+
- games/tutorial/t3.sck
|
134
|
+
- games/tutorial/t4.map
|
135
|
+
- games/tutorial/t4.sck
|
136
|
+
- games/tutorial/t5.map
|
137
|
+
- games/tutorial/t5.sck
|
138
|
+
- games/tutorial/t6.sck
|
139
|
+
- games/tutorial/t7.sck
|
140
|
+
- games/tutorial/tutorial.source.md
|
90
141
|
- lib/scottkit/compile.rb
|
91
142
|
- lib/scottkit/decompile.rb
|
92
143
|
- lib/scottkit/game.rb
|
93
144
|
- lib/scottkit/play.rb
|
94
145
|
- lib/scottkit/withio.rb
|
95
|
-
-
|
96
|
-
- notes/Definition-saved-game.txt
|
97
|
-
- notes/Definition-scottfree-1.14.txt
|
98
|
-
- notes/Definition.txt
|
99
|
-
- notes/adventureland-maze
|
100
|
-
- notes/continue-action
|
146
|
+
- scottkit.gemspec
|
101
147
|
- test/test_canonicalise.rb
|
102
148
|
- test/test_compile.rb
|
103
149
|
- test/test_decompile.rb
|