StudioGameYungSonEdition 2.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b54a0e68c36bf419287ed104dbeb4e9a4e587db4
4
+ data.tar.gz: 20090e00d56ca1e3db66d57039e581812101ca64
5
+ SHA512:
6
+ metadata.gz: 63b1190efd762616e7e2ed6d13b1d2ce4da409f33b1b5b3489fa678b7330517518a1a172c00d67471d15ee7aad2d3ebf919c302e2fc06a4dcd38128a66a4fdd5
7
+ data.tar.gz: 9a17e608787018901bc42083d011bf3a9efc13de4b1907ce123ab1dd7c43a86e6451108e45e88d7e28acb0ffb74de98cd4c24bbe359e97bf2a69ac05f46fe01a
data/LICENSE ADDED
@@ -0,0 +1,6 @@
1
+ Oliver Cheng 2014
2
+ 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:
3
+
4
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5
+
6
+ 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,10 @@
1
+ Welcome to the StudioGame
2
+
3
+ Run studio_game.rb via ruby with optional player.csv files.
4
+ > ruby studio_game.rb others.csv (for example)
5
+
6
+ Then choose # of rounds
7
+ and watch your players get blammed (bad), w00ted (good) and see what treasures they find.
8
+
9
+ Cheers.
10
+ Oliver Cheng, 2014
data/bin/others.csv ADDED
@@ -0,0 +1,3 @@
1
+ Trautman,420
2
+ Zac,420
3
+ Zack,420
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,31 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/studio_game/player'
4
+ require_relative '../lib/studio_game/game'
5
+ require_relative '../lib/studio_game/clumsy_player'
6
+ require_relative '../lib/studio_game/berserk_player'
7
+
8
+ knuckleheads = StudioGame::Game.new("KNUCKLEHEADS")
9
+
10
+ default_player_file = File.join(File.dirname(__FILE__), 'players.csv')
11
+
12
+ knuckleheads.load_players(ARGV.shift || default_player_file)
13
+ klutz = StudioGame::ClumsyPlayer.new("SonSoftman", 105)
14
+ knuckleheads.add_player(klutz)
15
+ berserker = StudioGame::BerserkPlayer.new("YungCrazy", 50)
16
+ knuckleheads.add_player(berserker)
17
+
18
+ loop do
19
+ puts "How many rounds, hm?"
20
+ answer = gets.chomp.downcase
21
+ case answer
22
+ when /^\d+$/
23
+ knuckleheads.play(answer.to_i)
24
+ knuckleheads.save_high_scores
25
+ when 'quit', 'exit'
26
+ knuckleheads.print_stats
27
+ break
28
+ else
29
+ puts "Stop screwing around, enter a number or 'quit!'"
30
+ end
31
+ end
@@ -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,32 @@
1
+ require_relative 'player'
2
+
3
+ module StudioGame
4
+ class BerserkPlayer < Player
5
+
6
+ def initialize(name, health=100)
7
+ super(name,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
+ puts "#{name} got blammed but he liked it."
25
+ else
26
+ super
27
+ end
28
+ end
29
+
30
+ end
31
+
32
+ end
@@ -0,0 +1,10 @@
1
+ require_relative 'player'
2
+
3
+ module StudioGame
4
+ class ClumsyPlayer < Player
5
+ def found_treasure(treasure)
6
+ damaged_treasure = Treasure.new(treasure.name, treasure.points / 2)
7
+ super(damaged_treasure)
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,17 @@
1
+ require_relative 'auditable'
2
+
3
+ module StudioGame
4
+ class Die
5
+ include Auditable
6
+ attr_reader :number
7
+ def initialize
8
+ roll
9
+ end
10
+
11
+ def roll
12
+ @number = rand(1..6)
13
+ audit
14
+ @number
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,97 @@
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
+ def initialize(title)
9
+ @title = title.capitalize
10
+ @players = []
11
+ end
12
+
13
+ def add_player(player)
14
+ @players.push(player)
15
+ end
16
+
17
+ def pop_players
18
+ @players.pop
19
+ end
20
+
21
+ def print_final(player)
22
+ puts "#{player.name}: #{player.health}"
23
+ end
24
+ def print_stats
25
+ puts
26
+ puts "#{@title} Statistics:"
27
+ puts
28
+ @strong_players = @players.select { |playa| playa.strong? }
29
+ @wimpy_players = @players.reject { |playa| playa.strong? }
30
+
31
+ puts "#{@strong_players.size} strong players:"
32
+ @strong_players.each do |playa|
33
+ print_final(playa)
34
+ end
35
+ puts
36
+ puts "#{@wimpy_players.size} weak players:"
37
+ @wimpy_players.each do |playa|
38
+ print_final(playa)
39
+ end
40
+ puts
41
+ puts "#{@title} Point Totals:"
42
+ @players.sort!
43
+ @players.each do |playa|
44
+ puts "#{playa.name.ljust(15, '.')} #{playa.points}"
45
+ playa.each_found_treasure do |treasure|
46
+ puts "#{treasure.name} .... #{treasure.points}"
47
+ end
48
+ puts
49
+ end
50
+ end
51
+
52
+ attr_reader :title
53
+
54
+ def play(rounds)
55
+ puts "Welcome to #{@title}!"
56
+ puts "There are 6 treasures to be found:"
57
+ treasures = TreasureTrove::TREASURES
58
+ treasures.each do |treasure|
59
+ puts "A #{treasure.name} is worth #{treasure.points} points!"
60
+ end
61
+ puts "There are #{@players.size} players in #{@title}. We will play #{rounds} rounds:"
62
+ puts
63
+ @players.each do |player|
64
+ puts player
65
+ end
66
+ 1.upto(rounds) do |round|
67
+ puts
68
+ puts "----ROUND #{round} ------"
69
+ @players.each do |player|
70
+ GameTurn.take_turn(player)
71
+ puts player
72
+ end
73
+ end
74
+ print_stats
75
+ end
76
+
77
+ def load_players(from_file)
78
+ File.readlines(from_file).each do |line|
79
+ name, health = line.split(',')
80
+ yungplayer = Player.new(name,health.to_i)
81
+ add_player(yungplayer)
82
+ end
83
+ end
84
+
85
+ def save_high_scores(to_file="high_scores.txt")
86
+ File.open(to_file, "w") do |file|
87
+ file.puts "#{@title} high scores:"
88
+ @players.sort!
89
+ @players.each do |playa|
90
+ file.puts "#{playa.name.ljust(15, '.')} #{playa.points}"
91
+ end
92
+ end
93
+ end
94
+
95
+ #attr_reader :players
96
+ end
97
+ end
@@ -0,0 +1,22 @@
1
+ require_relative 'player'
2
+ require_relative 'die'
3
+ require_relative 'loaded_die'
4
+
5
+ module StudioGame
6
+ module GameTurn
7
+ def self.take_turn(player)
8
+ die = Die.new
9
+ case die.roll
10
+ when 1..2
11
+ player.blam
12
+ when 3..4
13
+ puts "#{player.name} is spared this time."
14
+ else
15
+ player.w00t
16
+ end
17
+
18
+ treasure = TreasureTrove.random
19
+ player.found_treasure(treasure)
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,15 @@
1
+ require_relative 'auditable.rb'
2
+
3
+ module StudioGame
4
+ class LoadedDie
5
+ include Auditable
6
+ attr_reader :number
7
+
8
+ def roll
9
+ numbers = [1, 1, 5, 5, 6, 6]
10
+ @number = numbers.sample
11
+ audit
12
+ @number
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,17 @@
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 += 15
10
+ puts "#{@name} got w00ted!"
11
+ end
12
+
13
+ def strong?
14
+ @health > 100
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,55 @@
1
+ require_relative 'treasure_trove'
2
+ require_relative 'playable'
3
+
4
+ module StudioGame
5
+ class Player
6
+ include Playable
7
+
8
+ def initialize(name, health=100)
9
+ @name = name.capitalize
10
+ @health = health
11
+ @found_treasures = Hash.new(0)
12
+ end
13
+
14
+ def to_s
15
+ "I'm #{@name} with health = #{@health}, points = #{points}, and score = #{score}."
16
+ end
17
+
18
+ def <=> (other)
19
+ other.score <=> score
20
+ end
21
+
22
+ def points
23
+ @found_treasures.values.reduce(0, :+)
24
+ end
25
+
26
+ def score
27
+ @health + points
28
+ end
29
+
30
+ def found_treasure(treasure)
31
+ @found_treasures[treasure.name] += treasure.points
32
+ puts "#{@name} found a #{treasure.name} worth #{treasure.points} points."
33
+ end
34
+
35
+ def each_found_treasure
36
+ @found_treasures.each do |name,points|
37
+ yield Treasure.new(name,points)
38
+ end
39
+ end
40
+
41
+
42
+ attr_accessor :name
43
+ attr_reader :health
44
+ end
45
+ end
46
+
47
+ if __FILE__ == $0
48
+ player = Player.new("moe")
49
+ puts player.name
50
+ puts player.health
51
+ player.w00t
52
+ puts player.health
53
+ player.blam
54
+ puts player.health
55
+ end
@@ -0,0 +1,18 @@
1
+ module StudioGame
2
+
3
+ Treasure = Struct.new(:name, :points)
4
+
5
+ module TreasureTrove
6
+ TREASURES = [
7
+ Treasure.new(:pie,5),
8
+ Treasure.new(:bottle,25),
9
+ Treasure.new(:hammer,50),
10
+ Treasure.new(:skillet,100),
11
+ Treasure.new(:broomstick,200),
12
+ Treasure.new(:crowbar,400)
13
+ ]
14
+ def self.random
15
+ TREASURES.sample
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,38 @@
1
+ require 'studio_game/berserk_player'
2
+
3
+ module StudioGame
4
+ describe BerserkPlayer do
5
+
6
+ before do
7
+ $stdout = StringIO.new
8
+ @initial_health = 50
9
+ @player = BerserkPlayer.new("berserker", @initial_health)
10
+ end
11
+
12
+ it "does not go berserk when w00ted up to 5 times" do
13
+ 1.upto(5) { @player.w00t }
14
+
15
+ @player.berserk?.should be_false
16
+
17
+ # or if using Rspec 3.0:
18
+ # @player.berserk?.should be_falsey
19
+ end
20
+
21
+ it "goes berserk when w00ted more than 5 times" do
22
+ 1.upto(6) { @player.w00t }
23
+
24
+ @player.berserk?.should be_true
25
+
26
+ # or if using Rspec 3.0:
27
+ # @player.berserk?.should be_truthy
28
+ end
29
+
30
+ it "gets w00ted instead of blammed when it's gone berserk" do
31
+ 1.upto(6) { @player.w00t }
32
+ 1.upto(2) { @player.blam }
33
+
34
+ @player.health.should == @initial_health + (8 * 15)
35
+ end
36
+
37
+ end
38
+ end
@@ -0,0 +1,33 @@
1
+ require 'studio_game/clumsy_player'
2
+
3
+ module StudioGame
4
+ describe ClumsyPlayer do
5
+ before do
6
+ $stdout = StringIO.new
7
+ @player = ClumsyPlayer.new("klutz")
8
+ end
9
+
10
+ it "only gets half the point value for each treasure" do
11
+ @player.points.should == 0
12
+
13
+ hammer = Treasure.new(:hammer, 50)
14
+ @player.found_treasure(hammer)
15
+ @player.found_treasure(hammer)
16
+ @player.found_treasure(hammer)
17
+
18
+ @player.points.should == 75
19
+
20
+ crowbar = Treasure.new(:crowbar, 400)
21
+ @player.found_treasure(crowbar)
22
+
23
+ @player.points.should == 275
24
+
25
+ yielded = []
26
+ @player.each_found_treasure do |treasure|
27
+ yielded << treasure
28
+ end
29
+
30
+ yielded.should == [Treasure.new(:hammer, 75), Treasure.new(:crowbar, 200)]
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,32 @@
1
+ require 'studio_game/game'
2
+
3
+ module StudioGame
4
+ describe Game do
5
+
6
+ before do
7
+ $stdout = StringIO.new
8
+ @game = Game.new("Knuckleheads")
9
+
10
+ @initial_health = 100
11
+ @player = Player.new("moe", @initial_health)
12
+
13
+ @game.add_player(@player)
14
+ end
15
+ it "w00ts when high rollin" do
16
+ Die.any_instance.stub(:roll).and_return(6)
17
+ @game.play(3)
18
+ @player.health.should == @initial_health + (15 * 3)
19
+ end
20
+ it "nothing when med rollin" do
21
+ Die.any_instance.stub(:roll).and_return(3)
22
+ @game.play(3)
23
+ @player.health.should == @initial_health
24
+ end
25
+
26
+ it "blam on low rolls" do
27
+ Die.any_instance.stub(:roll).and_return(1)
28
+ @game.play(3)
29
+ @player.health.should == @initial_health - (10 * 3)
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,113 @@
1
+ require 'studio_game/player'
2
+ require 'studio_game/treasure_trove'
3
+
4
+
5
+ module StudioGame
6
+
7
+ describe Player do
8
+
9
+ before do
10
+ $stdout = StringIO.new
11
+ end
12
+
13
+ context "mans are good" do
14
+ before do
15
+ @player = Player.new("larry", 150)
16
+ end
17
+ it "is capted" do
18
+ @player.name.should == "Larry"
19
+ end
20
+
21
+ it "is healthed good" do
22
+ @player.health.should == 150
23
+ end
24
+ it "is blamming good" do
25
+ @player.blam
26
+ @player.health.should == 140
27
+ end
28
+ it "is wooting good" do
29
+ @player.w00t
30
+ @player.health.should == 165
31
+ end
32
+ it "has a string representation" do
33
+ @player.found_treasure(Treasure.new(:hammer, 50))
34
+ @player.found_treasure(Treasure.new(:hammer, 50))
35
+
36
+ @player.to_s.should == "I'm Larry with health = 150, points = 100, and score = 250."
37
+ end
38
+
39
+ it "computes points as the sum of all treasure points" do
40
+ @player.points.should == 0
41
+
42
+ @player.found_treasure(Treasure.new(:hammer, 50))
43
+
44
+ @player.points.should == 50
45
+
46
+ @player.found_treasure(Treasure.new(:crowbar, 400))
47
+
48
+ @player.points.should == 450
49
+
50
+ @player.found_treasure(Treasure.new(:hammer, 50))
51
+
52
+ @player.points.should == 500
53
+ end
54
+ it "yields each found treasure and its total points" do
55
+ @player.found_treasure(Treasure.new(:skillet, 100))
56
+ @player.found_treasure(Treasure.new(:skillet, 100))
57
+ @player.found_treasure(Treasure.new(:hammer, 50))
58
+ @player.found_treasure(Treasure.new(:bottle, 5))
59
+ @player.found_treasure(Treasure.new(:bottle, 5))
60
+ @player.found_treasure(Treasure.new(:bottle, 5))
61
+ @player.found_treasure(Treasure.new(:bottle, 5))
62
+ @player.found_treasure(Treasure.new(:bottle, 5))
63
+
64
+ yielded = []
65
+ @player.each_found_treasure do |treasure|
66
+ yielded << treasure
67
+ end
68
+
69
+ yielded.should == [
70
+ Treasure.new(:skillet, 200),
71
+ Treasure.new(:hammer, 50),
72
+ Treasure.new(:bottle, 25)
73
+ ]
74
+ end
75
+
76
+ end
77
+
78
+ context "with a health greater than 100" do
79
+ before do
80
+ @player = Player.new("larry", 150)
81
+ end
82
+
83
+ it "is strong" do
84
+ @player.should be_strong
85
+ end
86
+ end
87
+
88
+ context "with a health of 100 or less" do
89
+ before do
90
+ @player = Player.new("larry", 100)
91
+ end
92
+
93
+ it "is wimpy" do
94
+ @player.should_not be_strong
95
+ end
96
+ end
97
+ # examples go here
98
+
99
+ context "in a collection of players" do
100
+ before do
101
+ @player1 = Player.new("moe", 100)
102
+ @player2 = Player.new("larry", 200)
103
+ @player3 = Player.new("curly", 300)
104
+
105
+ @players = [@player1, @player2, @player3]
106
+ end
107
+
108
+ it "is sorted by decreasing score" do
109
+ @players.sort.should == [@player3, @player2, @player1]
110
+ end
111
+ end
112
+ end
113
+ end
@@ -0,0 +1,56 @@
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
+ it "returns a random treasure" do
50
+ treasure = TreasureTrove.random
51
+ TreasureTrove::TREASURES.should include(treasure)
52
+ # or use alternate expectation syntax:
53
+ # expect(TreasureTrove::TREASURES).to include(treasure)
54
+ end
55
+ end
56
+ end
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: StudioGameYungSonEdition
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.2.2
5
+ platform: ruby
6
+ authors:
7
+ - OllyCheng
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-09-04 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
+ Welcome to the StudioGame
29
+
30
+ Run studio_game.rb via ruby with optional player.csv files.
31
+ > ruby studio_game.rb others.csv (for example)
32
+
33
+ Then choose # of rounds
34
+ and watch your players get blammed (bad), w00ted (good) and see what treasures they find.
35
+
36
+ Cheers.
37
+ Oliver Cheng, 2014
38
+ email: oliver.cheng@ribose.com
39
+ executables:
40
+ - studio_game
41
+ extensions: []
42
+ extra_rdoc_files: []
43
+ files:
44
+ - LICENSE
45
+ - README
46
+ - bin/others.csv
47
+ - bin/players.csv
48
+ - bin/studio_game
49
+ - lib/studio_game/auditable.rb
50
+ - lib/studio_game/berserk_player.rb
51
+ - lib/studio_game/clumsy_player.rb
52
+ - lib/studio_game/die.rb
53
+ - lib/studio_game/game.rb
54
+ - lib/studio_game/game_turn.rb
55
+ - lib/studio_game/loaded_die.rb
56
+ - lib/studio_game/playable.rb
57
+ - lib/studio_game/player.rb
58
+ - lib/studio_game/treasure_trove.rb
59
+ - spec/studio_game/berserk_player_spec.rb
60
+ - spec/studio_game/clumsy_player_spec.rb
61
+ - spec/studio_game/game_spec.rb
62
+ - spec/studio_game/player_spec.rb
63
+ - spec/studio_game/treasure_trove_spec.rb
64
+ homepage: http://www.noohomepage.com/ohwell.html
65
+ licenses:
66
+ - MIT
67
+ metadata: {}
68
+ post_install_message:
69
+ rdoc_options: []
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '1.9'
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ requirements: []
83
+ rubyforge_project:
84
+ rubygems_version: 2.2.2
85
+ signing_key:
86
+ specification_version: 4
87
+ summary: A fun game of... something
88
+ test_files:
89
+ - spec/studio_game/berserk_player_spec.rb
90
+ - spec/studio_game/clumsy_player_spec.rb
91
+ - spec/studio_game/game_spec.rb
92
+ - spec/studio_game/player_spec.rb
93
+ - spec/studio_game/treasure_trove_spec.rb