studio_game_pr 1.0.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d0bff0447821aeec3c73739e757d31b7f250e101
4
+ data.tar.gz: bbe372a5c802f356012463147d10a8b066cf676b
5
+ SHA512:
6
+ metadata.gz: 678e1fc706d13f7825422a48fbc4553e7738eb18d1a65a84dd9f93c5369dc83a59355629f6902ce588f845cc1493486a8b89e316765fc1cfa0c61bb8455e43a0
7
+ data.tar.gz: 9119207c06a2693c340d7640118ea2394dcb320da7179fc918efcb1d1beb9bba53c9def2ff7af6866e05cee51748953ceff530d364e0e421d790a4c7cc485f2c
data/LICENSE ADDED
@@ -0,0 +1,8 @@
1
+ Copyright (c) 2016 Ljsldfj Co.
2
+
3
+
4
+ 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:
5
+
6
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7
+
8
+ 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
@@ -0,0 +1,3 @@
1
+ Players start with a given health.
2
+ Throughout the game they find trasures that give them points.
3
+ The objecf of the game is to get as many points as possible.
@@ -0,0 +1,6 @@
1
+ Knuckleheads High Scores:
2
+ Berserk............. 6390
3
+ Alvin............... 5985
4
+ Theo................ 5670
5
+ Simon............... 5390
6
+ Klutz............... 2574
@@ -0,0 +1,3 @@
1
+ dingo_b_ball, 12
2
+ dango_b_ball, 13
3
+ dongo_b_ball, 14
@@ -0,0 +1,3 @@
1
+ Theo, 115
2
+ Alvin, 90
3
+ Simon, 65
@@ -0,0 +1,3 @@
1
+ dingo_hockey, 12
2
+ dango_hockey, 13
3
+ dongo_hockey, 14
@@ -0,0 +1,3 @@
1
+ Alvin, 100
2
+ Simon, 60
3
+ Theo, 125
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/studio_game/game'
4
+ require_relative '../lib/studio_game/player'
5
+ require_relative '../lib/studio_game/clumsy_player'
6
+ require_relative '../lib/studio_game/berserk_player'
7
+
8
+ p1 = StudioGame::Player.new("Peter")
9
+ p2 = StudioGame::Player.new("Ana")
10
+ p3 = StudioGame::Player.new("Abe")
11
+ p4 = StudioGame::Player.new("Peter", 90)
12
+
13
+ # players = [p1, p2, p3]
14
+
15
+ # puts "There are #{players.size} players in the game."
16
+
17
+ # players.pop
18
+ # players.push(p4)
19
+
20
+ #players.each do |p|
21
+ # p.blammed!
22
+ # p.w00ted!
23
+ # p.w00ted!
24
+ # puts p
25
+ #end
26
+
27
+ my_list = StudioGame::Game.new("Knuckleheads")
28
+ # my_list.add_player(p1)
29
+ # my_list.add_player(p2)
30
+ # my_list.add_player(p3)
31
+ default_player_file = File.join(File.dirname(__FILE__), 'players.csv')
32
+ my_list.load_players(ARGV.shift || default_player_file)
33
+ # puts my_list
34
+
35
+ k = StudioGame::ClumsyPlayer.new("klutz", 105)
36
+ b = StudioGame::BerserkPlayer.new("berserk", 5)
37
+ my_list.add_player(k)
38
+ my_list.add_player(b)
39
+
40
+ loop do
41
+ puts "\nHow many game rounds? ('quit' to exit)"
42
+ num_games = gets.chomp.downcase
43
+ case num_games
44
+ when /^\d+$/
45
+ puts "Enjoy your #{num_games} games."
46
+ my_list.play(num_games.to_i)
47
+ when 'quit', 'exit'
48
+ my_list.print_stats
49
+ break
50
+ else
51
+ puts "Please enter a number or 'quit'"
52
+ end
53
+ end
54
+
55
+ my_list.save_high_scores
@@ -0,0 +1,7 @@
1
+ module StudioGame
2
+ module Auditable
3
+ def audit
4
+ puts "Rolled a #{self.number} (#{self.class})"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,37 @@
1
+ require_relative 'player'
2
+
3
+ module StudioGame
4
+ class BerserkPlayer < Player
5
+
6
+ def initialize (player, health=100)
7
+ super(player,health)
8
+ @w00t_count = 0
9
+ end
10
+
11
+ def berserk?
12
+ @w00t_count > 5
13
+ end
14
+
15
+ def w00t
16
+ super
17
+ @w00t_count +=1
18
+ puts "#{@name} is berserk!" if berserk?
19
+ end
20
+
21
+ def blam
22
+ if berserk?
23
+ w00t
24
+ else
25
+ super
26
+ end
27
+ end
28
+
29
+ end
30
+ end
31
+
32
+ if __FILE__ == $0
33
+ berserker = StudioGame::BerserkPlayer.new("berserker", 50)
34
+ 6.times { berserker.w00t }
35
+ 2.times { berserker.blam }
36
+ puts berserker.health
37
+ end
@@ -0,0 +1,28 @@
1
+ require_relative 'player'
2
+
3
+ module StudioGame
4
+ class ClumsyPlayer < Player
5
+
6
+ def found_treasure(treasure)
7
+ super(Treasure.new(treasure.name, treasure.points / 2))
8
+ end
9
+
10
+ end
11
+
12
+ if __FILE__ == $0
13
+ clumsy = StudioGame::ClumsyPlayer.new("klutz")
14
+
15
+ hammer = StudioGame::Treasure.new(:hammer, 50)
16
+ clumsy.found_treasure(hammer)
17
+ clumsy.found_treasure(hammer)
18
+ clumsy.found_treasure(hammer)
19
+
20
+ crowbar = StudioGame::Treasure.new(:crowbar, 400)
21
+ clumsy.found_treasure(crowbar)
22
+
23
+ clumsy.each_found_treasure do |treasure|
24
+ puts "#{treasure.points} total #{treasure.name} points"
25
+ end
26
+ puts "#{clumsy.points} grand total points"
27
+ end
28
+ end
@@ -0,0 +1,18 @@
1
+ require_relative 'auditable'
2
+
3
+ module StudioGame
4
+ class Die
5
+ include Auditable
6
+ attr_reader :number
7
+
8
+ def initialize
9
+ roll
10
+ end
11
+
12
+ def roll
13
+ @number = rand(1..6)
14
+ audit
15
+ @number
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,9 @@
1
+ require_relative 'player'
2
+
3
+ module StudioGame
4
+ File.readlines("player.csv").each do |line|
5
+ name, health = line.split(',')
6
+ player = Player.new(name, health.to_i)
7
+ puts player
8
+ end
9
+ end
@@ -0,0 +1,104 @@
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
+ attr_accessor :name
9
+ attr_reader :players
10
+
11
+ def initialize (mylistname)
12
+ @name = mylistname.capitalize
13
+ @players = []
14
+ end
15
+
16
+ def load_players(from_file)
17
+ File.readlines(from_file).each do |line|
18
+ add_player(Player.from_csv(line))
19
+ end
20
+ end
21
+
22
+ def save_high_scores(to_file="high_scores.txt")
23
+ File.open(to_file, "w") do |file|
24
+ file.puts "#{@name} High Scores:"
25
+
26
+ @players.sort.each do |p|
27
+ file.puts high_score_entry(p)
28
+ end
29
+ end
30
+ end
31
+
32
+ def add_player(player)
33
+ @players << player
34
+ end
35
+
36
+ def play(rounds)
37
+ puts "#{@name}'s game:"
38
+ puts @players.sort
39
+
40
+ treas = TreasureTrove::TREASURES
41
+ puts "\nThere are #{treas.size} treasures to be found."
42
+
43
+ treas.each do |t|
44
+ puts "#{t.name} is worth #{t.points} points"
45
+ end
46
+
47
+ 1.upto(rounds) do |round|
48
+ puts "\nRound number #{round}:"
49
+ @players.each do |player|
50
+ GameTurn.take_turn(player)
51
+ puts player
52
+ end
53
+ end
54
+ end
55
+
56
+ def print_name_and_health(pla)
57
+ puts "#{pla.name} has a health of #{pla.health}"
58
+ end
59
+
60
+ def total_points
61
+ @players.reduce(0) do |sum, player|
62
+ sum + player.points
63
+ end
64
+ end
65
+
66
+ def high_score_entry(player)
67
+ formatted_name = player.name.ljust(20, '.')
68
+ "#{formatted_name} #{player.score}"
69
+ end
70
+
71
+ def print_stats
72
+ puts "\n#{@name}'s Stats:"
73
+
74
+ puts "#{total_points} total points earned"
75
+ @players.sort.each do |p|
76
+ puts "\n#{p.name}'s point totals:"
77
+ p.each_found_treasure do |t|
78
+ puts "#{t.points} total #{t.name} points"
79
+ end
80
+ puts "#{p.points} grand total points"
81
+ end
82
+
83
+ strong, weak = @players.partition { |player| player.strong? }
84
+
85
+ puts "\nStrong:"
86
+ strong.each {|p| self.print_name_and_health(p)}
87
+ # puts strong.sort
88
+
89
+ puts "\nWeak:"
90
+ weak.each {|p| self.print_name_and_health(p)}
91
+ # puts weak.sort
92
+
93
+ puts "\nHigh Scores"
94
+ @players.sort.each do |p|
95
+ puts high_score_entry(p)
96
+ end
97
+ end
98
+
99
+ def to_s
100
+ "There are #{@players.size} players in #{name}."
101
+ end
102
+
103
+ end
104
+ end
@@ -0,0 +1,23 @@
1
+ #require_relative 'loaded_die'
2
+ require_relative 'die'
3
+ require_relative 'treasure_trove'
4
+
5
+ module StudioGame
6
+ module GameTurn
7
+
8
+ def self.take_turn(player)
9
+ # die = LoadedDie.new
10
+ die = Die.new
11
+ number_rolled = die.roll
12
+ if number_rolled < 3
13
+ player.blam
14
+ elsif number_rolled < 5
15
+ puts "#{player.name} was skipped"
16
+ else
17
+ player.w00t
18
+ end
19
+ player.found_treasure(TreasureTrove.random)
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,13 @@
1
+ module StudioGame
2
+ def n_times(number)
3
+ 1.upto(number) do |count|
4
+ yield count
5
+ end
6
+ end
7
+
8
+ n_times(3) do |n|
9
+ puts "#{n} situps"
10
+ puts "#{n} pushups"
11
+ puts "#{n} chinups"
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ require_relative 'auditable'
2
+
3
+ module StudioGame
4
+ class LoadedDie
5
+ include Auditable
6
+ attr_reader :number
7
+
8
+ def roll
9
+ numbers = [1, 1, 2, 5, 6, 6]
10
+ @number = numbers.sample
11
+ audit
12
+ @number
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,18 @@
1
+ module StudioGame
2
+ module Playable
3
+ def blam
4
+ @health -= 10
5
+ puts "#{@name} got blammed!"
6
+ end
7
+
8
+ def w00t
9
+ @health = @health + 15
10
+ puts "#{@name} got w00ted!"
11
+ end
12
+
13
+ def strong?
14
+ @health > 100
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,65 @@
1
+ require_relative 'treasure_trove'
2
+ require_relative 'playable'
3
+
4
+ module StudioGame
5
+ class Player
6
+ include Playable
7
+ attr_accessor :name
8
+ attr_reader :health
9
+
10
+ def initialize (player, health=100)
11
+ @name = player.capitalize
12
+ @health = health
13
+ @found_treasures = Hash.new(0)
14
+ end
15
+
16
+ def each_found_treasure
17
+ @found_treasures.each do |name, points|
18
+ treasure = Treasure.new(name, points)
19
+ yield treasure
20
+ end
21
+ end
22
+
23
+ def found_treasure(treasure)
24
+ @found_treasures[treasure.name] += treasure.points
25
+ # @found_treasures[treasure.name] = @found_treasures[treasure.name] + treasure.points
26
+ puts "#{@name} found a #{treasure.name} worth #{treasure.points} points."
27
+ puts "#{@name}'s treasures: #{@found_treasures}"
28
+ end
29
+
30
+ def points
31
+ @found_treasures.values.reduce(0, :+)
32
+ end
33
+
34
+ def score
35
+ @health + points
36
+ end
37
+
38
+ def <=>(other_player)
39
+ other_player.score <=> score
40
+ end
41
+
42
+ def self.from_csv(string)
43
+ name, health = string.split(',')
44
+ Player.new(name, Integer(health))
45
+ end
46
+
47
+ def to_csv
48
+ "#{@name}, #{health}"
49
+ end
50
+
51
+ def to_s
52
+ "I'm #{@name} with health = #{@health}, points = #{points}, and score = #{score}."
53
+ end
54
+ end
55
+ end
56
+
57
+ if __FILE__ == $0
58
+ player = StudioGame::Player.new("moe")
59
+ puts player.name
60
+ puts player.health
61
+ player.w00t
62
+ puts player.health
63
+ player.blam
64
+ puts player.health
65
+ end
@@ -0,0 +1,22 @@
1
+ Treasure = Struct.new(:name, :points)
2
+
3
+ module StudioGame
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
19
+
20
+ if __FILE__ == $0
21
+ puts TreasureTrove::TREASURES
22
+ end
@@ -0,0 +1,37 @@
1
+ require 'studio_game/berserk_player'
2
+
3
+ module StudioGame
4
+ describe BerserkPlayer do
5
+
6
+ before do
7
+ @initial_health = 50
8
+ @player = BerserkPlayer.new("berserker", @initial_health)
9
+ end
10
+
11
+ it "does not go berserk when w00ted up to 5 times" do
12
+ 1.upto(5) { @player.w00t }
13
+
14
+ @player.berserk?.should be_falsey
15
+
16
+ # or if using Rspec 3.0:
17
+ # @player.berserk?.should be_falsey
18
+ end
19
+
20
+ it "goes berserk when w00ted more than 5 times" do
21
+ 1.upto(6) { @player.w00t }
22
+
23
+ @player.berserk?.should be_truthy
24
+
25
+ # or if using Rspec 3.0:
26
+ # @player.berserk?.should be_truthy
27
+ end
28
+
29
+ it "gets w00ted instead of blammed when it's gone berserk" do
30
+ 1.upto(6) { @player.w00t }
31
+ 1.upto(2) { @player.blam }
32
+
33
+ @player.health.should == @initial_health + (8 * 15)
34
+ end
35
+
36
+ end
37
+ end
@@ -0,0 +1,33 @@
1
+ require 'studio_game/clumsy_player'
2
+
3
+ module StudioGame
4
+ describe ClumsyPlayer do
5
+ before do
6
+ @player = ClumsyPlayer.new("klutz")
7
+ end
8
+
9
+ it "only gets half the point value for each treasure" do
10
+ @player.points.should == 0
11
+
12
+ hammer = Treasure.new(:hammer, 50)
13
+ @player.found_treasure(hammer)
14
+ @player.found_treasure(hammer)
15
+ @player.found_treasure(hammer)
16
+
17
+ @player.points.should == 75
18
+
19
+ crowbar = Treasure.new(:crowbar, 400)
20
+ @player.found_treasure(crowbar)
21
+
22
+ @player.points.should == 275
23
+
24
+ yielded = []
25
+ @player.each_found_treasure do |treasure|
26
+ yielded << treasure
27
+ end
28
+
29
+ yielded.should == [Treasure.new(:hammer, 75), Treasure.new(:crowbar, 200)]
30
+ end
31
+
32
+ end
33
+ end
@@ -0,0 +1,56 @@
1
+ require 'studio_game/game'
2
+
3
+ module StudioGame
4
+ describe Game do
5
+
6
+ before do
7
+ @game = Game.new("Knuckleheads")
8
+ end
9
+
10
+ context "being played with one player" do
11
+ before do
12
+ @initial_health = 100
13
+ @player = Player.new("moe", @initial_health)
14
+ @game.add_player(@player)
15
+ end
16
+
17
+ it "gives the player a w00t if a high number is rolled" do
18
+ # @game.stub(:roll_die).and_return(5)
19
+ Die.any_instance.stub(:roll).and_return(5)
20
+ @game.play(2)
21
+
22
+ @player.health.should == @initial_health + (15 * 2)
23
+ end
24
+
25
+ it "gives the player nothing if a 3 or 4 is rolled" do
26
+ # @game.stub(:roll_die).and_return(4)
27
+ Die.any_instance.stub(:roll).and_return(4)
28
+ @game.play(2)
29
+
30
+ @player.health.should == @initial_health
31
+ end
32
+
33
+ it "gives the player a blam if a low number is rolled" do
34
+ # @game.stub(:roll_die).and_return(2)
35
+ Die.any_instance.stub(:roll).and_return(2)
36
+ @game.play(2)
37
+
38
+ @player.health.should == @initial_health - (10 * 2)
39
+ end
40
+
41
+ it "assigns a treasure for points during a player's turn" do
42
+ game = Game.new("Knuckleheads")
43
+ player = Player.new("moe")
44
+
45
+ game.add_player(player)
46
+
47
+ game.play(1)
48
+
49
+ player.points.should_not be_zero
50
+
51
+ # or use alternate expectation syntax:
52
+ # expect(player.points).not_to be_zero
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,133 @@
1
+ require 'studio_game/player'
2
+ require 'studio_game/treasure_trove'
3
+
4
+ module StudioGame
5
+ describe Player do
6
+
7
+ before do
8
+ $stdout = StringIO.new
9
+ @initial_health = 150
10
+ @player = Player.new("larry", @initial_health)
11
+ end
12
+
13
+ it "has a capitalized name" do
14
+ # @player.name.should == "Larry"
15
+ expect(@player.name).to eq("Larry")
16
+ end
17
+
18
+ it "has an initial health of 100" do
19
+ @player = Player.new("larry")
20
+
21
+ # @player.health.should == 100
22
+ expect(@player.health).to eq(100)
23
+ end
24
+
25
+ it "computes a score as the sum of its health and points" do
26
+ @player.found_treasure(Treasure.new(:hammer, 50))
27
+ @player.found_treasure(Treasure.new(:hammer, 50))
28
+
29
+ @player.score.should == 250
30
+ end
31
+
32
+ it "has a string representation" do
33
+ @player.found_treasure(Treasure.new(:hammer, 50))
34
+ @player.found_treasure(Treasure.new(:hammer, 50))
35
+ # @player.to_s.should == "I'm Larry with a health of 60 and a score of 65."
36
+ expect(@player.to_s).to eq("I'm Larry with health = 150, points = 100, and score = 250.")
37
+ end
38
+
39
+ it "increased health by 15 when w00ted!" do
40
+ @player.w00t
41
+ # @player.health.should == @initial_health + 15
42
+ expect(@player.health).to eq(@initial_health + 15)
43
+ end
44
+
45
+ it "decreased health by 10 when blammed!" do
46
+ @player.blam
47
+ # @player.health.should == @initial_health - 10
48
+ expect(@player.health).to eq(@initial_health - 10)
49
+ end
50
+
51
+ context "with a health of more than 100" do
52
+ before do
53
+ @player = Player.new("Larry", 150)
54
+ end
55
+
56
+ it "is a strong player" do
57
+ # @player.strong?.should be_truthy
58
+ expect(@player).to be_strong
59
+ end
60
+ end
61
+
62
+ context "with a health of less than or equal to 100" do
63
+ before do
64
+ @player = Player.new("Larry")
65
+ end
66
+
67
+ it "is a weak player" do
68
+ # @player.strong?.should be_falsey
69
+ # expect(@player).not_to be_strong
70
+ @player.should_not be_strong
71
+ end
72
+ end
73
+
74
+ context "in a collection of players" do
75
+ before do
76
+ @player1 = Player.new("moe", 100)
77
+ @player2 = Player.new("larry", 200)
78
+ @player3 = Player.new("curly", 300)
79
+ @players = [@player1,@player2,@player3]
80
+ end
81
+
82
+ it "is sorted by decreasing score" do
83
+ @players.sort.should == [@player3,@player2,@player1]
84
+ # @players.sort.should == [@player1,@player2,@player3]
85
+ end
86
+ end
87
+
88
+ it "computes points as the sum of all treasure points" do
89
+ @player.points.should == 0
90
+
91
+ @player.found_treasure(Treasure.new(:hammer, 50))
92
+
93
+ @player.points.should == 50
94
+
95
+ @player.found_treasure(Treasure.new(:crowbar, 400))
96
+
97
+ @player.points.should == 450
98
+
99
+ @player.found_treasure(Treasure.new(:hammer, 50))
100
+
101
+ @player.points.should == 500
102
+ end
103
+
104
+ it "yields each found treasure and its total points" do
105
+ @player.found_treasure(Treasure.new(:skillet, 100))
106
+ @player.found_treasure(Treasure.new(:skillet, 100))
107
+ @player.found_treasure(Treasure.new(:hammer, 50))
108
+ @player.found_treasure(Treasure.new(:bottle, 5))
109
+ @player.found_treasure(Treasure.new(:bottle, 5))
110
+ @player.found_treasure(Treasure.new(:bottle, 5))
111
+ @player.found_treasure(Treasure.new(:bottle, 5))
112
+ @player.found_treasure(Treasure.new(:bottle, 5))
113
+
114
+ yielded = []
115
+ @player.each_found_treasure do |treasure|
116
+ yielded << treasure
117
+ end
118
+
119
+ yielded.should == [
120
+ Treasure.new(:skillet, 200),
121
+ Treasure.new(:hammer, 50),
122
+ Treasure.new(:bottle, 25)
123
+ ]
124
+ end
125
+
126
+ it "can be created from a CSV string" do
127
+ player = Player.from_csv("larry,150")
128
+
129
+ player.name.should == "Larry"
130
+ player.health.should == 150
131
+ end
132
+ end
133
+ end
@@ -0,0 +1,51 @@
1
+ require 'studio_game/treasure_trove'
2
+
3
+ module StudioGame
4
+ describe Treasure do
5
+
6
+ before do
7
+ @treasure = Treasure.new(:hammer, 50)
8
+ end
9
+
10
+ it "has a name attribute" do
11
+ @treasure.name.should == :hammer
12
+ end
13
+
14
+ it "has a points attribute" do
15
+ @treasure.points.should == 50
16
+ end
17
+
18
+ end
19
+
20
+ describe TreasureTrove do
21
+
22
+ it "has six treasures" do
23
+ TreasureTrove::TREASURES.size.should == 6
24
+ end
25
+
26
+ it "has a pie worth 5 points" do
27
+ TreasureTrove::TREASURES[0].should == Treasure.new(:pie, 5)
28
+ end
29
+
30
+ it "has a bottle worth 25 points" do
31
+ TreasureTrove::TREASURES[1].should == Treasure.new(:bottle, 25)
32
+ end
33
+
34
+ it "has a hammer worth 50 points" do
35
+ TreasureTrove::TREASURES[2].should == Treasure.new(:hammer, 50)
36
+ end
37
+
38
+ it "has a skillet worth 100 points" do
39
+ TreasureTrove::TREASURES[3].should == Treasure.new(:skillet, 100)
40
+ end
41
+
42
+ it "has a broomstick worth 200 points" do
43
+ TreasureTrove::TREASURES[4].should == Treasure.new(:broomstick, 200)
44
+ end
45
+
46
+ it "has a crowbar worth 400 points" do
47
+ TreasureTrove::TREASURES[5].should == Treasure.new(:crowbar, 400)
48
+ end
49
+
50
+ end
51
+ end
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: studio_game_pr
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Peter Rios
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-05-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: |
28
+ Players start with a given health.
29
+ Throughout the game they find trasures that give them points.
30
+ The objecf of the game is to get as many points as possible.
31
+ email: prios@mygamepr.com
32
+ executables:
33
+ - studio_game
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - LICENSE
38
+ - README
39
+ - bin/high_scores.txt
40
+ - bin/player_basketball.csv
41
+ - bin/player_health.csv
42
+ - bin/player_hockey.csv
43
+ - bin/players.csv
44
+ - bin/studio_game
45
+ - lib/studio_game/auditable.rb
46
+ - lib/studio_game/berserk_player.rb
47
+ - lib/studio_game/clumsy_player.rb
48
+ - lib/studio_game/die.rb
49
+ - lib/studio_game/files.rb
50
+ - lib/studio_game/game.rb
51
+ - lib/studio_game/game_turn.rb
52
+ - lib/studio_game/iterators.rb
53
+ - lib/studio_game/loaded_die.rb
54
+ - lib/studio_game/playable.rb
55
+ - lib/studio_game/player.rb
56
+ - lib/studio_game/treasure_trove.rb
57
+ - spec/studio_game/berserk_player_spec.rb
58
+ - spec/studio_game/clumsy_player_spec.rb
59
+ - spec/studio_game/game_spec.rb
60
+ - spec/studio_game/player_spec.rb
61
+ - spec/studio_game/treasure_trove_spec.rb
62
+ homepage: http://mygamepr.com
63
+ licenses:
64
+ - MIT
65
+ metadata: {}
66
+ post_install_message:
67
+ rdoc_options: []
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '1.9'
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ requirements: []
81
+ rubyforge_project:
82
+ rubygems_version: 2.4.5.1
83
+ signing_key:
84
+ specification_version: 4
85
+ summary: Players find treasures and accumulate points
86
+ test_files:
87
+ - spec/studio_game/berserk_player_spec.rb
88
+ - spec/studio_game/clumsy_player_spec.rb
89
+ - spec/studio_game/game_spec.rb
90
+ - spec/studio_game/player_spec.rb
91
+ - spec/studio_game/treasure_trove_spec.rb