scottkit 0.0.0 → 0.1.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.
- data/README +13 -2
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/bin/scottkit +39 -18
- data/test/test_canonicalise.rb +1 -1
- data/test/test_compile.rb +1 -1
- data/test/test_play.rb +1 -1
- data/test/test_playadams.rb +1 -1
- data/test/test_save.rb +1 -1
- data/test/withio_test.rb +1 -1
- metadata +16 -8
- data/bin/scottkit.rb +0 -96
- /data/{test → lib/scottkit}/withio.rb +0 -0
data/README
CHANGED
@@ -70,6 +70,17 @@ STILL TO DO
|
|
70
70
|
* Tweak compiler to break actions when they need too many arguments as
|
71
71
|
well as when they need too many instructions.
|
72
72
|
* Write tutorial scaffolding.
|
73
|
-
*
|
74
|
-
*
|
73
|
+
* Write other documentation, e.g. reference guide.
|
74
|
+
* Ensure that the right files are built by rdoc.
|
75
|
+
* Figure out where the changelog is supposed to be and what format is
|
76
|
+
standard.
|
77
|
+
* Write blog entry about learning language vs. packaging culture
|
78
|
+
* Move git repo to one of the standard places.
|
79
|
+
|
80
|
+
|
81
|
+
CHANGES
|
82
|
+
|
83
|
+
0.1.0 Add -p option to compile and play a game from source.
|
84
|
+
|
85
|
+
0.0.0 Initial release.
|
75
86
|
|
data/Rakefile
CHANGED
@@ -6,7 +6,7 @@ begin
|
|
6
6
|
Jeweler::Tasks.new do |gem|
|
7
7
|
gem.name = "scottkit"
|
8
8
|
gem.summary = "ScottKit is a toolkit for compiling, decompiling and playing adventure games in the Scott Adams format."
|
9
|
-
gem.description =
|
9
|
+
gem.description = gem.summary
|
10
10
|
gem.email = "mike@miketaylor.org.uk"
|
11
11
|
gem.homepage = "http://www.miketaylor.org.uk/tech/advent/scottkit/"
|
12
12
|
gem.author = "Mike Taylor"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.1.0
|
data/bin/scottkit
CHANGED
@@ -6,6 +6,8 @@
|
|
6
6
|
# scottkit -c game.sck > game.sao # compile
|
7
7
|
# scottkit game.sao # play the game; or use scottfree game.sao
|
8
8
|
# scottkit -d game.sao # decompile -- useful for cheating
|
9
|
+
# And the --play-from-source shortcut does not need an object file:
|
10
|
+
# scottkit -p game.sck
|
9
11
|
#
|
10
12
|
# Other command-line arguments enable wizard commands, load saved
|
11
13
|
# games, set random seeds and enable various kinds of debugging
|
@@ -14,16 +16,32 @@
|
|
14
16
|
require 'optparse'
|
15
17
|
require 'stringio'
|
16
18
|
require 'scottkit/game'
|
19
|
+
require 'scottkit/withio'
|
17
20
|
|
18
|
-
|
21
|
+
|
22
|
+
def play(game)
|
23
|
+
# Decompile (and discard result) to get entity names resolved in
|
24
|
+
# right order. This ensures that debugging output that uses these
|
25
|
+
# names will use them in the same way as decompiler output.
|
26
|
+
dummy = StringIO.new
|
27
|
+
game.decompile(dummy)
|
28
|
+
game.play
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
mode = :play
|
19
33
|
options = {}
|
34
|
+
compile, decompile, play_from_source = false, false, false
|
20
35
|
opts = OptionParser.new do |x|
|
21
36
|
x.banner = "Usage: #$0 [options] [<data-file>]"
|
22
37
|
x.on("-c", "--compile", "Compile <data-file> instead of loading") {
|
23
|
-
|
38
|
+
mode = :compile
|
24
39
|
}
|
25
40
|
x.on("-d", "--decompile", "Decompile instead of playing") {
|
26
|
-
|
41
|
+
mode = :decompile
|
42
|
+
}
|
43
|
+
x.on("-p", "--play-from-source", "Compile and play from source") {
|
44
|
+
mode = :play_from_source
|
27
45
|
}
|
28
46
|
x.on("-w", "--wizard", "Wizard mode (enabled debugging commands)") {
|
29
47
|
options[:wizard_mode] = true
|
@@ -72,25 +90,28 @@ rescue
|
|
72
90
|
end
|
73
91
|
|
74
92
|
game = ScottKit::Game.new(options)
|
75
|
-
|
93
|
+
case mode
|
94
|
+
when :play_from_source
|
95
|
+
f = StringIO.new
|
96
|
+
withIO(nil, f) do
|
97
|
+
if !game.compile_to_stdout(ARGV[0])
|
98
|
+
$stderr.puts "#$0: compilation failed: not playing"
|
99
|
+
exit 1
|
100
|
+
end
|
101
|
+
end
|
102
|
+
game.load(f.string)
|
103
|
+
play(game)
|
104
|
+
when :compile
|
76
105
|
if !game.compile_to_stdout(ARGV[0])
|
77
106
|
$stderr.puts "#$0: compilation failed"
|
78
107
|
exit 1
|
79
|
-
else
|
80
|
-
exit 0
|
81
108
|
end
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
if (decompile)
|
86
|
-
f = StringIO.new()
|
109
|
+
when :decompile
|
110
|
+
game.load(IO.read(ARGV[0]))
|
111
|
+
f = StringIO.new
|
87
112
|
game.decompile(f)
|
88
113
|
print f.string
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
# names will use them in the same way as decompiler output.
|
93
|
-
dummy = StringIO.new()
|
94
|
-
game.decompile(dummy)
|
95
|
-
game.play()
|
114
|
+
when :play
|
115
|
+
game.load(IO.read(ARGV[0]))
|
116
|
+
play(game)
|
96
117
|
end
|
data/test/test_canonicalise.rb
CHANGED
data/test/test_compile.rb
CHANGED
data/test/test_play.rb
CHANGED
data/test/test_playadams.rb
CHANGED
data/test/test_save.rb
CHANGED
data/test/withio_test.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scottkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Mike Taylor
|
@@ -13,7 +18,7 @@ date: 2010-02-28 00:00:00 +00:00
|
|
13
18
|
default_executable: scottkit
|
14
19
|
dependencies: []
|
15
20
|
|
16
|
-
description:
|
21
|
+
description: ScottKit is a toolkit for compiling, decompiling and playing adventure games in the Scott Adams format.
|
17
22
|
email: mike@miketaylor.org.uk
|
18
23
|
executables:
|
19
24
|
- scottkit
|
@@ -29,7 +34,6 @@ files:
|
|
29
34
|
- Rakefile
|
30
35
|
- VERSION
|
31
36
|
- bin/scottkit
|
32
|
-
- bin/scottkit.rb
|
33
37
|
- data/.gitignore
|
34
38
|
- data/adams/.gitignore
|
35
39
|
- data/adams/AdamsGames.zip
|
@@ -75,6 +79,7 @@ files:
|
|
75
79
|
- lib/scottkit/decompile.rb
|
76
80
|
- lib/scottkit/game.rb
|
77
81
|
- lib/scottkit/play.rb
|
82
|
+
- lib/scottkit/withio.rb
|
78
83
|
- notes/Definition
|
79
84
|
- notes/Definition.saved-game
|
80
85
|
- notes/Definition.scottfree-1.14
|
@@ -86,10 +91,11 @@ files:
|
|
86
91
|
- test/test_play.rb
|
87
92
|
- test/test_playadams.rb
|
88
93
|
- test/test_save.rb
|
89
|
-
- test/withio.rb
|
90
94
|
- test/withio_test.rb
|
91
95
|
has_rdoc: true
|
92
96
|
homepage: http://www.miketaylor.org.uk/tech/advent/scottkit/
|
97
|
+
licenses: []
|
98
|
+
|
93
99
|
post_install_message:
|
94
100
|
rdoc_options:
|
95
101
|
- --charset=UTF-8
|
@@ -99,20 +105,22 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
99
105
|
requirements:
|
100
106
|
- - ">="
|
101
107
|
- !ruby/object:Gem::Version
|
108
|
+
segments:
|
109
|
+
- 0
|
102
110
|
version: "0"
|
103
|
-
version:
|
104
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
112
|
requirements:
|
106
113
|
- - ">="
|
107
114
|
- !ruby/object:Gem::Version
|
115
|
+
segments:
|
116
|
+
- 0
|
108
117
|
version: "0"
|
109
|
-
version:
|
110
118
|
requirements: []
|
111
119
|
|
112
120
|
rubyforge_project:
|
113
|
-
rubygems_version: 1.3.
|
121
|
+
rubygems_version: 1.3.6
|
114
122
|
signing_key:
|
115
|
-
specification_version:
|
123
|
+
specification_version: 3
|
116
124
|
summary: ScottKit is a toolkit for compiling, decompiling and playing adventure games in the Scott Adams format.
|
117
125
|
test_files: []
|
118
126
|
|
data/bin/scottkit.rb
DELETED
@@ -1,96 +0,0 @@
|
|
1
|
-
#!/usr/local/bin/ruby1.9 -w
|
2
|
-
|
3
|
-
# Command-line driver for the ScottKit toolkit, allowing Scott
|
4
|
-
# Adams-format adventure games to be compiled, decompiled and played.
|
5
|
-
# The three basic modes are invoked as follows:
|
6
|
-
# scottkit -c game.sck > game.sao # compile
|
7
|
-
# scottkit game.sao # play the game; or use scottfree game.sao
|
8
|
-
# scottkit -d game.sao # decompile -- useful for cheating
|
9
|
-
#
|
10
|
-
# Other command-line arguments enable wizard commands, load saved
|
11
|
-
# games, set random seeds and enable various kinds of debugging
|
12
|
-
# output: run <tt>scottkit -h</tt> for details.
|
13
|
-
|
14
|
-
require 'optparse'
|
15
|
-
require 'stringio'
|
16
|
-
require 'scottkit/game'
|
17
|
-
|
18
|
-
compile, decompile = false, false
|
19
|
-
options = {}
|
20
|
-
opts = OptionParser.new do |x|
|
21
|
-
x.banner = "Usage: #$0 [options] [<data-file>]"
|
22
|
-
x.on("-c", "--compile", "Compile <data-file> instead of loading") {
|
23
|
-
compile = true
|
24
|
-
}
|
25
|
-
x.on("-d", "--decompile", "Decompile instead of playing") {
|
26
|
-
decompile = true
|
27
|
-
}
|
28
|
-
x.on("-w", "--wizard", "Wizard mode (enabled debugging commands)") {
|
29
|
-
options[:wizard_mode] = true
|
30
|
-
}
|
31
|
-
x.on("-l", "--load-game FILE", "Load a previously saved game") { |file|
|
32
|
-
options[:restore_file] = file
|
33
|
-
}
|
34
|
-
x.on("-f", "--read-file FILE", "Read initial commands from file") { |file|
|
35
|
-
options[:read_file] = file
|
36
|
-
}
|
37
|
-
x.on("-e", "--echo", "Echo input commands to output") {
|
38
|
-
options[:echo_input] = true
|
39
|
-
}
|
40
|
-
x.on("-s", "--random-seed VAL", "Set random seed for repeatability") { |val|
|
41
|
-
options[:random_seed] = Integer(val)
|
42
|
-
}
|
43
|
-
x.on("-b", "--bug-tolerant", "Copy with out-of-range locations, etc.") {
|
44
|
-
options[:bug_tolerant] = true
|
45
|
-
}
|
46
|
-
x.on("-W", "--no-wait", "Do not wait on pause actions or death") {
|
47
|
-
options[:no_wait] = true
|
48
|
-
}
|
49
|
-
x.on("-T", "--show-tokens", "Show lexical tokens as they are read") {
|
50
|
-
options[:show_tokens] = true
|
51
|
-
}
|
52
|
-
x.on("-R", "--show-random", "Show rolls of the random dice") {
|
53
|
-
options[:show_random] = true
|
54
|
-
}
|
55
|
-
x.on("-P", "--show-parse", "Show results of parsing verb/noun") {
|
56
|
-
options[:show_parse] = true
|
57
|
-
}
|
58
|
-
x.on("-C", "--show-conditions", "Show conditions being evaluated") {
|
59
|
-
options[:show_conditions] = true
|
60
|
-
}
|
61
|
-
x.on("-I", "--show-instructions", "Show instructions being executed") {
|
62
|
-
options[:show_instructions] = true
|
63
|
-
}
|
64
|
-
end
|
65
|
-
|
66
|
-
begin
|
67
|
-
opts.parse!(ARGV)
|
68
|
-
raise "#$0: No data-file specified" if ARGV.size != 1
|
69
|
-
rescue
|
70
|
-
$stderr.puts $!, opts
|
71
|
-
exit 1
|
72
|
-
end
|
73
|
-
|
74
|
-
game = ScottKit::Game.new(options)
|
75
|
-
if (compile)
|
76
|
-
if !game.compile_to_stdout(ARGV[0])
|
77
|
-
$stderr.puts "#$0: compilation failed"
|
78
|
-
exit 1
|
79
|
-
else
|
80
|
-
exit 0
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
game.load(IO.read(ARGV[0]))
|
85
|
-
if (decompile)
|
86
|
-
f = StringIO.new()
|
87
|
-
game.decompile(f)
|
88
|
-
print f.string
|
89
|
-
else
|
90
|
-
# Decompile (and discard result) to get entity names resolved in
|
91
|
-
# right order. This ensures that debugging output that uses these
|
92
|
-
# names will use them in the same way as decompiler output.
|
93
|
-
dummy = StringIO.new()
|
94
|
-
game.decompile(dummy)
|
95
|
-
game.play()
|
96
|
-
end
|
File without changes
|