99_game 4.0.0.pre → 4.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 0306b69951c78c80e72bec888b2efd6090fc859c
4
- data.tar.gz: 9830073980826d1940b3725dee3ad6ff774b32b2
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZGI3YmJmZDJkNWEwZjljMDBmOGI1M2U2MjRlOGNlZjRkZGRhYjg2OQ==
5
+ data.tar.gz: !binary |-
6
+ NGVhNWZjMDUwZmZmNDRhZGM2ZjBhMGZmYWQxZjM5MGQ4ODZhMzFhMQ==
5
7
  SHA512:
6
- metadata.gz: 308b9468b330e88f60c85d7b4302f47e377e2bff626d9adbc15925011cddc25fcc3a0f68340db524cd3c786e78d60e65f79eaede8c1eacb84dd4f10822ebaed3
7
- data.tar.gz: a6fabf172151357b617a0946ffaebfef0d95987a5a63a3a0fdf685460992feece905dc4fc663c36c8bb9f5fbcc5ee5f45dfdee4f5ca02cf6d8cd330ebb7468a6
8
+ metadata.gz: !binary |-
9
+ NTk3ZjY0OGUyODJlOTVjMzk5ZGM0ZWM5ZTgyNTU1NThkNWMwZjA5NjVkZjlj
10
+ NjUyMThkOWI5MDkzMjlkZGI0MTBmYzVlYWI5ZTdhYTdiY2I4NDAwMjk2N2M2
11
+ YTA1MGViMTM3ZWE3ZmRiYzg1YWE3MTkzMzQ3Y2U3M2YzODI2MDU=
12
+ data.tar.gz: !binary |-
13
+ NzBhMjgzYWZiZTg1NjcyM2Q4YWM3ZWExYjgwNmVhM2YxNjEyMTNhNDA3ZDMy
14
+ YWRjYjUwOWNhMjUzODE0NjdjNDkwNzRiMzdhMmQyZTkwMDUzZTdjMDk1MDRm
15
+ MjBjMWRjNDdjZGQ5NjkxYmU5ZjJjYjc0MWEwNWNkZWQzMjYwYmM=
data/LICENSE.md CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2016 Zachary Roth Perlmutter
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Zachary Roth Perlmutter
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,14 +1,14 @@
1
-
2
- # 99_game
3
-
4
- To install: `gem install 99_game`
5
-
6
- For the rules and arguments: `99_game -h`
7
-
8
- ## Badges
9
- [![Gem Version](https://badge.fury.io/rb/99_game.png)](http://badge.fury.io/rb/99_game)
10
- [![Build Status](https://travis-ci.org/Zrp200/99_game.svg?branch=master)](https://travis-ci.org/Zrp200/99_game)
11
- [![Code Climate](https://codeclimate.com/github/Zrp200/99_game.png)](https://codeclimate.com/github/Zrp200/99_game)
12
- [![Dependency Status](https://gemnasium.com/Zrp200/99_game.svg)](https://gemnasium.com/Zrp200/99_game)
13
- [![Inline docs](http://inch-ci.org/github/Zrp200/99_game.png?branch=master)](http://inch-ci.org/github/Zrp200/99_game)
14
- [![Test Coverage](https://codeclimate.com/github/Zrp200/99_game/coverage.png)](https://codeclimate.com/github/Zrp200/99_game)
1
+
2
+ # 99_game
3
+
4
+ To install: `gem install 99_game`
5
+
6
+ For the rules and arguments: `99_game -h`
7
+
8
+ ## Badges
9
+ [![Gem Version](https://badge.fury.io/rb/99_game.png)](http://badge.fury.io/rb/99_game)
10
+ [![Build Status](https://travis-ci.org/Zrp200/99_game.svg?branch=master)](https://travis-ci.org/Zrp200/99_game)
11
+ [![Code Climate](https://codeclimate.com/github/Zrp200/99_game.png)](https://codeclimate.com/github/Zrp200/99_game)
12
+ [![Dependency Status](https://gemnasium.com/Zrp200/99_game.svg)](https://gemnasium.com/Zrp200/99_game)
13
+ [![Inline docs](http://inch-ci.org/github/Zrp200/99_game.png?branch=master)](http://inch-ci.org/github/Zrp200/99_game)
14
+ [![Test Coverage](https://codeclimate.com/github/Zrp200/99_game/coverage.png)](https://codeclimate.com/github/Zrp200/99_game)
@@ -1,86 +1,88 @@
1
- #!/usr/bin/env ruby
2
- require '99_game'
3
- include CardDeck
4
- BEGIN { # Looks at its arguements
5
- ARGV[0] = "-h" if ARGV.first == "--help"
6
- ARGV[0] = "-v" if ARGV[0] == "--version"
7
- case ARGV[0]
8
- when "-v"
9
- puts "3.2.2"
10
- exit
11
- when "-h"
12
- puts "\u00B7 Commands"
13
- puts "\t\u00b7 -v/--version - display version"
14
- puts "\t\u00B7 -h/--help - shows this message\n"
15
- puts "\u00B7 Abbrevations can be used instead of inputting the whole name of a card"
16
- puts "\t\u00B7 J -> Jack"
17
- puts "\t\u00b7 Q -> Queen"
18
- puts "\t\u00b7 K -> King"
19
- puts "\t\u00b7 A -> Ace"
20
- puts "\t\u00b7 $ -> Joker"
21
- puts "\u00B7 Gameplay"
22
- puts "\t\u00B7 Your goal is to get your opponent to bring the value over 99 by playing 1 of your 3 cards."
23
- puts "\t\u00B7 A card will usually increase the value by itself, but there are a few exceptions:"
24
- puts "\t\t\u00B7 Aces are worth 1"
25
- puts "\t\tu00B7 4, 9, and Jacks are worth 0"
26
- puts "\t\t\u00B7 Queens decrease the value by 10"
27
- puts "\t\t\u00B7 Kings set the value to 99"
28
- puts "\t\t\u00B7 Jokers set the value to 0"
29
- exit
30
- end
31
- }
32
- END { # Thanks for playing
33
- sleep 1.5
34
- puts "\nThanks for playing 99!"
35
- sleep 2.5
36
- }
37
- $value, value1, value2, value3, dealer, user = 0,0,0,0, Hand.new, Hand.new
38
- loop do
39
- puts "\nIt's the dealer's turn!"
40
- i, outcomes = 0, dealer.test_outcomes
41
- if outcomes[0] >= outcomes[1] && outcomes[0] >= outcomes[2]
42
- outcome = 0
43
- elsif outcomes[1] >= outcomes[0] && outcomes[1] >= outcomes[2]
44
- outcome = 1
45
- else
46
- outcome = 2
47
- end
48
- pause 1.5
49
- puts "The dealer played #{dealer.play dealer.cards[outcome]}"
50
- pause(0.5)
51
- puts "The value is now #{$value}\n"
52
- pause(1.5)
53
- if $value > 99 # Runs when you win and exits loop
54
- puts "You win!"
55
- break
56
- end
57
- puts "It's your turn!"
58
- pause 1
59
- user.view_cards
60
- pause 0.5
61
- puts "Pick a card to play by typing in the name of the card"
62
- sleep 0.2
63
- playing = true
64
- while playing
65
- print "> "
66
- input = gets.chomp
67
- user.cards.each do |card|
68
- if card.num == converter(input) && playing
69
- user.play card
70
- playing = false
71
- end
72
- end
73
- sleep 0.2
74
- puts "Illegal input. Please enter a legal card" if playing
75
- end
76
- pause 0.75
77
- puts "The value is now #{$value}"
78
- pause(1.5)
79
- if $value > 99 # Runs when dealer wins and exits loop
80
- puts "You lose..."
81
- break
82
- end
83
- puts "You drew #{user.cards.last}"
84
- end
85
- __END__
86
- Programmed by: Zachary Perlmutter
1
+ #!/usr/bin/env ruby
2
+ require '99_game'
3
+ include CardDeck
4
+ BEGIN { # Looks at its arguements
5
+ ARGV[0] = "-h" if ARGV.first == "--help"
6
+ ARGV[0] = "-v" if ARGV[0] == "--version"
7
+ case ARGV[0]
8
+ when "-v"
9
+ puts "3.2.2"
10
+ exit
11
+ when "-h"
12
+ puts "\u00B7 Commands"
13
+ puts "\t\u00b7 -v/--version - display version"
14
+ puts "\t\u00B7 -h/--help - shows this message\n"
15
+ puts "\u00B7 Abbrevations can be used instead of inputting the whole name of a card"
16
+ puts "\t\u00B7 J -> Jack"
17
+ puts "\t\u00b7 Q -> Queen"
18
+ puts "\t\u00b7 K -> King"
19
+ puts "\t\u00b7 A -> Ace"
20
+ puts "\t\u00b7 $ -> Joker"
21
+ puts "\u00B7 Gameplay"
22
+ puts "\t\u00B7 Your goal is to get your opponent to bring the value over 99 by playing 1 of your 3 cards."
23
+ puts "\t\u00B7 A card will usually increase the value by itself, but there are a few exceptions:"
24
+ puts "\t\t\u00B7 Aces are worth 1"
25
+ puts "\t\tu00B7 4, 9, and Jacks are worth 0"
26
+ puts "\t\t\u00B7 Queens decrease the value by 10"
27
+ puts "\t\t\u00B7 Kings set the value to 99"
28
+ puts "\t\t\u00B7 Jokers set the value to 0"
29
+ exit
30
+ end
31
+ }
32
+ END { # Thanks for playing
33
+ sleep 1.5
34
+ puts "\nThanks for playing 99!"
35
+ sleep 2.5
36
+ }
37
+ $value, value1, value2, value3, dealer, user = 0,0,0,0, Hand.new, Hand.new
38
+ loop do
39
+ puts "\nIt's the dealer's turn!"
40
+ i = 0
41
+ outcomes = dealer.test_outcomes
42
+ if outcomes[0] >= outcomes[1] && outcomes[0] >= outcomes[2]
43
+ outcome = 0
44
+ elsif outcomes[1] >= outcomes[0] && outcomes[1] >= outcomes[2]
45
+ outcome = 1
46
+ else
47
+ outcome = 2
48
+ end
49
+ pause 1.5
50
+ puts "The dealer played #{dealer.play dealer.cards[outcome]}"
51
+ pause(0.5)
52
+ puts "The value is now #{$value}\n"
53
+ pause(1.5)
54
+ if $value > 99 # Runs when you win and exits loop
55
+ puts "You win!"
56
+ break
57
+ end
58
+ puts "It's your turn!"
59
+ pause 1
60
+ user.view_cards
61
+ pause 0.5
62
+ puts "Pick a card to play by typing in the name of the card"
63
+ sleep 0.2
64
+ playing = true
65
+ while playing
66
+ print "> "
67
+ input = gets.chomp
68
+ user.cards.each do |card|
69
+ if card.num == converter(input) && playing
70
+ user.play card
71
+ playing = false
72
+ end
73
+ end
74
+ sleep 0.2
75
+ puts "Illegal input. Please enter a legal card" if playing
76
+ end
77
+ pause 1
78
+ puts "You drew #{user.cards.last}"
79
+ pause 0.5
80
+ puts "The value is now #{$value}"
81
+ pause(1.5)
82
+ if $value > 99 # Runs when dealer wins and exits loop
83
+ puts "You lose..."
84
+ break
85
+ end
86
+ end
87
+ __END__
88
+ Programmed by: Zachary Perlmutter
@@ -1,58 +1,58 @@
1
- autoload :CardDeck, "card_deck"
2
- autoload :Card, "card"
3
- autoload :Hand, "hand"
4
- =begin
5
- @param card [CardDeck::Card]
6
- @param actual_value [Integer]
7
- @return [Integer]
8
- @note Used by the CPU to determine which card to play. Parameter card needs to be an instance of Card.
9
- =end
10
- def card_test(card, actual_value)
11
- test_value = case card.num
12
- when "King" then 99
13
- when "Joker" then 0
14
- else
15
- actual_value + card.value
16
- end
17
- test_value = -1 if test_value > 99
18
- test_value
19
- end
20
- # Tests if obj is not nil.
21
- def not_nil?(obj)
22
- !obj.nil?
23
- end
24
- # Converts input to an integer if String#capitalize does something. If parameter input is an abbreviation, _input_ is converted to what it stands for. Otherwise, it simply returns a capitalized version of _input_. If _input_ is nil or an emtpy string, raises a CardError
25
- # Expected errors
26
- class CardError < Exception; end
27
- =begin
28
- Combines sleep and a newline
29
- @param p [Integer] amount of time to sleep
30
- @return [void]
31
- =end
32
- def pause(p)
33
- sleep p
34
- puts
35
- end
36
- =begin
37
- @param input [String]
38
- @return [String, Integer]
39
- If parameter input is an abbreviation, input is converted to what it stands for.
40
- Otherwise, it simply returns a capitalized version of input.
41
- @raise [CardError] if input is nil or an emtpy string
42
- =end
43
- def converter(input)
44
- abbrev = {"$" => "Joker", "K" => "King", "J" => "Jack", "Q" => "Queen", "A" => "Ace"}
45
- raise(CardError, "Input cannot be blank") if input == String.new
46
- if input.to_i.zero?
47
- case input.capitalize
48
- when ?$, "Joker" then "Joker"
49
- when ?K, "King" then "King"
50
- when ?J, "Jack" then "Jack"
51
- when ?Q, "Queen" then "Queen"
52
- when ?A, "Ace" then "Ace"
53
- end
54
- else
55
- input.to_i
56
- end
57
- end
58
-
1
+ autoload :CardDeck, "card_deck"
2
+ autoload :Card, "card"
3
+ autoload :Hand, "hand"
4
+ =begin
5
+ @param card [CardDeck::Card]
6
+ @param actual_value [Integer]
7
+ @return [Integer]
8
+ @note Used by the CPU to determine which card to play. Parameter card needs to be an instance of Card.
9
+ =end
10
+ def card_test(card, actual_value)
11
+ test_value = case card.num
12
+ when "King" then 99
13
+ when "Joker" then 0
14
+ else
15
+ actual_value + card.value
16
+ end
17
+ test_value = -1 if test_value > 99
18
+ test_value
19
+ end
20
+ # Tests if obj is not nil.
21
+ def not_nil?(obj)
22
+ !obj.nil?
23
+ end
24
+ # Converts input to an integer if String#capitalize does something. If parameter input is an abbreviation, _input_ is converted to what it stands for. Otherwise, it simply returns a capitalized version of _input_. If _input_ is nil or an emtpy string, raises a CardError
25
+ # Expected errors
26
+ class CardError < Exception; end
27
+ =begin
28
+ Combines sleep and a newline
29
+ @param p [Integer] amount of time to sleep
30
+ @return [void]
31
+ =end
32
+ def pause(p)
33
+ sleep p
34
+ puts
35
+ end
36
+ =begin
37
+ @param input [String]
38
+ @return [String, Integer]
39
+ If parameter input is an abbreviation, input is converted to what it stands for.
40
+ Otherwise, it simply returns a capitalized version of input.
41
+ @raise [CardError] if input is nil or an emtpy string
42
+ =end
43
+ def converter(input)
44
+ abbrev = {"$" => "Joker", "K" => "King", "J" => "Jack", "Q" => "Queen", "A" => "Ace"}
45
+ raise(CardError, "Input cannot be blank") if input == String.new
46
+ if input.to_i.zero?
47
+ case input.capitalize
48
+ when ?$, "Joker" then "Joker"
49
+ when ?K, "King" then "King"
50
+ when ?J, "Jack" then "Jack"
51
+ when ?Q, "Queen" then "Queen"
52
+ when ?A, "Ace" then "Ace"
53
+ end
54
+ else
55
+ input.to_i
56
+ end
57
+ end
58
+
@@ -1,18 +1,18 @@
1
- require "card_deck"
2
- class CardDeck::Card # Represents a card in the deck
3
- # Value of the card
4
- def value
5
- case @num
6
- when "Ace" then 1
7
- when 2..3 then @num
8
- when 4 then 0
9
- when 5..8 then @num
10
- when 9 then 0
11
- when 10 then 10
12
- when "Jack" then 0
13
- when "Queen" then -10
14
- when "King" then 99
15
- when "Joker" then 0
16
- end
17
- end
18
- end
1
+ require "card_deck"
2
+ class CardDeck::Card # Represents a card in the deck
3
+ # Value of the card
4
+ def value
5
+ case @num
6
+ when "Ace" then 1
7
+ when 2..3 then @num
8
+ when 4 then 0
9
+ when 5..8 then @num
10
+ when 9 then 0
11
+ when 10 then 10
12
+ when "Jack" then 0
13
+ when "Queen" then -10
14
+ when "King" then 99
15
+ when "Joker" then 0
16
+ end
17
+ end
18
+ end
@@ -1,64 +1,64 @@
1
- require_relative "card.rb"
2
- $deck = Deck.new(jokers: true).cards.shuffle!
3
- class Hand # Creates an object that holds and can play cards. Interacts with Deck objects.
4
- @@deck = Deck.new.cards.shuffle!
5
- attr_accessor :cards # @return [Array<CardDeck::Card>]
6
- def initialize
7
- @cards = Array.new(3) {$deck.shift}
8
- end
9
-
10
- # @param card [CardDeck::Card] the card played
11
- # @return [void]
12
- # @note Gameplay method
13
- def play(card)
14
- raise "Card not found" unless @cards.include? card
15
- if card.num == "King"
16
- $value = 99
17
- elsif card.num == "Joker"
18
- $value = 0
19
- else
20
- $value += card.value
21
- end
22
- i, done = 0, false
23
- for index in @cards
24
- if index.num == card.num and not done
25
- discard = @cards[i]
26
- @cards.delete_at i
27
- @cards.push $deck.shift
28
- $deck.push discard
29
- done = true
30
- $deck.shuffle!
31
- end
32
- i += 1
33
- end
34
- card
35
- end
36
-
37
- # @return [void]
38
- # Displays cards
39
- def view_cards
40
- print "These are your cards: "
41
- @cards.each {|card| print "#{card} "}
42
- end
43
- alias inspect cards
44
- # @return [Array<Integer>]
45
- # @note Used by the CPU to determine which card to play. Parameter card needs to be an instance of Card.
46
- def test_outcomes
47
- outcomes = Array.new
48
- @cards.each do |card|
49
- test_value = case card.num
50
- when "King"
51
- if (@cards - [card]).any? {|card| [4, 9, "Jack", "Queen", "King", "Joker"].include? card.num} || rand < 0.1
52
- 99
53
- else -99
54
- end
55
- when "Joker" then 0
56
- else
57
- $value + card.value
58
- end
59
- test_value = -100 if test_value > 99
60
- outcomes << test_value
61
- end
62
- return outcomes
63
- end
64
- end
1
+ require_relative "card.rb"
2
+ $deck = Deck.new(jokers: true).cards.shuffle!
3
+ class Hand # Creates an object that holds and can play cards. Interacts with Deck objects.
4
+ @@deck = Deck.new.cards.shuffle!
5
+ attr_accessor :cards # @return [Array<CardDeck::Card>]
6
+ def initialize
7
+ @cards = Array.new(3) {$deck.shift}
8
+ end
9
+
10
+ # @param card [CardDeck::Card] the card played
11
+ # @return [void]
12
+ # @note Gameplay method
13
+ def play(card)
14
+ raise "Card not found" unless @cards.include? card
15
+ if card.num == "King"
16
+ $value = 99
17
+ elsif card.num == "Joker"
18
+ $value = 0
19
+ else
20
+ $value += card.value
21
+ end
22
+ i, done = 0, false
23
+ for index in @cards
24
+ if index.num == card.num and not done
25
+ discard = @cards[i]
26
+ @cards.delete_at i
27
+ @cards.push $deck.shift
28
+ $deck.push discard
29
+ done = true
30
+ $deck.shuffle!
31
+ end
32
+ i += 1
33
+ end
34
+ card
35
+ end
36
+
37
+ # @return [void]
38
+ # Displays cards
39
+ def view_cards
40
+ print "These are your cards: "
41
+ @cards.each {|card| print "#{card} "}
42
+ end
43
+ alias inspect cards
44
+ # @return [Array<Integer>]
45
+ # @note Used by the CPU to determine which card to play. Parameter card needs to be an instance of Card.
46
+ def test_outcomes
47
+ outcomes = Array.new
48
+ @cards.each do |card|
49
+ test_value = case card.num
50
+ when "King"
51
+ if (@cards - [card]).any? {|card| [4, 9, "Jack", "Queen", "King", "Joker"].include? card.num} || rand < 0.1
52
+ 99
53
+ else -1
54
+ end
55
+ when "Joker" then 0
56
+ else
57
+ $value + card.value
58
+ end
59
+ test_value = -1 if test_value > 99
60
+ outcomes << test_value
61
+ end
62
+ return outcomes
63
+ end
64
+ end
@@ -1,2 +1,2 @@
1
- require "codeclimate-test-reporter"
2
- CodeClimate::TestReporter.start
1
+ require "codeclimate-test-reporter"
2
+ CodeClimate::TestReporter.start
@@ -1,12 +1,12 @@
1
- require "spec_helper"
2
- require "99_game"
3
- describe "converter" do
4
- context "when a number" do
5
- subject { converter ?5 }
6
- it { is_expected.to eq 5 }
7
- end
8
- context "when an abbreveation" do
9
- subject { converter ?K }
10
- it {is_expected.to eq "King"}
11
- end
12
- end
1
+ require "spec_helper"
2
+ require "99_game"
3
+ describe "converter" do
4
+ context "when a number" do
5
+ subject { converter ?5 }
6
+ it { is_expected.to eq 5 }
7
+ end
8
+ context "when an abbreveation" do
9
+ subject { converter ?K }
10
+ it {is_expected.to eq "King"}
11
+ end
12
+ end
@@ -1,9 +1,9 @@
1
- require "spec_helper.rb"
2
- require "99_game"
3
- create_deck = proc {Deck.new jokers: true}
4
- deck = create_deck.call
5
- describe Deck do
6
- describe create_deck.call.cards.length do
7
- it {is_expected.to eq 54}
8
- end
9
- end
1
+ require "spec_helper.rb"
2
+ require "99_game"
3
+ create_deck = proc {Deck.new jokers: true}
4
+ deck = create_deck.call
5
+ describe Deck do
6
+ describe create_deck.call.cards.length do
7
+ it {is_expected.to eq 54}
8
+ end
9
+ end
@@ -1,24 +1,24 @@
1
- require "spec_helper"
2
- require "hand"
3
- describe "CPU" do
4
- s = Hand.new
5
- s.cards = [Card.new(10, Card::Spades), Card.new("Joker"), Card.new(2, Card::Diamonds)]
6
- describe "test" do
7
- $value = 50
8
- describe s.test_outcomes[0] do
9
- it {is_expected.to be > s.test_outcomes[1]}
10
- it {is_expected.to be > s.test_outcomes[2]}
11
- end
12
- end
13
- end
14
- describe Hand do
15
- describe "#new" do
16
- describe "#cards" do
17
- subject {Hand.new.cards}
18
- describe "#length" do
19
- subject {Hand.new.cards.length}
20
- it {is_expected.to be 3}
21
- end
22
- end
23
- end
24
- end
1
+ require "spec_helper"
2
+ require "hand"
3
+ describe "CPU" do
4
+ s = Hand.new
5
+ s.cards = [Card.new(10, Card::Spades), Card.new("Joker"), Card.new(2, Card::Diamonds)]
6
+ describe "test" do
7
+ $value = 50
8
+ describe s.test_outcomes[0] do
9
+ it {is_expected.to be > s.test_outcomes[1]}
10
+ it {is_expected.to be > s.test_outcomes[2]}
11
+ end
12
+ end
13
+ end
14
+ describe Hand do
15
+ describe "#new" do
16
+ describe "#cards" do
17
+ subject {Hand.new.cards}
18
+ describe "#length" do
19
+ subject {Hand.new.cards.length}
20
+ it {is_expected.to be 3}
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,78 +1,78 @@
1
- require_relative "codeclimate.rb"
2
- require "99_game"
3
- include CardDeck
4
- # This file was generated by the `rspec --init` command. Conventionally, all
5
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
6
- # The generated `.rspec` file contains `--require spec_helper` which will cause this
7
- # file to always be loaded, without a need to explicitly require it in any files.
8
- #
9
- # Given that it is always loaded, you are encouraged to keep this file as
10
- # light-weight as possible. Requiring heavyweight dependencies from this file
11
- # will add to the boot time of your test suite on EVERY test run, even for an
12
- # individual file that may not need all of that loaded. Instead, make a
13
- # separate helper file that requires this one and then use it only in the specs
14
- # that actually need it.
15
- #
16
- # The `.rspec` file also contains a few flags that are not defaults but that
17
- # users commonly want.
18
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19
- RSpec.configure do |config|
20
- # The settings below are suggested to provide a good initial experience
21
- # with RSpec, but feel free to customize to your heart's content.
22
- # These two settings work together to allow you to limit a spec run
23
- # to individual examples or groups you care about by tagging them with
24
- # `:focus` metadata. When nothing is tagged with `:focus`, all examples
25
- # get run.
26
- config.filter_run :focus
27
- config.run_all_when_everything_filtered = true
28
-
29
- # Many RSpec users commonly either run the entire suite or an individual
30
- # file, and it's useful to allow more verbose output when running an
31
- # individual spec file.
32
- if config.files_to_run.one?
33
- # Use the documentation formatter for detailed output,
34
- # unless a formatter has already been configured
35
- # (e.g. via a command-line flag).
36
- config.default_formatter = 'doc'
37
- end
38
-
39
- # Print the 10 slowest examples and example groups at the
40
- # end of the spec run, to help surface which specs are running
41
- # particularly slow.
42
- config.profile_examples = 10
43
-
44
- # Run specs in random order to surface order dependencies. If you find an
45
- # order dependency and want to debug it, you can fix the order by providing
46
- # the seed, which is printed after each run.
47
- # --seed 1234
48
- config.order = :random
49
-
50
- # Seed global randomization in this process using the `--seed` CLI option.
51
- # Setting this allows you to use `--seed` to deterministically reproduce
52
- # test failures related to randomization by passing the same `--seed` value
53
- # as the one that triggered the failure.
54
- Kernel.srand config.seed
55
-
56
- # rspec-expectations config goes here. You can use an alternate
57
- # assertion/expectation library such as wrong or the stdlib/minitest
58
- # assertions if you prefer.
59
- config.expect_with :rspec do |expectations|
60
- # Enable only the newer, non-monkey-patching expect syntax.
61
- # For more details, see:
62
- # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
63
- expectations.syntax = :expect
64
- end
65
-
66
- # rspec-mocks config goes here. You can use an alternate test double
67
- # library (such as bogus or mocha) by changing the `mock_with` option here.
68
- config.mock_with :rspec do |mocks|
69
- # Enable only the newer, non-monkey-patching expect syntax.
70
- # For more details, see:
71
- # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
72
- mocks.syntax = :expect
73
-
74
- # Prevents you from mocking or stubbing a method that does not exist on
75
- # a real object. This is generally recommended.
76
- mocks.verify_partial_doubles = true
77
- end
78
- end
1
+ require_relative "codeclimate.rb"
2
+ require "99_game"
3
+ include CardDeck
4
+ # This file was generated by the `rspec --init` command. Conventionally, all
5
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
6
+ # The generated `.rspec` file contains `--require spec_helper` which will cause this
7
+ # file to always be loaded, without a need to explicitly require it in any files.
8
+ #
9
+ # Given that it is always loaded, you are encouraged to keep this file as
10
+ # light-weight as possible. Requiring heavyweight dependencies from this file
11
+ # will add to the boot time of your test suite on EVERY test run, even for an
12
+ # individual file that may not need all of that loaded. Instead, make a
13
+ # separate helper file that requires this one and then use it only in the specs
14
+ # that actually need it.
15
+ #
16
+ # The `.rspec` file also contains a few flags that are not defaults but that
17
+ # users commonly want.
18
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19
+ RSpec.configure do |config|
20
+ # The settings below are suggested to provide a good initial experience
21
+ # with RSpec, but feel free to customize to your heart's content.
22
+ # These two settings work together to allow you to limit a spec run
23
+ # to individual examples or groups you care about by tagging them with
24
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
25
+ # get run.
26
+ config.filter_run :focus
27
+ config.run_all_when_everything_filtered = true
28
+
29
+ # Many RSpec users commonly either run the entire suite or an individual
30
+ # file, and it's useful to allow more verbose output when running an
31
+ # individual spec file.
32
+ if config.files_to_run.one?
33
+ # Use the documentation formatter for detailed output,
34
+ # unless a formatter has already been configured
35
+ # (e.g. via a command-line flag).
36
+ config.default_formatter = 'doc'
37
+ end
38
+
39
+ # Print the 10 slowest examples and example groups at the
40
+ # end of the spec run, to help surface which specs are running
41
+ # particularly slow.
42
+ config.profile_examples = 10
43
+
44
+ # Run specs in random order to surface order dependencies. If you find an
45
+ # order dependency and want to debug it, you can fix the order by providing
46
+ # the seed, which is printed after each run.
47
+ # --seed 1234
48
+ config.order = :random
49
+
50
+ # Seed global randomization in this process using the `--seed` CLI option.
51
+ # Setting this allows you to use `--seed` to deterministically reproduce
52
+ # test failures related to randomization by passing the same `--seed` value
53
+ # as the one that triggered the failure.
54
+ Kernel.srand config.seed
55
+
56
+ # rspec-expectations config goes here. You can use an alternate
57
+ # assertion/expectation library such as wrong or the stdlib/minitest
58
+ # assertions if you prefer.
59
+ config.expect_with :rspec do |expectations|
60
+ # Enable only the newer, non-monkey-patching expect syntax.
61
+ # For more details, see:
62
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
63
+ expectations.syntax = :expect
64
+ end
65
+
66
+ # rspec-mocks config goes here. You can use an alternate test double
67
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
68
+ config.mock_with :rspec do |mocks|
69
+ # Enable only the newer, non-monkey-patching expect syntax.
70
+ # For more details, see:
71
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
72
+ mocks.syntax = :expect
73
+
74
+ # Prevents you from mocking or stubbing a method that does not exist on
75
+ # a real object. This is generally recommended.
76
+ mocks.verify_partial_doubles = true
77
+ end
78
+ end
metadata CHANGED
@@ -1,58 +1,58 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: 99_game
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.pre
4
+ version: 4.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zachary Roth Perlmutter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-30 00:00:00.000000000 Z
11
+ date: 2016-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: card_deck
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '3.1'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec-its
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - ! '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- description: 'This is a text-based interpretation of the card game 99. Comes with
55
+ description: ! 'This is a text-based interpretation of the card game 99. Comes with
56
56
  the gem in the form of an executable. Make sure to read the rules in `99_game -h`
57
57
  before playing.
58
58
 
@@ -86,17 +86,17 @@ require_paths:
86
86
  - lib
87
87
  required_ruby_version: !ruby/object:Gem::Requirement
88
88
  requirements:
89
- - - ">="
89
+ - - ! '>='
90
90
  - !ruby/object:Gem::Version
91
91
  version: 1.9.2
92
92
  required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">"
94
+ - - ! '>='
95
95
  - !ruby/object:Gem::Version
96
- version: 1.3.1
96
+ version: '0'
97
97
  requirements: []
98
98
  rubyforge_project:
99
- rubygems_version: 2.5.2
99
+ rubygems_version: 2.4.5
100
100
  signing_key:
101
101
  specification_version: 4
102
102
  summary: The game of 99.