chaos_scenario 0.1 → 0.2
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.md +18 -0
- data/chaos_scenario.gemspec +1 -1
- data/lib/chaos_scenario.rb +4 -1
- data/lib/chaos_scenario/generator.rb +27 -5
- data/lib/data/antagonists.yml +6 -0
- data/lib/data/attempts.yml +7 -0
- data/lib/data/descriptors.yml +14 -0
- data/lib/data/goals.yml +16 -2
- data/lib/data/items.yml +11 -0
- data/lib/data/locations.yml +15 -0
- data/lib/data/origins.yml +9 -0
- data/lib/data/placements.yml +7 -0
- data/lib/data/protagonists.yml +16 -1
- data/lib/data/roles.yml +7 -0
- data/lib/data/scenarios.yml +5 -0
- metadata +30 -38
data/README.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
1
|
# Chaos Scenario
|
2
2
|
|
3
3
|
A random scenario generator.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
```sh
|
8
|
+
$ gem install chaos_scenario
|
9
|
+
```
|
10
|
+
|
11
|
+
...or in your Gemfile:
|
12
|
+
|
13
|
+
```txt
|
14
|
+
require 'chaos_scenario'
|
15
|
+
```
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
ChaosScenario.ensue
|
21
|
+
```
|
data/chaos_scenario.gemspec
CHANGED
data/lib/chaos_scenario.rb
CHANGED
@@ -2,13 +2,35 @@ module ChaosScenario
|
|
2
2
|
module Generator
|
3
3
|
extend self
|
4
4
|
|
5
|
-
def create_scenario
|
6
|
-
|
5
|
+
def create_scenario definition=:scenario
|
6
|
+
scenario = create_string(definition) << "."
|
7
|
+
scenario[0].upcase!
|
8
|
+
scenario
|
7
9
|
end
|
8
10
|
|
9
|
-
def
|
10
|
-
list = YAML.load_file("#{ROOT_PATH}/data/#{
|
11
|
-
list["#{
|
11
|
+
def create_string type
|
12
|
+
list = YAML.load_file("#{ROOT_PATH}/data/#{type}s.yml")
|
13
|
+
input = list["#{type}s"].sample
|
14
|
+
|
15
|
+
phrase = []
|
16
|
+
input.split(" ").each do |word|
|
17
|
+
if word[0] == '@'
|
18
|
+
phrase << create_string(word[1..-1])
|
19
|
+
else
|
20
|
+
phrase << word
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
full_phrase = phrase.flatten.join(" ")
|
25
|
+
full_phrase.gsub!(" ,", ",")
|
26
|
+
full_phrase.gsub!(" 's", "'s")
|
27
|
+
|
28
|
+
# Take care of a/an
|
29
|
+
while (pos = full_phrase.rindex(/(^| )a [aeiou]/i)) != nil
|
30
|
+
full_phrase[pos] = "an"
|
31
|
+
end
|
32
|
+
|
33
|
+
full_phrase
|
12
34
|
end
|
13
35
|
|
14
36
|
end
|
data/lib/data/goals.yml
CHANGED
@@ -1,3 +1,17 @@
|
|
1
1
|
goals:
|
2
|
-
-
|
3
|
-
-
|
2
|
+
- love
|
3
|
+
- a home
|
4
|
+
- the only known antidote
|
5
|
+
- peace of mind
|
6
|
+
- the way out
|
7
|
+
- revenge
|
8
|
+
- vengeance
|
9
|
+
- money and fortune
|
10
|
+
- hidden treasure
|
11
|
+
- their lost loved one
|
12
|
+
- a powerful artifact
|
13
|
+
- to find the sacred @item
|
14
|
+
- to destroy @antagonist 's @item
|
15
|
+
- raze the lair of @antagonist
|
16
|
+
- to recover their mother 's @item
|
17
|
+
- to defeat @antagonist
|
data/lib/data/items.yml
ADDED
data/lib/data/locations.yml
CHANGED
@@ -2,3 +2,18 @@ locations:
|
|
2
2
|
- a nether world
|
3
3
|
- the ruins of an ancient civilization
|
4
4
|
- abandoned subway tunnels
|
5
|
+
- a mystical forest
|
6
|
+
- an underground labyrinth
|
7
|
+
- the botanical gardens
|
8
|
+
- Dracula's castle
|
9
|
+
- a dilapidated industrial facility
|
10
|
+
- a haunted apartment complex
|
11
|
+
- the underworld
|
12
|
+
- a ghostly pirate ship
|
13
|
+
- the seedy underbelly of @origin
|
14
|
+
- a vast desert
|
15
|
+
- the rocky shoreline of @origin
|
16
|
+
- the chamber of the @item
|
17
|
+
- a treetop metropolis
|
18
|
+
- a graveyard
|
19
|
+
- the crater of a volcano
|
data/lib/data/placements.yml
CHANGED
data/lib/data/protagonists.yml
CHANGED
@@ -1,4 +1,19 @@
|
|
1
1
|
protagonists:
|
2
|
-
- man
|
3
2
|
- goat
|
4
3
|
- wizard
|
4
|
+
- monk
|
5
|
+
- sorceress
|
6
|
+
- child
|
7
|
+
- sheep
|
8
|
+
- warrior
|
9
|
+
- ninja
|
10
|
+
- samurai
|
11
|
+
- pilot
|
12
|
+
- spaceship captain
|
13
|
+
- blacksmith
|
14
|
+
- shaman
|
15
|
+
- priestess
|
16
|
+
- vampire
|
17
|
+
- demon
|
18
|
+
- door-to-door salesman
|
19
|
+
- anthromorphic @item
|
data/lib/data/roles.yml
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
scenarios:
|
2
|
+
- A @descriptor @protagonist @placement @location , @attempt @goal
|
3
|
+
- A @protagonist @placement @location , @attempt @goal
|
4
|
+
- A @descriptor @protagonist from @origin @placement @location , @attempt @goal
|
5
|
+
- The @role , a @protagonist , @attempt @goal @placement @location
|
metadata
CHANGED
@@ -1,70 +1,62 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: chaos_scenario
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
version: "0.1"
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.2'
|
5
|
+
prerelease:
|
9
6
|
platform: ruby
|
10
|
-
authors:
|
7
|
+
authors:
|
11
8
|
- Paul Meskers
|
12
9
|
autorequire:
|
13
10
|
bindir: bin
|
14
11
|
cert_chain: []
|
15
|
-
|
16
|
-
date: 2012-09-30 00:00:00 -04:00
|
17
|
-
default_executable:
|
12
|
+
date: 2012-10-02 00:00:00.000000000 Z
|
18
13
|
dependencies: []
|
19
|
-
|
20
14
|
description:
|
21
|
-
email:
|
15
|
+
email:
|
22
16
|
- paul@paulmeskers.com
|
23
17
|
executables: []
|
24
|
-
|
25
18
|
extensions: []
|
26
|
-
|
27
19
|
extra_rdoc_files: []
|
28
|
-
|
29
|
-
files:
|
20
|
+
files:
|
30
21
|
- .gitignore
|
31
22
|
- README.md
|
32
23
|
- chaos_scenario.gemspec
|
33
24
|
- lib/chaos_scenario.rb
|
34
25
|
- lib/chaos_scenario/generator.rb
|
26
|
+
- lib/data/antagonists.yml
|
27
|
+
- lib/data/attempts.yml
|
28
|
+
- lib/data/descriptors.yml
|
35
29
|
- lib/data/goals.yml
|
30
|
+
- lib/data/items.yml
|
36
31
|
- lib/data/locations.yml
|
32
|
+
- lib/data/origins.yml
|
37
33
|
- lib/data/placements.yml
|
38
34
|
- lib/data/protagonists.yml
|
39
|
-
|
35
|
+
- lib/data/roles.yml
|
36
|
+
- lib/data/scenarios.yml
|
40
37
|
homepage:
|
41
|
-
licenses:
|
38
|
+
licenses:
|
42
39
|
- MIT
|
43
40
|
post_install_message:
|
44
41
|
rdoc_options: []
|
45
|
-
|
46
|
-
require_paths:
|
42
|
+
require_paths:
|
47
43
|
- lib
|
48
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
requirements:
|
57
|
-
- -
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
|
60
|
-
- 0
|
61
|
-
version: "0"
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
none: false
|
46
|
+
requirements:
|
47
|
+
- - ! '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
62
56
|
requirements: []
|
63
|
-
|
64
57
|
rubyforge_project:
|
65
|
-
rubygems_version: 1.
|
58
|
+
rubygems_version: 1.8.24
|
66
59
|
signing_key:
|
67
60
|
specification_version: 3
|
68
61
|
summary: Generate random scenarios or plots.
|
69
62
|
test_files: []
|
70
|
-
|