shattered_model 0.3.1 → 0.3.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/lib/base.rb CHANGED
@@ -1,21 +1,26 @@
1
+ require 'shattered_support'
1
2
  include ShatteredSupport
2
3
 
3
- module ShatteredModel
4
+ module ShatteredModel #:nodoc:
4
5
  def self.append_features(base)
5
6
  super
6
7
  base.extend(ClassMethods)
7
8
  end
8
- module ClassMethods
9
- def fuzzy_logic( file )
9
+ module ClassMethods #:nodoc:
10
+ def fuzzy_logic( file )
10
11
  before_init_set("self", {:fuzzy_logic => [file]})
11
12
  end
12
13
  end
14
+ # Models encompass all of the game play logic and the game specific data.
15
+ #
16
+ # Models are useful for unit tests and for making game rules.
17
+ # They are where all logic (AI/collisions/etc) go.
13
18
  class Base < ShatteredSupport::Base
14
- def fuzzy_logic=(file)
19
+ def fuzzy_logic=(file) #:nodoc:
15
20
  @fuzzy_logic = FuzzyLogic.new
16
21
  @fuzzy_logic.parse_fuzzy_file(File.dirname(__FILE__)+"/#{file}")
17
22
  end
18
- def update_fuzzy_logic
23
+ def update_fuzzy_logic #:nodoc:
19
24
  @fuzzy_logic.update(self)
20
25
  end
21
26
  end
data/lib/fuzzy_logic.rb CHANGED
@@ -6,7 +6,7 @@ require 'yaml'
6
6
  # player_logic.add_classification( :hp, :dieing, :hp, :max => 5, :min => 45 )
7
7
  # player_logic.add_classification( :hp, :healthy, :max => 80, :min => 65 )
8
8
  # player_logic.hp(15) => [[:dieing, 0.75], [:healthy, 0.0]]
9
- class FuzzyLogic
9
+ class FuzzyLogic #:nodoc:
10
10
  attr_reader :consequences
11
11
  def initialize
12
12
  @attributes = {}
@@ -1,7 +1,7 @@
1
1
  # This provides basic linear interpolation between any number of arbitrarily defined points.
2
2
  # It is used for fuzzy logic. Although, fuzzy logic based on a statistically normal curve
3
3
  # provides best results, linear interpolation provides a "gud 'nuf" approach.
4
- class LinearInterpolator
4
+ class LinearInterpolator #:nodoc:
5
5
  def add_point(x,y)
6
6
  @points ||= []
7
7
  @points << [x,y]
@@ -1,10 +1,3 @@
1
- begin
2
- # require File.dirname(__FILE__) + '/../../shattered_support/lib/shattered_support'
3
- require 'shattered_support'
4
- rescue MissingSourceFile
5
- require 'rubygems'
6
- require 'shattered_support'
7
- end
8
1
 
9
2
  require File.dirname(__FILE__) + '/base'
10
3
  require File.dirname(__FILE__) + '/fuzzy_logic'
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.10
3
3
  specification_version: 1
4
4
  name: shattered_model
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.3.1
7
- date: 2006-05-16
6
+ version: 0.3.2
7
+ date: 2006-06-04
8
8
  summary: "Shattered Model: Provides basic commands any game object needs."
9
9
  require_paths:
10
10
  - lib