ruby_game_gems 1.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f8e324aca1db1aa1ff6258ef304161104c8163b0114ce259fc655deac1401b22
4
+ data.tar.gz: a9b768952d51427ec38465a655e090f4d0634c18b23f78b1d77839763295f833
5
+ SHA512:
6
+ metadata.gz: 98925fc13935b5aefb044e47e7f3d68c04fecbe083516c4121406722f62159a1524516978a7a538df16bf23d1622ec172300588794c63e9cf502e3404631bb4b
7
+ data.tar.gz: f55811673ccf5add3e60156f6b8e68325af709b3d465a920fd34181cd78b594d077dec9a8636e959ddfb53b003f77fa36142531b743a8c26ef68144b50527c97
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) <2023> <copyright Pankaj Porwal>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
data/README ADDED
@@ -0,0 +1,2 @@
1
+ RubyGame is a action based fighting game where a player has access to treasures which rewards them points.
2
+ After completing all the rounds, the player with highest points wins the game.
data/bin/game_class ADDED
@@ -0,0 +1,123 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../lib/ruby_game/players_class'
3
+ require_relative '../lib/ruby_game/die'
4
+ require_relative '../lib/ruby_game/review'
5
+ require_relative '../lib/ruby_game/treasure'
6
+ require_relative '../lib/ruby_game/clumsy_player'
7
+ require_relative '../lib/ruby_game/berserk_player'
8
+ module RubyGame
9
+ class Game
10
+ attr_reader :name
11
+
12
+ def initialize(name)
13
+ @name = name.capitalize
14
+ @games = []
15
+ end
16
+ def load_players(from_file)
17
+ File.readlines(from_file).each do |line|
18
+ name, health = line.split(",")
19
+ plr = Players.new(name,health.to_i)
20
+ add_player(plr)
21
+ end
22
+ end
23
+ def save_high_scores(to_file="high_scores.txt")
24
+ File.open(to_file, "w") do |file|
25
+ file.puts "#{@name} High Scores:"
26
+ @games.each do |player|
27
+ formatted_name = player.name.ljust(20, '.')
28
+ file.puts "#{formatted_name} #{player.score}"
29
+ end
30
+ end
31
+ end
32
+ def add_player(player)
33
+ @player = player
34
+ @games.push(@player)
35
+ end
36
+
37
+ def print_stats
38
+ players_array = []
39
+ strong_player, weak_player = @games.partition{|x| x.strong?}
40
+ puts "\n#{@name} Statistics: "
41
+ puts "\n#{strong_player.size} strong players:"
42
+
43
+ strong_player.each do |player|
44
+ puts "#{player.name} (#{player.health})"
45
+ players_array<<player
46
+ end
47
+
48
+ puts "\n#{weak_player.size} weak players:"
49
+
50
+ weak_player.each do |player|
51
+ puts "#{player.name} (#{player.health})"
52
+ players_array<<player
53
+ end
54
+
55
+ sorted = players_array.sort_by{|x| x.score}.reverse
56
+
57
+ sorted.each do |player|
58
+
59
+ puts "\n#{player.name}'s total points: #{player.points}"
60
+ # puts "#{player.points} grand total points"
61
+ player.each_treasure do |treasure|
62
+ puts "#{treasure.points} total #{treasure.name} points"
63
+ end
64
+ end
65
+ end
66
+
67
+ def play(rounds)
68
+ treasures = TreasureTrove::TREASURES
69
+ puts "There are #{treasures.size} treasures to be found:"
70
+
71
+ treasures.each do |x|
72
+ puts "A #{x.name} is worth #{x.points} points"
73
+ end
74
+
75
+ puts "\nThere are #{@games.size} players in the game #{@name}:"
76
+
77
+ @games.each do |x|
78
+ puts "#{x.name}: Health=#{x.health} Score=#{x.score}"
79
+ end
80
+
81
+ 1.upto(rounds) do |round|
82
+ puts "\nRound #{round}:"
83
+ @games.each do |x|
84
+ ReviewGame.take_turn(x)
85
+ puts x
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end
91
+
92
+ if __FILE__ == $0
93
+ p1 = RubyGame::Players.new("Jin",50)
94
+ p2 = RubyGame::Players.new("King",50)
95
+ p3 = RubyGame::Players.new("Eddy",50)
96
+ p4 = RubyGame::ClumsyPlayer.new("Law",50)
97
+ p5 = RubyGame::BerserkPlayer.new("Paul",50)
98
+
99
+ tekken = RubyGame::Game.new("tekken")
100
+ # tekken.load_players(ARGV.shift || "players.csv")
101
+ # default_player_file = File.join(File.dirname(__FILE__), 'players.csv')
102
+ # tekken.load_players(ARGV.shift || default_player_file)
103
+
104
+ tekken.add_player(p1)
105
+ tekken.add_player(p2)
106
+ tekken.add_player(p3)
107
+ tekken.add_player(p4)
108
+ tekken.add_player(p5)
109
+
110
+ loop do
111
+ puts "Enter number of rounds: "
112
+ rounds = gets.chomp.downcase
113
+ case rounds
114
+ when /^\d+$/
115
+ tekken.play(rounds.to_i)
116
+ when 'quit','exit'
117
+ tekken.print_stats
118
+ break
119
+ else puts "Enter numeric value ('quit' to exit)"
120
+ end
121
+ end
122
+ tekken.save_high_scores
123
+ end
data/bin/players.csv ADDED
@@ -0,0 +1,3 @@
1
+ Jack,12
2
+ Steve,9
3
+ Paul,14
@@ -0,0 +1,8 @@
1
+ require_relative 'die'
2
+ module RubyGame
3
+ module Auditable
4
+ def audit
5
+ puts "Rolled a #{self.number} (#{self.class})"
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,36 @@
1
+ require_relative 'players_class'
2
+ module RubyGame
3
+ class BerserkPlayer < Players
4
+ def initialize(name, health)
5
+ super(name,health)
6
+ @woot_count = 0
7
+ end
8
+
9
+ def berserk?
10
+ @woot_count>5
11
+ end
12
+
13
+ def wooted
14
+ super
15
+ @woot_count +=1
16
+ if berserk?
17
+ puts "#{@name} is berserk!"
18
+ end
19
+ end
20
+
21
+ def blammed
22
+ if berserk?
23
+ wooted
24
+ else
25
+ super
26
+ end
27
+ end
28
+ end
29
+ end
30
+
31
+ if __FILE__ == $0
32
+ bplr = BerserkPlayer.new("Wong",100)
33
+ 6.times {bplr.wooted}
34
+ 2.times {bplr.blammed}
35
+ puts bplr.health
36
+ end
@@ -0,0 +1,26 @@
1
+ require_relative 'players_class'
2
+ module RubyGame
3
+ class ClumsyPlayer < Players
4
+ def found_treasure(treasure)
5
+ damaged_treasure = Treasure.new(treasure.name, treasure.points/2.0)
6
+ super(damaged_treasure)
7
+ end
8
+ end
9
+ end
10
+
11
+ if __FILE__ == $0
12
+ clumsy = ClumsyPlayer.new("klutz",100)
13
+
14
+ hammer = Treasure.new(:hammer, 50)
15
+ clumsy.found_treasure(hammer)
16
+ clumsy.found_treasure(hammer)
17
+ clumsy.found_treasure(hammer)
18
+
19
+ crowbar = Treasure.new(:crowbar, 400)
20
+ clumsy.found_treasure(crowbar)
21
+
22
+ clumsy.each_treasure do |treasure|
23
+ puts "#{treasure.points} total #{treasure.name} points"
24
+ end
25
+ puts "#{clumsy.points} grand total points"
26
+ end
@@ -0,0 +1,15 @@
1
+ require_relative 'auditable'
2
+ module RubyGame
3
+ class Die
4
+ include Auditable
5
+ attr_reader :number
6
+ def initialize
7
+ roll
8
+ end
9
+ def roll
10
+ @number = rand(1..6)
11
+ audit
12
+ @number
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ require_relative 'auditable'
2
+ module RubyGame
3
+ class LoadedDie
4
+ include Auditable
5
+ attr_reader :number
6
+
7
+ def roll
8
+ numbers = [1,1,2,5,6,6]
9
+ @number = numbers.sample
10
+ audit
11
+ @number
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,19 @@
1
+ module RubyGame
2
+ module Playable
3
+ def blammed
4
+ @health -=10
5
+ puts "#{@name} got blammed!"
6
+ end
7
+ def wooted
8
+ @health+=15
9
+ puts "#{@name} got w00ted!"
10
+ end
11
+ def strong?
12
+ if @health>=60
13
+ true
14
+ else
15
+ false
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,37 @@
1
+ require_relative 'treasure'
2
+ require_relative 'playable'
3
+ module RubyGame
4
+ class Players
5
+ include Playable
6
+ attr_reader :health
7
+ attr_accessor :name
8
+ def initialize(name, health)
9
+ @name=name.capitalize
10
+ @health=health
11
+ @found_treasures = Hash.new(0);
12
+ end
13
+ def found_treasure(object)
14
+ @found_treasures[object.name] += object.points
15
+ puts "#{@name} found a #{object.name} worth #{object.points} points."
16
+ puts "#{@name}'s Treasures: #{@found_treasures}"
17
+ end
18
+ def each_treasure
19
+ @found_treasures.each do |name, points|
20
+ yield Treasure.new(name, points)
21
+ end
22
+ end
23
+ def points
24
+ @found_treasures.values.reduce(0,:+)
25
+ end
26
+ def score
27
+ return @health + points
28
+ end
29
+
30
+ def to_s
31
+ return "I'm #{@name} with health = #{@health}, points = #{points} and score = #{score}"
32
+ end
33
+ end
34
+ end
35
+ if __FILE__ == $0
36
+
37
+ end
@@ -0,0 +1,24 @@
1
+ require_relative 'treasure'
2
+ require_relative 'players_class'
3
+ require_relative 'loaded_die'
4
+ module RubyGame
5
+ module ReviewGame
6
+ def self.take_turn(player)
7
+ die = Die.new
8
+ number_rolled = die.roll
9
+ case number_rolled
10
+ when 5..6
11
+ player.wooted
12
+ # puts player
13
+ when 1..2
14
+ player.blammed
15
+ # puts player
16
+ else
17
+ puts "#{player.name} is skipped"
18
+ end
19
+ treasureFound = TreasureTrove.random
20
+ player.found_treasure(treasureFound)
21
+ # puts "#{player.name} found a #{treasureFound.name} worth #{treasureFound.points} points."
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,11 @@
1
+ module RubyGame
2
+ Treasure = Struct.new(:name, :points)
3
+
4
+ module TreasureTrove
5
+ TREASURES = [Treasure.new(:pie,5), Treasure.new(:bottle,25), Treasure.new(:hammer,50), Treasure.new(:skillet,100), Treasure.new(:broomstick,200), Treasure.new(:crowbar,400)]
6
+
7
+ def self.random
8
+ TREASURES.sample
9
+ end
10
+ end
11
+ end
data/lib/useless ADDED
@@ -0,0 +1 @@
1
+ Ignore this file
@@ -0,0 +1,36 @@
1
+ require 'ruby_game/berserk_player'
2
+ module RubyGame
3
+ describe BerserkPlayer do
4
+
5
+ before do
6
+ @initial_health = 50
7
+ @player = 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.wooted }
12
+
13
+ @player.berserk?.should be_falsey
14
+
15
+ # or if using Rspec 3.0:
16
+ # @player.berserk?.should be_falsey
17
+ end
18
+
19
+ it "goes berserk when w00ted more than 5 times" do
20
+ 1.upto(6) { @player.wooted }
21
+
22
+ @player.berserk?.should be_truthy
23
+
24
+ # or if using Rspec 3.0:
25
+ # @player.berserk?.should be_truthy
26
+ end
27
+
28
+ it "gets w00ted instead of blammed when it's gone berserk" do
29
+ 1.upto(6) { @player.wooted }
30
+ 1.upto(2) { @player.blammed }
31
+
32
+ @player.health.should == @initial_health + (8 * 15)
33
+ end
34
+
35
+ end
36
+ end
@@ -0,0 +1,32 @@
1
+ require 'ruby_game/clumsy_player'
2
+ module RubyGame
3
+ describe ClumsyPlayer do
4
+ before do
5
+ @player = ClumsyPlayer.new("klutz",50)
6
+ end
7
+
8
+ it "only gets half the point value for each treasure" do
9
+ @player.points.should == 0
10
+
11
+ hammer = 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 = Treasure.new(:crowbar, 400)
19
+ @player.found_treasure(crowbar)
20
+
21
+ @player.points.should == 275
22
+
23
+ yielded = []
24
+ @player.each_treasure do |treasure|
25
+ yielded << treasure
26
+ end
27
+
28
+ yielded.should == [Treasure.new(:hammer, 75), Treasure.new(:crowbar, 200)]
29
+ end
30
+
31
+ end
32
+ end
@@ -0,0 +1,50 @@
1
+ require_relative '../../bin/game_class'
2
+ require 'ruby_game/review'
3
+ module RubyGame
4
+ describe Game do
5
+ before do
6
+ @game = Game.new("MortalKombat")
7
+ @init_h = 150
8
+ @player = Players.new("Scorpion",@init_h)
9
+ @game.add_player(@player)
10
+ end
11
+
12
+ it "w00ts the player if a high number is rolled" do
13
+ Die.any_instance.stub(:roll).and_return(5)
14
+
15
+ @game.play(3)
16
+
17
+ @player.health.should == @init_h + (15*3)
18
+ end
19
+
20
+ it "skips the player if a medium number is rolled" do
21
+ Die.any_instance.stub(:roll).and_return(3)
22
+
23
+ @game.play(3)
24
+
25
+ @player.health.should == @init_h
26
+ end
27
+
28
+ it "blam the player if a low number is rolled" do
29
+ Die.any_instance.stub(:roll).and_return(1)
30
+
31
+ @game.play(3)
32
+
33
+ @player.health.should == @init_h - (10*3)
34
+ end
35
+
36
+ it "assigns a treasure for points during a player's turn" do
37
+ game = Game.new("Knuckleheads")
38
+ player = Players.new("moe",150)
39
+
40
+ game.add_player(player)
41
+
42
+ game.play(1)
43
+
44
+ player.points.should_not be_zero
45
+
46
+ # or use alternate expectation syntax:
47
+ # expect(player.points).not_to be_zero
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,106 @@
1
+ require 'ruby_game/players_class'
2
+ require_relative 'spec_helper'
3
+ module RubyGame
4
+ describe Players do
5
+ before do
6
+ $stdout = StringIO.new
7
+ @power = 150
8
+ @player = Players.new("king",@power)
9
+ end
10
+
11
+ it "has a capitalized name" do
12
+ @player.name.should == "King"
13
+ end
14
+
15
+ it "has initial power 150" do
16
+ @player.health.should == 150
17
+ end
18
+
19
+ it "decreases power by 10 on blammed" do
20
+ @player.blammed
21
+ @player.health.should == @power - 10
22
+ end
23
+
24
+ it "increases power by 15 on wooted" do
25
+ @player.wooted
26
+ @player.health.should == @power + 15
27
+ end
28
+
29
+ it "has a string representation" do
30
+ @player.found_treasure(Treasure.new(:hammer, 50))
31
+ @player.found_treasure(Treasure.new(:hammer, 50))
32
+
33
+ @player.to_s.should == "I'm King with health = 150, points = 100 and score = 250"
34
+ end
35
+
36
+ it "has a score" do
37
+ @player.score == @power + @player.name.length
38
+ end
39
+
40
+ context "player has a initial health of 60" do
41
+ before do
42
+ @init1 = 60
43
+ @npl = Players.new("John",@init1)
44
+ end
45
+
46
+ it "is strong" do
47
+ @npl.should be_strong
48
+ end
49
+ end
50
+
51
+ context "player has a initial health of 50" do
52
+ before do
53
+ @init2 = 50
54
+ @npl2 = Players.new("Yoshimitsu", @init2)
55
+ end
56
+
57
+ it "is strong" do
58
+ @npl2.should_not be_strong
59
+ end
60
+ end
61
+
62
+ context "in a collection of players" do
63
+ before do
64
+ @player1 = Players.new("Jin",60)
65
+ @player2 = Players.new("King",80)
66
+ @player3 = Players.new("John",100)
67
+
68
+ @players = [@player1, @player2, @player3]
69
+ end
70
+
71
+ it "is sorted by decreasing score" do
72
+ sorted = @players.sort_by{|x| x.score}.reverse
73
+ sorted.should == [@player3,@player2,@player1]
74
+ end
75
+ end
76
+
77
+ it "computes a score as the sum of its health and points" do
78
+ @player.found_treasure(Treasure.new(:hammer, 50))
79
+ @player.found_treasure(Treasure.new(:hammer, 50))
80
+
81
+ @player.score.should == 250
82
+ end
83
+
84
+ it "yields each found treasure and its total points" do
85
+ @player.found_treasure(Treasure.new(:skillet, 100))
86
+ @player.found_treasure(Treasure.new(:skillet, 100))
87
+ @player.found_treasure(Treasure.new(:hammer, 50))
88
+ @player.found_treasure(Treasure.new(:bottle, 5))
89
+ @player.found_treasure(Treasure.new(:bottle, 5))
90
+ @player.found_treasure(Treasure.new(:bottle, 5))
91
+ @player.found_treasure(Treasure.new(:bottle, 5))
92
+ @player.found_treasure(Treasure.new(:bottle, 5))
93
+
94
+ yielded = []
95
+ @player.each_treasure do |treasure|
96
+ yielded << treasure
97
+ end
98
+
99
+ yielded.should == [
100
+ Treasure.new(:skillet, 200),
101
+ Treasure.new(:hammer, 50),
102
+ Treasure.new(:bottle, 25)]
103
+
104
+ end
105
+ end
106
+ end
@@ -0,0 +1,8 @@
1
+ RSpec.configure do |config|
2
+ config.expect_with :rspec do |c|
3
+ c.syntax = [:should, :expect]
4
+ end
5
+ config.mock_with :rspec do |c|
6
+ c.syntax = [:should, :expect]
7
+ end
8
+ end
@@ -0,0 +1,59 @@
1
+ require 'ruby_game/treasure'
2
+ module RubyGame
3
+ describe Treasure do
4
+
5
+ before do
6
+ @treasure = 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 TreasureTrove do
20
+
21
+ it "has six treasures" do
22
+ TreasureTrove::TREASURES.size.should == 6
23
+ end
24
+
25
+ it "has a pie worth 5 points" do
26
+ TreasureTrove::TREASURES[0].should == Treasure.new(:pie, 5)
27
+ end
28
+
29
+ it "has a bottle worth 25 points" do
30
+ TreasureTrove::TREASURES[1].should == Treasure.new(:bottle, 25)
31
+ end
32
+
33
+ it "has a hammer worth 50 points" do
34
+ TreasureTrove::TREASURES[2].should == Treasure.new(:hammer, 50)
35
+ end
36
+
37
+ it "has a skillet worth 100 points" do
38
+ TreasureTrove::TREASURES[3].should == Treasure.new(:skillet, 100)
39
+ end
40
+
41
+ it "has a broomstick worth 200 points" do
42
+ TreasureTrove::TREASURES[4].should == Treasure.new(:broomstick, 200)
43
+ end
44
+
45
+ it "has a crowbar worth 400 points" do
46
+ TreasureTrove::TREASURES[5].should == Treasure.new(:crowbar, 400)
47
+ end
48
+
49
+ it "returns a random treasure" do
50
+ treasure = TreasureTrove.random
51
+
52
+ TreasureTrove::TREASURES.should include(treasure)
53
+
54
+ # or use alternate expectation syntax:
55
+ # expect(TreasureTrove::TREASURES).to include(treasure)
56
+ end
57
+
58
+ end
59
+ end
@@ -0,0 +1,98 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
16
+ RSpec.configure do |config|
17
+ # rspec-expectations config goes here. You can use an alternate
18
+ # assertion/expectation library such as wrong or the stdlib/minitest
19
+ # assertions if you prefer.
20
+ config.expect_with :rspec do |expectations|
21
+ # This option will default to `true` in RSpec 4. It makes the `description`
22
+ # and `failure_message` of custom matchers include text for helper methods
23
+ # defined using `chain`, e.g.:
24
+ # be_bigger_than(2).and_smaller_than(4).description
25
+ # # => "be bigger than 2 and smaller than 4"
26
+ # ...rather than:
27
+ # # => "be bigger than 2"
28
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
29
+ end
30
+
31
+ # rspec-mocks config goes here. You can use an alternate test double
32
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
33
+ config.mock_with :rspec do |mocks|
34
+ # Prevents you from mocking or stubbing a method that does not exist on
35
+ # a real object. This is generally recommended, and will default to
36
+ # `true` in RSpec 4.
37
+ mocks.verify_partial_doubles = true
38
+ end
39
+
40
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
41
+ # have no way to turn it off -- the option exists only for backwards
42
+ # compatibility in RSpec 3). It causes shared context metadata to be
43
+ # inherited by the metadata hash of host groups and examples, rather than
44
+ # triggering implicit auto-inclusion in groups with matching metadata.
45
+ config.shared_context_metadata_behavior = :apply_to_host_groups
46
+
47
+ # The settings below are suggested to provide a good initial experience
48
+ # with RSpec, but feel free to customize to your heart's content.
49
+ =begin
50
+ # This allows you to limit a spec run to individual examples or groups
51
+ # you care about by tagging them with `:focus` metadata. When nothing
52
+ # is tagged with `:focus`, all examples get run. RSpec also provides
53
+ # aliases for `it`, `describe`, and `context` that include `:focus`
54
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
55
+ config.filter_run_when_matching :focus
56
+
57
+ # Allows RSpec to persist some state between runs in order to support
58
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
59
+ # you configure your source control system to ignore this file.
60
+ config.example_status_persistence_file_path = "spec/examples.txt"
61
+
62
+ # Limits the available syntax to the non-monkey patched syntax that is
63
+ # recommended. For more details, see:
64
+ # https://rspec.info/features/3-12/rspec-core/configuration/zero-monkey-patching-mode/
65
+ config.disable_monkey_patching!
66
+
67
+ # This setting enables warnings. It's recommended, but in some cases may
68
+ # be too noisy due to issues in dependencies.
69
+ config.warnings = true
70
+
71
+ # Many RSpec users commonly either run the entire suite or an individual
72
+ # file, and it's useful to allow more verbose output when running an
73
+ # individual spec file.
74
+ if config.files_to_run.one?
75
+ # Use the documentation formatter for detailed output,
76
+ # unless a formatter has already been configured
77
+ # (e.g. via a command-line flag).
78
+ config.default_formatter = "doc"
79
+ end
80
+
81
+ # Print the 10 slowest examples and example groups at the
82
+ # end of the spec run, to help surface which specs are running
83
+ # particularly slow.
84
+ config.profile_examples = 10
85
+
86
+ # Run specs in random order to surface order dependencies. If you find an
87
+ # order dependency and want to debug it, you can fix the order by providing
88
+ # the seed, which is printed after each run.
89
+ # --seed 1234
90
+ config.order = :random
91
+
92
+ # Seed global randomization in this process using the `--seed` CLI option.
93
+ # Setting this allows you to use `--seed` to deterministically reproduce
94
+ # test failures related to randomization by passing the same `--seed` value
95
+ # as the one that triggered the failure.
96
+ Kernel.srand config.seed
97
+ =end
98
+ end
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby_game_gems
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.2'
5
+ platform: ruby
6
+ authors:
7
+ - Pankaj Porwal
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-07-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: '2.8'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 2.8.0
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '2.8'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 2.8.0
33
+ description: |-
34
+ RubyGame is a action based fighting game where a player has access to treasures which rewards them points.
35
+ After completing all the rounds, the player with highest points wins the game.
36
+ email: pankaj.porwal@gemsessence.com
37
+ executables:
38
+ - game_class
39
+ extensions: []
40
+ extra_rdoc_files: []
41
+ files:
42
+ - LICENSE
43
+ - README
44
+ - bin/game_class
45
+ - bin/players.csv
46
+ - lib/ruby_game/auditable.rb
47
+ - lib/ruby_game/berserk_player.rb
48
+ - lib/ruby_game/clumsy_player.rb
49
+ - lib/ruby_game/die.rb
50
+ - lib/ruby_game/loaded_die.rb
51
+ - lib/ruby_game/playable.rb
52
+ - lib/ruby_game/players_class.rb
53
+ - lib/ruby_game/review.rb
54
+ - lib/ruby_game/treasure.rb
55
+ - lib/useless
56
+ - spec/ruby_game/berserk_player_spec.rb
57
+ - spec/ruby_game/clumsy_player_spec.rb
58
+ - spec/ruby_game/game_spec.rb
59
+ - spec/ruby_game/player_spec.rb
60
+ - spec/ruby_game/spec_helper.rb
61
+ - spec/ruby_game/treasure_spec.rb
62
+ - spec/spec_helper.rb
63
+ homepage: ''
64
+ licenses:
65
+ - MIT
66
+ metadata: {}
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '1.9'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ requirements: []
82
+ rubygems_version: 3.4.1
83
+ signing_key:
84
+ specification_version: 4
85
+ summary: An action based fighting game
86
+ test_files:
87
+ - spec/ruby_game/berserk_player_spec.rb
88
+ - spec/ruby_game/clumsy_player_spec.rb
89
+ - spec/ruby_game/game_spec.rb
90
+ - spec/ruby_game/player_spec.rb
91
+ - spec/ruby_game/spec_helper.rb
92
+ - spec/ruby_game/treasure_spec.rb
93
+ - spec/spec_helper.rb