greyhawkweather 0.0.3

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/History.txt ADDED
@@ -0,0 +1,12 @@
1
+ === 0.0.3 2010-12-29
2
+
3
+ * Fixing broken release
4
+
5
+ === 0.0.2 2010-12-29
6
+
7
+ * Prep work for releasing current work as gem
8
+
9
+ === 0.0.1 2010-12-29
10
+
11
+ * 1 major enhancement:
12
+ * Initial release
data/Manifest.txt ADDED
@@ -0,0 +1,39 @@
1
+ History.txt
2
+ Manifest.txt
3
+ PostInstall.txt
4
+ README.rdoc
5
+ Rakefile
6
+ bin/greyweathergen
7
+ data/baselinedata.yml
8
+ data/precipitationoccurance.yml
9
+ lib/baselinedata.rb
10
+ lib/greyhawkweather.rb
11
+ lib/greyhawkweathergenerator.rb
12
+ lib/month.rb
13
+ lib/precipitation.rb
14
+ lib/precipitationinfo.rb
15
+ lib/precipitationoccurance.rb
16
+ lib/singledayweather.rb
17
+ lib/skyconditions.rb
18
+ lib/temperaturerange.rb
19
+ lib/util/dieroller.rb
20
+ lib/weathergenerator.rb
21
+ lib/wind.rb
22
+ script/console
23
+ script/destroy
24
+ script/generate
25
+ test/rollers/avgroller.rb
26
+ test/rollers/riggedroller.rb
27
+ test/test_acceptance.rb
28
+ test/test_dieroller.rb
29
+ test/test_greyhawkweather.rb
30
+ test/test_helper.rb
31
+ test/test_month.rb
32
+ test/test_precipitation.rb
33
+ test/test_precipitation_occurance.rb
34
+ test/test_singledayweather.rb
35
+ test/test_sky_conditions.rb
36
+ test/test_temperature_range.rb
37
+ test/test_weather_generator.rb
38
+ test/test_wind.rb
39
+ todo.org
data/PostInstall.txt ADDED
@@ -0,0 +1,7 @@
1
+
2
+ For more information on greyhawkweather, see http://greyhawkweather.rubyforge.org
3
+
4
+ NOTE: Change this information in PostInstall.txt
5
+ You can also delete it if you don't want it.
6
+
7
+
data/README.rdoc ADDED
@@ -0,0 +1,52 @@
1
+ = greyhawkweather
2
+
3
+ * http://github.com/verdammelt/Greyhawk-Weather
4
+
5
+ == DESCRIPTION:
6
+
7
+ This program will assist in the generation of randomized weather for
8
+ the Greyhawk AD&D Campaign setting. It uses data from the Greyhawk
9
+ Boxed set (circa 1983) for AD&D 1e.
10
+
11
+ The todo.org file lists the "stories" for this project in prioritzed
12
+ order. If a story is marked DONE then it is in theory working.
13
+
14
+ == FEATURES/PROBLEMS:
15
+
16
+ * Generates randomized weather for a given month (28 days)
17
+ * PROBLEM: not yet complete
18
+
19
+ == SYNOPSIS:
20
+
21
+ bin\greyweatheren -month=<monthnum>
22
+
23
+ == REQUIREMENTS:
24
+
25
+ == INSTALL:
26
+
27
+ sudo gem install greyhawkweather
28
+
29
+ == LICENSE:
30
+
31
+ (The MIT License)
32
+
33
+ Copyright (c) 2010 Mark Simpson
34
+
35
+ Permission is hereby granted, free of charge, to any person obtaining
36
+ a copy of this software and associated documentation files (the
37
+ 'Software'), to deal in the Software without restriction, including
38
+ without limitation the rights to use, copy, modify, merge, publish,
39
+ distribute, sublicense, and/or sell copies of the Software, and to
40
+ permit persons to whom the Software is furnished to do so, subject to
41
+ the following conditions:
42
+
43
+ The above copyright notice and this permission notice shall be
44
+ included in all copies or substantial portions of the Software.
45
+
46
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
47
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
48
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
49
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
50
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
51
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
52
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,26 @@
1
+ require 'rubygems'
2
+ gem 'hoe', '>= 2.1.0'
3
+ require 'hoe'
4
+ require 'fileutils'
5
+ require './lib/greyhawkweather'
6
+
7
+ Hoe.plugin :newgem
8
+ # Hoe.plugin :website
9
+ # Hoe.plugin :cucumberfeatures
10
+
11
+ # Generate all the Rake tasks
12
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
13
+ $hoe = Hoe.spec 'greyhawkweather' do
14
+ self.developer 'Mark Simpson', 'verdammelt@gmail.com'
15
+ self.post_install_message = 'PostInstall.txt'
16
+ self.rubyforge_name = self.name
17
+ self.extra_deps = [['rangehash','>= 0.0.1']]
18
+
19
+ end
20
+
21
+ require 'newgem/tasks'
22
+ Dir['tasks/**/*.rake'].each { |t| load t }
23
+
24
+ # TODO - want other tests/tasks run by default? Add them to the list
25
+ # remove_task :default
26
+ # task :default => [:spec, :features]
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/ruby -s
2
+
3
+ # arbitrary defaults: Weather will be generated for 1st of Planting
4
+
5
+ $month ||= 4
6
+ $numdays ||= 28
7
+ $terrain ||= "plains"
8
+
9
+ require 'rubygems'
10
+ gem 'rangehash'
11
+
12
+ require 'YAML'
13
+ require File.dirname(__FILE__) + '/../lib/greyhawkweather'
14
+ require 'GreyhawkWeatherGenerator'
15
+
16
+ weather_generator = GreyhawkWeatherGenerator.create_weather_generator $month.to_i, $numdays.to_i, DieRoller.new, $terrain.to_sym
17
+
18
+ i=0
19
+ weather_generator.days.each do |d|
20
+ i += 1
21
+ p i.to_s + ": " + d.inspect
22
+ end
@@ -0,0 +1,120 @@
1
+ ---
2
+ - :temp_range: !ruby/object:TemperatureRange
3
+ base: 32
4
+ high_adj: [10, 0]
5
+ low_adj: [20, 0]
6
+ :sky_conditions:
7
+ :clear: !ruby/range 24..50
8
+ :partly_cloudy: !ruby/range 24..50
9
+ :cloudy: !ruby/range 51..100
10
+ :precipitation_chance: 46
11
+
12
+ - :temp_range: !ruby/object:TemperatureRange
13
+ base: 34
14
+ high_adj: [6, 4]
15
+ low_adj: [10, 4]
16
+ :sky_conditions:
17
+ :clear: !ruby/range 1..25
18
+ :partly: !ruby/range 26..50
19
+ :cloudy: !ruby/range 51..100
20
+ :precipitation_chance: 40
21
+
22
+ - :temp_range: !ruby/object:TemperatureRange
23
+ base: 42
24
+ high_adj: [8, 4]
25
+ low_adj: [10, 4]
26
+ :sky_conditions:
27
+ :clear: !ruby/range 1..27
28
+ :partly: !ruby/range 28..54
29
+ :cloudy: !ruby/range 55..100
30
+ :precipitation_chance: 44
31
+
32
+ - :temp_range: !ruby/object:TemperatureRange
33
+ base: 52
34
+ high_adj: [10, 6]
35
+ low_adj: [8, 4]
36
+ :sky_conditions:
37
+ :clear: !ruby/range 1..20
38
+ :partly: !ruby/range 21..55
39
+ :cloudy: !ruby/range 56..100
40
+ :precipitation_chance: 42
41
+
42
+ - :temp_range: !ruby/object:TemperatureRange
43
+ base: 63
44
+ high_adj: [10, 6]
45
+ low_adj: [10, 6]
46
+ :sky_conditions:
47
+ :clear: !ruby/range 1..20
48
+ :partly: !ruby/range 21..53
49
+ :cloudy: !ruby/range 54..100
50
+ :precipitation_chance: 42
51
+
52
+ - :temp_range: !ruby/object:TemperatureRange
53
+ base: 71
54
+ high_adj: [8, 8]
55
+ low_adj: [6, 6]
56
+ :sky_conditions:
57
+ :clear: !ruby/range 1..20
58
+ :partly: !ruby/range 21..60
59
+ :cloudy: !ruby/range 61..100
60
+ :precipitation_chance: 36
61
+
62
+ - :temp_range: !ruby/object:TemperatureRange
63
+ base: 77
64
+ high_adj: [6, 4]
65
+ low_adj: [6, 6]
66
+ :sky_conditions:
67
+ :clear: !ruby/range 1..22
68
+ :partly: !ruby/range 23..62
69
+ :cloudy: !ruby/range 63..100
70
+ :precipitation_chance: 33
71
+
72
+ - :temp_range: !ruby/object:TemperatureRange
73
+ base: 75
74
+ high_adj: [4, 6]
75
+ low_adj: [6, 6]
76
+ :sky_conditions:
77
+ :clear: !ruby/range 1..25
78
+ :partly: !ruby/range 26..60
79
+ :cloudy: !ruby/range 61..100
80
+ :precipitation_chance: 33
81
+
82
+ - :temp_range: !ruby/object:TemperatureRange
83
+ base: 68
84
+ high_adj: [8, 6]
85
+ low_adj: [8, 6]
86
+ :sky_conditions:
87
+ :clear: !ruby/range 1..33
88
+ :partly: !ruby/range 34..54
89
+ :cloudy: !ruby/range 55..100
90
+ :precipitation_chance: 33
91
+
92
+ - :temp_range: !ruby/object:TemperatureRange
93
+ base: 57
94
+ high_adj: [10, 5]
95
+ low_adj: [10, 5]
96
+ :sky_conditions:
97
+ :clear: !ruby/range 1..35
98
+ :partly: !ruby/range 36..60
99
+ :cloudy: !ruby/range 61..100
100
+ :precipitation_chance: 36
101
+
102
+ - :temp_range: !ruby/object:TemperatureRange
103
+ base: 46
104
+ high_adj: [10, 6]
105
+ low_adj: [10, 4]
106
+ :sky_conditions:
107
+ :clear: !ruby/range 1..20
108
+ :partly: !ruby/range 21..50
109
+ :cloudy: !ruby/range 51..100
110
+ :precipitation_chance: 40
111
+
112
+ - :temp_range: !ruby/object:TemperatureRange
113
+ base: 33
114
+ high_adj: [8, 5]
115
+ low_adj: [20, 0]
116
+ :sky_conditions:
117
+ :clear: !ruby/range 1..25
118
+ :partly: !ruby/range 26..50
119
+ :cloudy: !ruby/range 51..100
120
+ :precipitation_chance: 43
@@ -0,0 +1,112 @@
1
+ ---
2
+ !ruby/range 01..02:
3
+ :name: Blizzard, heavy
4
+ :max_temp: 10
5
+ :chance_to_continue: 5
6
+ :not_allowed_in: [:desert]
7
+
8
+ !ruby/range 03..05:
9
+ :name: Blizzard
10
+ :max_temp: 20
11
+ :chance_to_continue: 10
12
+ :not_allowed_in: [:desert]
13
+
14
+ !ruby/range 06..10:
15
+ :name: Snowstorm, heavy
16
+ :max_temp: 25
17
+ :chance_to_continue: 20
18
+
19
+ !ruby/range 11..20:
20
+ :name: Snowstorm, light
21
+ :max_temp: 35
22
+ :chance_to_continue: 25
23
+ :chance_of_rainbow: 1
24
+
25
+ !ruby/range 21..25:
26
+ :name: Sleetstorm
27
+ :max_temp: 35
28
+ :chance_to_continue: 20
29
+
30
+ !ruby/range 26..27:
31
+ :name: Hailstorm
32
+ :max_temp: 65
33
+ :chance_to_continue: 10
34
+ :not_allowed_in: [:desert, :dust]
35
+
36
+ !ruby/range 28..30:
37
+ :name: Fog, heavy
38
+ :min_temp: 20
39
+ :max_temp: 60
40
+ :chance_to_continue: 25
41
+ :chance_of_rainbow: 1
42
+ :not_allowed_in: [:desert, :dust]
43
+
44
+ !ruby/range 31..38:
45
+ :name: Fog, light
46
+ :min_temp: 30
47
+ :max_temp: 70
48
+ :chance_to_continue: 30
49
+ :chance_of_rainbow: 3
50
+ :not_allowed_in: [:desert]
51
+
52
+ !ruby/range 39..40:
53
+ :name: Mist
54
+ :min_temp: 30
55
+ :chance_to_continue: 15
56
+ :chance_of_rainbow: 10
57
+
58
+ !ruby/range 41..45:
59
+ :name: Drizzle
60
+ :min_temp: 25
61
+ :chance_to_continue: 20
62
+ :chance_of_rainbow: 5
63
+
64
+ !ruby/range 46..60:
65
+ :name: Rainstorm, light
66
+ :min_temp: 25
67
+ :chance_to_continue: 45
68
+ :chance_of_rainbow: 15
69
+
70
+ !ruby/range 61..70:
71
+ :name: Rainstorm, heavy
72
+ :min_temp: 25
73
+ :chance_to_continue: 30
74
+ :chance_of_rainbow: 20
75
+
76
+ !ruby/range 71..84:
77
+ :name: Thunderstorm
78
+ :min_temp: 30
79
+ :chance_to_continue: 15
80
+ :chance_of_rainbow: 20
81
+
82
+ !ruby/range 85..89:
83
+ :name: Tropical storm
84
+ :min_temp: 40
85
+ :chance_to_continue: 20
86
+ :chance_of_rainbow: 10
87
+ :not_allowed_in: [:desert, :plains]
88
+
89
+ !ruby/range 90..94:
90
+ :name: Monsoon
91
+ :min_temp: 55
92
+ :chance_to_continue: 30
93
+ :chance_of_rainbow: 5
94
+ :not_allowed_in: [:desert, :dust, :plains]
95
+
96
+ !ruby/range 95..97:
97
+ :name: Gale
98
+ :min_temp: 40
99
+ :chance_to_continue: 15
100
+ :chance_of_rainbow: 10
101
+ :not_allowed_in: [:desert]
102
+
103
+ !ruby/range 98..99:
104
+ :name: Hurrican or Typhoon
105
+ :min_temp: 55
106
+ :chance_to_continue: 20
107
+ :chance_of_rainbow: 5
108
+ :not_allowed_in: [:desert, :dust]
109
+
110
+ 100:
111
+ :name: Special
112
+
@@ -0,0 +1,28 @@
1
+ require 'YAML'
2
+
3
+ require 'temperaturerange'
4
+ require 'skyconditions'
5
+ require 'month'
6
+
7
+ class BaselineData
8
+ def self.load (file)
9
+ BaselineData.new(YAML.load_file(file))
10
+ end
11
+
12
+ def initialize(data)
13
+ @all_data = data
14
+ end
15
+
16
+ def num_months
17
+ @all_data.length
18
+ end
19
+
20
+ def month(monthnum)
21
+ month_data = @all_data[monthnum -1]
22
+ Month.new(month_data[:temp_range], make_skyconditions(month_data[:sky_conditions]), month_data[:precipitation_chance])
23
+ end
24
+
25
+ def make_skyconditions(condition_hash)
26
+ SkyConditions.new condition_hash[:clear], condition_hash[:partly], condition_hash[:cloudy]
27
+ end
28
+ end
@@ -0,0 +1,6 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
+
4
+ module Greyhawkweather
5
+ VERSION = '0.0.3'
6
+ end
@@ -0,0 +1,15 @@
1
+ require 'baselinedata'
2
+ require 'util/dieroller'
3
+ require 'weathergenerator'
4
+
5
+ class GreyhawkWeatherGenerator
6
+ def self.create_weather_generator (month_index, num_days = 1, dieroller = DieRoller.new, terrain = :plains)
7
+ WeatherGenerator.new(BaselineData.load("data/baselinedata.yml"),
8
+ PrecipitationOccurance.load("data/precipitationoccurance.yml"),
9
+ month_index,
10
+ num_days,
11
+ dieroller,
12
+ terrain)
13
+ end
14
+ end
15
+