studio_game 1.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (C) 2012, Dan Brooking
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README ADDED
File without changes
@@ -0,0 +1,6 @@
1
+ Knuckleheads High Scores:
2
+ Klutz............... 2371
3
+ Theo................ 3005
4
+ Berserk............. 4730
5
+ Simon............... 2905
6
+ Alvin............... 2520
data/bin/players.csv ADDED
@@ -0,0 +1,3 @@
1
+ Alvin,100
2
+ Simon,60
3
+ Theo,125
data/bin/studio_game ADDED
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/studio_game/player'
4
+ require_relative '../lib/studio_game/clumsy_player'
5
+ require_relative '../lib/studio_game/berserk_player'
6
+ require_relative '../lib/studio_game/game'
7
+
8
+ player1 = StudioGame::Player.new("moe")
9
+ player2 = StudioGame::Player.new("larry", 60)
10
+ player3 = StudioGame::Player.new("curly", 125)
11
+
12
+ knuckleheads = StudioGame::Game.new("knuckleheads")
13
+
14
+ default_player_file = File.join(File.dirname(__FILE__), 'players.csv')
15
+ knuckleheads.load_players(ARGV.shift || default_player_file)
16
+ knuckleheads.add_player(StudioGame::ClumsyPlayer.new("klutz", 105, 5))
17
+ knuckleheads.add_player(StudioGame::BerserkPlayer.new("berserk", 50))
18
+
19
+ knuckleheads.print_treasures
20
+
21
+ loop do
22
+ puts "How many game rounds? ('quit' to exit)"
23
+ number_of_rounds = gets.chomp.downcase
24
+ case (number_of_rounds)
25
+ when /^\d+$/
26
+ knuckleheads.play(number_of_rounds.to_i)
27
+ when 'quit', 'exit'
28
+ knuckleheads.print_stats
29
+ break
30
+ else
31
+ puts "Please enter a number or 'quit'"
32
+ end
33
+ # do
34
+ # knuckleheads.total_points >= 2000
35
+ # end
36
+ end
37
+
38
+ knuckleheads.save_high_scores
@@ -0,0 +1,7 @@
1
+ module StudioGame
2
+ module Auditable
3
+ def audit
4
+ puts "Rolled a #{self.number_rolled} (#{self.class})"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,34 @@
1
+ require_relative 'player'
2
+
3
+ # class BerserkPlayer < Player
4
+ # def initialize(name, health=100)
5
+ # super(name, health)
6
+ # @w00t_count = 0
7
+ # end
8
+ # end
9
+ module StudioGame
10
+ class BerserkPlayer < Player
11
+
12
+ attr_accessor :w00t_count
13
+
14
+ def initialize(name, health=100)
15
+ super(name, health)
16
+ @w00t_count = 0
17
+ end
18
+
19
+ def berserk?
20
+ @w00t_count > 5
21
+ end
22
+
23
+ def w00t
24
+ puts "I've gone CRAZY!!!" if berserk?
25
+ @w00t_count += 1
26
+ super
27
+ end
28
+
29
+ def blam
30
+ berserk? ? w00t : super
31
+ end
32
+
33
+ end
34
+ end
@@ -0,0 +1,38 @@
1
+ require_relative 'player'
2
+
3
+ module StudioGame
4
+ class ClumsyPlayer < Player
5
+
6
+ attr_reader :boost_factor
7
+
8
+ def initialize(name, health=100, boost=0)
9
+ super(name, health)
10
+ @boost_factor = boost
11
+ end
12
+
13
+ def w00t
14
+ @boost_factor.times { super }
15
+ end
16
+
17
+ def found_treasure(treasure)
18
+ super(Treasure.new(treasure.name, treasure.points / 2))
19
+ end
20
+ end
21
+ end
22
+
23
+ if __FILE__ == $0
24
+ clumsy = ClumsyPlayer.new("klutz")
25
+
26
+ hammer = Treasure.new(:hammer, 50)
27
+ clumsy.found_treasure(hammer)
28
+ clumsy.found_treasure(hammer)
29
+ clumsy.found_treasure(hammer)
30
+
31
+ crowbar = Treasure.new(:crowbar, 400)
32
+ clumsy.found_treasure(crowbar)
33
+
34
+ clumsy.each_found_treasure do |treasure|
35
+ puts "#{treasure.points} total #{treasure.name} points"
36
+ end
37
+ puts "#{clumsy.points} grand total points"
38
+ end
@@ -0,0 +1,19 @@
1
+ require_relative 'auditable'
2
+
3
+ module StudioGame
4
+ class Die
5
+ include Auditable
6
+ attr_reader :number_rolled
7
+
8
+ #def initialize
9
+ # roll
10
+ #end
11
+
12
+ def roll
13
+ @number_rolled = rand(1..6)
14
+ audit
15
+ @number_rolled
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,111 @@
1
+ require_relative 'player'
2
+ require_relative 'die'
3
+ require_relative 'game_turn'
4
+ require_relative 'treasure_trove'
5
+
6
+ module StudioGame
7
+ class Game
8
+
9
+ attr_reader :title, :players
10
+
11
+ def initialize(title)
12
+ @title = title.capitalize
13
+ @players = Array.new
14
+ end
15
+
16
+ def add_player(player)
17
+ @players.push(player)
18
+ end
19
+
20
+ def play(rounds)
21
+ 1.upto(rounds) do |round|
22
+ if block_given?
23
+ break if yield
24
+ end
25
+
26
+ puts "There are #{@players.size} players in #{@title}."
27
+
28
+ @players.each do |p|
29
+ puts p
30
+ end
31
+
32
+ puts "\nRound #{round}:"
33
+ @players.each do |p|
34
+ GameTurn.take_turn(p)
35
+ puts p
36
+ end
37
+ end
38
+ end
39
+
40
+ def print_high_score(p)
41
+ "#{p.name.ljust(20, '.')} #{p.score}"
42
+ end
43
+
44
+ def save_high_scores(filename="high_scores.txt")
45
+ File.open(filename, 'w') do |file|
46
+ file.puts "#{@title} High Scores:"
47
+ @players.sort.each do |p|
48
+ file.puts print_high_score(p)
49
+ end
50
+ end
51
+
52
+ end
53
+
54
+ def load_players(filename)
55
+ File.readlines(filename).each do |line|
56
+ add_player(Player.from_csv(line))
57
+ end
58
+ end
59
+
60
+ def print_name_and_health(player)
61
+ puts "#{player.name} (#{player.health})"
62
+ end
63
+
64
+ def print_stats
65
+
66
+ puts "\n#{@title} Statistics"
67
+
68
+ @players.each do |p|
69
+ puts "\n#{p.name}'s point totals:"
70
+ p.each_found_treasure do |treasure|
71
+ puts "#{treasure.points} total #{treasure.name} points"
72
+ end
73
+ puts "#{p.points} grand total points"
74
+ end
75
+
76
+ strong, wimpy = @players.partition { |p| p.strong? }
77
+
78
+
79
+
80
+ puts "\n#{strong.size} strong players:"
81
+ strong.each do |s|
82
+ print_name_and_health(s)
83
+ end
84
+
85
+ puts "\n#{wimpy.size} wimpy players:"
86
+ wimpy.each do |w|
87
+ print_name_and_health(w)
88
+ end
89
+
90
+ puts "\n#{@title} High Scores:"
91
+ @players.sort.each do |p|
92
+ puts print_high_score(p)
93
+ end
94
+
95
+ puts "\nTotal points found: #{total_points}"
96
+ end
97
+
98
+ def print_treasures
99
+ puts "There are #{TreasureTrove::TREASURES.size} treasures to be found:"
100
+ TreasureTrove::TREASURES.each do |t|
101
+ puts "A #{t.name} is worth #{t.points} points."
102
+ end
103
+ puts "\n"
104
+ end
105
+
106
+ def total_points
107
+ #@players.reduce(0) { |sum, p1.points| sum + p1.points }
108
+ @players.reduce(0) { |sum, player| sum + player.points }
109
+ end
110
+ end
111
+ end
@@ -0,0 +1,25 @@
1
+ require_relative 'die'
2
+ require_relative 'loaded_die'
3
+ require_relative 'player'
4
+ require_relative 'treasure_trove'
5
+
6
+ module StudioGame
7
+ module GameTurn
8
+
9
+ def self.take_turn(player)
10
+ die = StudioGame::Die.new
11
+ case die.roll
12
+ when 1..2
13
+ player.blam
14
+ when 3..4
15
+ puts "#{player.name} skipped!"
16
+ when 5..6
17
+ player.w00t
18
+ end
19
+
20
+ treasure = TreasureTrove.random
21
+ player.found_treasure(treasure)
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,16 @@
1
+ require_relative 'auditable'
2
+
3
+ module StudioGame
4
+ class LoadedDie
5
+ include Auditable
6
+
7
+ attr_reader :number_rolled
8
+
9
+ def roll
10
+ numbers = [1, 1, 2, 5, 6, 6]
11
+ @number_rolled = numbers.sample
12
+ audit
13
+ @number_rolled
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,18 @@
1
+ module StudioGame
2
+ module Playable
3
+
4
+ def blam
5
+ puts "#{name} got blammed!"
6
+ self.health -= 10
7
+ end
8
+
9
+ def w00t
10
+ puts "#{name} got w00ted!"
11
+ self.health += 15
12
+ end
13
+
14
+ def strong?
15
+ self.health > 100
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,60 @@
1
+ require_relative 'treasure_trove'
2
+ require_relative 'playable'
3
+
4
+ module StudioGame
5
+ class Player
6
+ include Playable
7
+
8
+ attr_accessor :name, :health
9
+
10
+ def initialize(name, health=100)
11
+ @name = name.capitalize
12
+ @health = health
13
+ @found_treasures = Hash.new(0)
14
+ end
15
+
16
+ def score
17
+ @health + points
18
+ end
19
+
20
+ def self.from_csv(line)
21
+ name, health = line.split(',')
22
+ Player.new(name, health.to_i)
23
+ end
24
+
25
+ def found_treasure(treasure)
26
+ @found_treasures[treasure.name] += treasure.points
27
+ puts "#{@name} found a #{treasure.name} worth #{treasure.points} points."
28
+ puts "#{@name}'s treasures: #{@found_treasures}"
29
+ end
30
+
31
+ def each_found_treasure
32
+ @found_treasures.each do |name, points|
33
+ treasure = Treasure.new(name, points)
34
+ yield(treasure)
35
+ end
36
+ end
37
+
38
+ def points
39
+ @found_treasures.values.reduce(0, :+)
40
+ end
41
+
42
+ def to_s
43
+ "I'm #{@name} with health = #{@health}, points = #{points}, and score = #{score}."
44
+ end
45
+
46
+ def <=>(player)
47
+ player.health <=> self.health
48
+ end
49
+ end
50
+ end
51
+
52
+ if __FILE__ == $0
53
+ player = Player.new("moe")
54
+ puts player.name
55
+ puts player.health
56
+ player.w00t
57
+ puts player.health
58
+ player.blam
59
+ puts player.health
60
+ end
@@ -0,0 +1,18 @@
1
+ module StudioGame
2
+ Treasure = Struct.new(:name, :points)
3
+
4
+ module TreasureTrove
5
+ TREASURES = [
6
+ Treasure.new(:pie, 5),
7
+ Treasure.new(:bottle, 25),
8
+ Treasure.new(:hammer, 50),
9
+ Treasure.new(:skillet, 100),
10
+ Treasure.new(:broomstick, 200),
11
+ Treasure.new(:crowbar, 400)
12
+ ]
13
+
14
+ def self.random
15
+ TREASURES.sample
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,29 @@
1
+ require 'studio_game/berserk_player'
2
+
3
+ describe StudioGame::BerserkPlayer do
4
+
5
+ before do
6
+ @initial_health = 50
7
+ @player = StudioGame::BerserkPlayer.new("berserker", @initial_health)
8
+ end
9
+
10
+ it "does not go berserk when w00ted up to 5 times" do
11
+ 1.upto(5) { @player.w00t }
12
+
13
+ @player.berserk?.should be_false
14
+ end
15
+
16
+ it "goes berserk when w00ted more than 5 times" do
17
+ 1.upto(6) { @player.w00t }
18
+
19
+ @player.berserk?.should be_true
20
+ end
21
+
22
+ it "gets w00ted instead of blammed when it's gone berserk" do
23
+ 1.upto(6) { @player.w00t }
24
+ 1.upto(2) { @player.blam }
25
+
26
+ @player.health.should == @initial_health + (8 * 15)
27
+ end
28
+
29
+ end
@@ -0,0 +1,49 @@
1
+ require 'studio_game/clumsy_player'
2
+
3
+ describe StudioGame::ClumsyPlayer do
4
+ before do
5
+ @player = StudioGame::ClumsyPlayer.new("klutz")
6
+ end
7
+
8
+ it "only gets half the point value for each treasure" do
9
+ @player.points.should == 0
10
+
11
+ hammer = StudioGame::Treasure.new(:hammer, 50)
12
+ @player.found_treasure(hammer)
13
+ @player.found_treasure(hammer)
14
+ @player.found_treasure(hammer)
15
+
16
+ @player.points.should == 75
17
+
18
+ crowbar = StudioGame::Treasure.new(:crowbar, 400)
19
+ @player.found_treasure(crowbar)
20
+
21
+ @player.points.should == 275
22
+
23
+ yielded = []
24
+ @player.each_found_treasure do |treasure|
25
+ yielded << treasure
26
+ end
27
+
28
+ yielded.should == [StudioGame::Treasure.new(:hammer, 75), StudioGame::Treasure.new(:crowbar, 200)]
29
+ end
30
+
31
+ context "with a boost factor" do
32
+ before do
33
+ @initial_health = 100
34
+ @boost_factor = 5
35
+ @player = StudioGame::ClumsyPlayer.new("klutz", @initial_health, @boost_factor)
36
+ end
37
+
38
+ it "has a boost factor" do
39
+ @player.boost_factor.should == 5
40
+ end
41
+
42
+ it "gets boost factor number of w00ts when w00ted" do
43
+ @player.w00t
44
+
45
+ @player.health.should == @initial_health + (15 * @boost_factor)
46
+ end
47
+ end
48
+
49
+ end
@@ -0,0 +1,90 @@
1
+ require 'studio_game/game'
2
+ require 'studio_game/player'
3
+ require 'studio_game/die'
4
+
5
+ describe StudioGame::Game do
6
+ before do
7
+ @game = StudioGame::Game.new("knuckleheads")
8
+
9
+ @initial_health = 100
10
+ @player = StudioGame::Player.new("moe", @initial_health)
11
+
12
+ @game.add_player(@player)
13
+ end
14
+
15
+ it "blams if it rolls a 1" do
16
+ StudioGame::Die.any_instance.stub(:roll).and_return(1)
17
+
18
+ @game.play(2)
19
+
20
+ @player.health.should == @initial_health - (10 * 2)
21
+ end
22
+
23
+ it "blams if it rolls a 2" do
24
+ StudioGame::Die.any_instance.stub(:roll).and_return(2)
25
+
26
+ @game.play(2)
27
+
28
+ @player.health.should == @initial_health - (10 * 2)
29
+ end
30
+
31
+ it "does nothing if it rolls a 3" do
32
+ StudioGame::Die.any_instance.stub(:roll).and_return(3)
33
+
34
+ @game.play(2)
35
+
36
+ @player.health.should == @initial_health
37
+ end
38
+
39
+ it "does nothing if it rolls a 4" do
40
+ StudioGame::Die.any_instance.stub(:roll).and_return(4)
41
+
42
+ @game.play(2)
43
+
44
+ @player.health.should == @initial_health
45
+ end
46
+
47
+ it "w00ts if it rolls a 5" do
48
+ StudioGame::Die.any_instance.stub(:roll).and_return(5)
49
+
50
+ @game.play(2)
51
+
52
+ @player.health.should == @initial_health + (15 * 2)
53
+ end
54
+
55
+ it "w00ts if it rolls a 6" do
56
+ StudioGame::Die.any_instance.stub(:roll).and_return(6)
57
+
58
+ @game.play(2)
59
+
60
+ @player.health.should == @initial_health + (15 * 2)
61
+ end
62
+
63
+ it "assigns a treasure for points during a player's turn" do
64
+ game = StudioGame::Game.new("Knuckleheads")
65
+ player = StudioGame::Player.new("moe")
66
+
67
+ game.add_player(player)
68
+
69
+ game.play(1)
70
+
71
+ player.points.should_not be_zero
72
+ end
73
+
74
+ it "computes total points as the sum of all player points" do
75
+ game = StudioGame::Game.new("Knuckleheads")
76
+
77
+ player1 = StudioGame::Player.new("moe")
78
+ player2 = StudioGame::Player.new("larry")
79
+
80
+ game.add_player(player1)
81
+ game.add_player(player2)
82
+
83
+ player1.found_treasure(StudioGame::Treasure.new(:hammer, 50))
84
+ player1.found_treasure(StudioGame::Treasure.new(:hammer, 50))
85
+ player2.found_treasure(StudioGame::Treasure.new(:crowbar, 400))
86
+
87
+ game.total_points.should == 500
88
+ end
89
+
90
+ end
@@ -0,0 +1,19 @@
1
+ def conversation
2
+ puts "Hello"
3
+ yield
4
+ puts "Goodbye"
5
+ end
6
+
7
+ conversation { puts "Good to meet you!"}
8
+
9
+ def n_times(number)
10
+ 1.upto(number) do |x|
11
+ yield(x)
12
+ end
13
+ end
14
+
15
+ n_times(10) do |n|
16
+ puts "#{n} situps"
17
+ puts "#{n} pushups"
18
+ puts "#{n} chinups"
19
+ end
@@ -0,0 +1,131 @@
1
+ require 'studio_game/player'
2
+ require 'studio_game/treasure_trove'
3
+
4
+ describe StudioGame::Player do
5
+
6
+ before do
7
+ @initial_health = 150
8
+ @player = StudioGame::Player.new("larry", @initial_health)
9
+ end
10
+
11
+ it "has a capitalized name" do
12
+ @player.name.should == "Larry"
13
+ end
14
+
15
+ it "has an initial health" do
16
+ @player.health.should == 150
17
+ end
18
+
19
+ it "has a string representation" do
20
+ @player.found_treasure(StudioGame::Treasure.new(:hammer, 50))
21
+ @player.found_treasure(StudioGame::Treasure.new(:hammer, 50))
22
+
23
+ @player.to_s.should == "I'm Larry with health = 150, points = 100, and score = 250."
24
+ end
25
+
26
+ it "computes a score as the sum of its health and length of name" do
27
+ @player.score.should == 150
28
+ end
29
+
30
+ it "yields each found treasure and its total points" do
31
+ @player.found_treasure(StudioGame::Treasure.new(:skillet, 100))
32
+ @player.found_treasure(StudioGame::Treasure.new(:skillet, 100))
33
+ @player.found_treasure(StudioGame::Treasure.new(:hammer, 50))
34
+ @player.found_treasure(StudioGame::Treasure.new(:bottle, 5))
35
+ @player.found_treasure(StudioGame::Treasure.new(:bottle, 5))
36
+ @player.found_treasure(StudioGame::Treasure.new(:bottle, 5))
37
+ @player.found_treasure(StudioGame::Treasure.new(:bottle, 5))
38
+ @player.found_treasure(StudioGame::Treasure.new(:bottle, 5))
39
+
40
+ yielded = []
41
+ @player.each_found_treasure do |treasure|
42
+ yielded << treasure
43
+ end
44
+
45
+ yielded.should == [
46
+ StudioGame::Treasure.new(:skillet, 200),
47
+ StudioGame::Treasure.new(:hammer, 50),
48
+ StudioGame::Treasure.new(:bottle, 25)
49
+ ]
50
+ end
51
+
52
+ it "can be created from a CSV string" do
53
+ player = StudioGame::Player.from_csv("larry,150")
54
+
55
+ player.name.should == "Larry"
56
+ player.health.should == 150
57
+ end
58
+
59
+ it "increases health by 15 when w00ted" do
60
+ @player.w00t
61
+
62
+ @player.health.should == @initial_health + 15
63
+ end
64
+
65
+ it "decreases health by 10 when blammed" do
66
+ @player.blam
67
+
68
+ @player.health.should == @initial_health - 10
69
+ end
70
+
71
+ it "computes points as the sum of all treasure points" do
72
+ @player.points.should == 0
73
+
74
+ @player.found_treasure(StudioGame::Treasure.new(:hammer, 50))
75
+
76
+ @player.points.should == 50
77
+
78
+ @player.found_treasure(StudioGame::Treasure.new(:crowbar, 400))
79
+
80
+ @player.points.should == 450
81
+
82
+ @player.found_treasure(StudioGame::Treasure.new(:hammer, 50))
83
+
84
+ @player.points.should == 500
85
+ end
86
+
87
+ it "computes a score as the sum of its health and points" do
88
+ @player.found_treasure(StudioGame::Treasure.new(:hammer, 50))
89
+ @player.found_treasure(StudioGame::Treasure.new(:hammer, 50))
90
+
91
+ @player.score.should == 250
92
+ end
93
+
94
+ context "player with initial health of 150" do
95
+ before do
96
+ @initial_health = 150
97
+ @player = StudioGame::Player.new("larry", @initial_health)
98
+ end
99
+
100
+ it "is strong" do
101
+ @player.should be_strong
102
+ end
103
+ end
104
+
105
+ context "player with initial health of 100" do
106
+ before do
107
+ @initial_health = 100
108
+ @player = StudioGame::Player.new("larry", @initial_health)
109
+ end
110
+
111
+ it "is not strong" do
112
+ @player.should_not be_strong
113
+ end
114
+ end
115
+
116
+ context "in a collection of players" do
117
+ before do
118
+ @player1 = StudioGame::Player.new("moe", 100)
119
+ @player2 = StudioGame::Player.new("larry", 200)
120
+ @player3 = StudioGame::Player.new("curly", 300)
121
+
122
+ @players = [@player1, @player2, @player3]
123
+ end
124
+
125
+ it "is sorted by decreasing score" do
126
+ @players.sort.should == [@player3, @player2, @player1]
127
+ end
128
+ end
129
+
130
+
131
+ end
@@ -0,0 +1,49 @@
1
+ require 'studio_game/treasure_trove'
2
+
3
+ describe StudioGame::Treasure do
4
+
5
+ before do
6
+ @treasure = StudioGame::Treasure.new(:hammer, 50)
7
+ end
8
+
9
+ it "has a name attribute" do
10
+ @treasure.name.should == :hammer
11
+ end
12
+
13
+ it "has a points attribute" do
14
+ @treasure.points.should == 50
15
+ end
16
+
17
+ end
18
+
19
+ describe StudioGame::TreasureTrove do
20
+
21
+ it "has six treasures" do
22
+ StudioGame::TreasureTrove::TREASURES.size.should == 6
23
+ end
24
+
25
+ it "has a pie worth 5 points" do
26
+ StudioGame::TreasureTrove::TREASURES[0].should == StudioGame::Treasure.new(:pie, 5)
27
+ end
28
+
29
+ it "has a bottle worth 25 points" do
30
+ StudioGame::TreasureTrove::TREASURES[1].should == StudioGame::Treasure.new(:bottle, 25)
31
+ end
32
+
33
+ it "has a hammer worth 50 points" do
34
+ StudioGame::TreasureTrove::TREASURES[2].should == StudioGame::Treasure.new(:hammer, 50)
35
+ end
36
+
37
+ it "has a skillet worth 100 points" do
38
+ StudioGame::TreasureTrove::TREASURES[3].should == StudioGame::Treasure.new(:skillet, 100)
39
+ end
40
+
41
+ it "has a broomstick worth 200 points" do
42
+ StudioGame::TreasureTrove::TREASURES[4].should == StudioGame::Treasure.new(:broomstick, 200)
43
+ end
44
+
45
+ it "has a crowbar worth 400 points" do
46
+ StudioGame::TreasureTrove::TREASURES[5].should == StudioGame::Treasure.new(:crowbar, 400)
47
+ end
48
+
49
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: studio_game
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.0'
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Dan Brooking
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-05-22 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ description: ''
31
+ email: dmbrooking@gmail.com
32
+ executables:
33
+ - studio_game
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - bin/high_scores.txt
38
+ - bin/players.csv
39
+ - bin/studio_game
40
+ - lib/studio_game/auditable.rb
41
+ - lib/studio_game/berserk_player.rb
42
+ - lib/studio_game/clumsy_player.rb
43
+ - lib/studio_game/die.rb
44
+ - lib/studio_game/game.rb
45
+ - lib/studio_game/game_turn.rb
46
+ - lib/studio_game/loaded_die.rb
47
+ - lib/studio_game/playable.rb
48
+ - lib/studio_game/player.rb
49
+ - lib/studio_game/treasure_trove.rb
50
+ - spec/studio_game/berserk_player_spec.rb
51
+ - spec/studio_game/clumsy_player_spec.rb
52
+ - spec/studio_game/game_spec.rb
53
+ - spec/studio_game/iterators.rb
54
+ - spec/studio_game/player_spec.rb
55
+ - spec/studio_game/treasure_trove_spec.rb
56
+ - LICENSE
57
+ - README
58
+ homepage:
59
+ licenses: []
60
+ post_install_message:
61
+ rdoc_options: []
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '1.9'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubyforge_project:
78
+ rubygems_version: 1.8.24
79
+ signing_key:
80
+ specification_version: 3
81
+ summary: Game created in Pragmatic Studio Ruby Class
82
+ test_files:
83
+ - spec/studio_game/berserk_player_spec.rb
84
+ - spec/studio_game/clumsy_player_spec.rb
85
+ - spec/studio_game/game_spec.rb
86
+ - spec/studio_game/iterators.rb
87
+ - spec/studio_game/player_spec.rb
88
+ - spec/studio_game/treasure_trove_spec.rb