redjack 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +47 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/blackjack.rb +9 -0
- data/lib/blackjack/card.rb +28 -0
- data/lib/blackjack/dealer.rb +53 -0
- data/lib/blackjack/deck.rb +30 -0
- data/lib/blackjack/game.rb +117 -0
- data/lib/blackjack/player.rb +179 -0
- data/lib/blackjack/version.rb +3 -0
- data/redjack.gemspec +40 -0
- metadata +130 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: bed6bb0cd0b19394ab69afb8e343e06ea6546e53051929adcec75beb1b2d931a
|
4
|
+
data.tar.gz: 7bb8ba46197bf3462d5010d713322eea8fe65303136aceba959209c759640a6f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 638b9121c4921d82c8c2741f6319751ec9fc8c3969fd961765cecab017eb003abbd184efa001e8d6b88c0484e68274a53263b6b47e67fb9b03e9a46afe4d773d
|
7
|
+
data.tar.gz: d05040ed5bf6c6ad041f0898a2f7424f0773c290841bea1c73f5a7c9fd38a3c28a7ccef4db62716c28459f6e00e715981ed9cdb63673b794e747bfc6f008bba9
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
redjack (0.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
coderay (1.1.2)
|
10
|
+
diff-lcs (1.3)
|
11
|
+
docile (1.3.2)
|
12
|
+
method_source (0.9.2)
|
13
|
+
pry (0.12.2)
|
14
|
+
coderay (~> 1.1.0)
|
15
|
+
method_source (~> 0.9.0)
|
16
|
+
rake (10.5.0)
|
17
|
+
rspec (3.9.0)
|
18
|
+
rspec-core (~> 3.9.0)
|
19
|
+
rspec-expectations (~> 3.9.0)
|
20
|
+
rspec-mocks (~> 3.9.0)
|
21
|
+
rspec-core (3.9.1)
|
22
|
+
rspec-support (~> 3.9.1)
|
23
|
+
rspec-expectations (3.9.0)
|
24
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
25
|
+
rspec-support (~> 3.9.0)
|
26
|
+
rspec-mocks (3.9.1)
|
27
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
28
|
+
rspec-support (~> 3.9.0)
|
29
|
+
rspec-support (3.9.2)
|
30
|
+
simplecov (0.19.0)
|
31
|
+
docile (~> 1.1)
|
32
|
+
simplecov-html (~> 0.11)
|
33
|
+
simplecov-html (0.12.3)
|
34
|
+
|
35
|
+
PLATFORMS
|
36
|
+
ruby
|
37
|
+
|
38
|
+
DEPENDENCIES
|
39
|
+
bundler
|
40
|
+
pry
|
41
|
+
rake (~> 10.0)
|
42
|
+
redjack!
|
43
|
+
rspec (~> 3.0)
|
44
|
+
simplecov
|
45
|
+
|
46
|
+
BUNDLED WITH
|
47
|
+
2.1.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Tim Kretschmer
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# Redjack - the BlackJack in Ruby
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/blackjack`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'blackjack'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install blackjack
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/blackjack. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
40
|
+
|
41
|
+
## Code of Conduct
|
42
|
+
|
43
|
+
Everyone interacting in the Blackjack project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/blackjack/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "blackjack"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/blackjack.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
module Blackjack
|
2
|
+
class Card < Struct.new(:rank, :suit)
|
3
|
+
# :nocov:
|
4
|
+
def inspect
|
5
|
+
"#{rank}#{suit[0]}"
|
6
|
+
end
|
7
|
+
# :nocov:
|
8
|
+
|
9
|
+
# :nocov:
|
10
|
+
def to_s
|
11
|
+
"#{rank} of #{suit}"
|
12
|
+
end
|
13
|
+
# :nocov:
|
14
|
+
|
15
|
+
def ace?
|
16
|
+
rank == "A"
|
17
|
+
end
|
18
|
+
|
19
|
+
def points
|
20
|
+
if ace?
|
21
|
+
11
|
22
|
+
else
|
23
|
+
# if it's not a number, it's a 10
|
24
|
+
(rank.is_a?(Integer) || rank.to_i != 0) ? rank.to_i : 10
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module Blackjack
|
2
|
+
class Dealer < Player
|
3
|
+
def initialize(game, options={})
|
4
|
+
self.game = game
|
5
|
+
self.cards = []
|
6
|
+
self.finished = false
|
7
|
+
self.splitted = options.fetch(:splitted, false)
|
8
|
+
end
|
9
|
+
|
10
|
+
# :nocov:
|
11
|
+
def inspect
|
12
|
+
"<Dealer# (#{finished? ? points: "?"}): #{cards.collect(&:inspect).join(" ")} >"
|
13
|
+
end
|
14
|
+
# :nocov:
|
15
|
+
|
16
|
+
def can_split?
|
17
|
+
false
|
18
|
+
end
|
19
|
+
|
20
|
+
def can_double?
|
21
|
+
false
|
22
|
+
end
|
23
|
+
|
24
|
+
def can_stand?
|
25
|
+
false
|
26
|
+
end
|
27
|
+
|
28
|
+
def must_hit?
|
29
|
+
points < 17 || (points == 17 && cards.one?(&:ace?))
|
30
|
+
end
|
31
|
+
|
32
|
+
def can_play?
|
33
|
+
game.players.all?(&:finished?)
|
34
|
+
end
|
35
|
+
|
36
|
+
def finish!
|
37
|
+
super
|
38
|
+
game.finish!
|
39
|
+
end
|
40
|
+
|
41
|
+
def play!
|
42
|
+
raise "players haven't finished" unless can_play?
|
43
|
+
while(must_hit?) do
|
44
|
+
self.cards << game.deck.draw
|
45
|
+
if blackjack? || points==21 || busted?
|
46
|
+
return finish!
|
47
|
+
end
|
48
|
+
end
|
49
|
+
finish!
|
50
|
+
true
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Blackjack
|
2
|
+
class Deck
|
3
|
+
SUITS = %w(hearts clubs spades diamonds)
|
4
|
+
RANKS = ["A",2, 3, 4, 5, 6, 7, 8, 9, 10, "J", "Q", "K"]
|
5
|
+
|
6
|
+
attr_accessor :cards
|
7
|
+
|
8
|
+
def initialize(decks, seed=Random.new.seed)
|
9
|
+
self.cards = build_deck * decks
|
10
|
+
self.cards.shuffle!(random: Random.new(seed))
|
11
|
+
end
|
12
|
+
|
13
|
+
# :nocov:
|
14
|
+
def inspect
|
15
|
+
"<Deck next: #{cards.first.inspect} left: #{cards.count} >"
|
16
|
+
end
|
17
|
+
# :nocov:
|
18
|
+
|
19
|
+
def draw
|
20
|
+
# remove first item of deck
|
21
|
+
cards.shift
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def build_deck
|
27
|
+
RANKS.flat_map {|rank| SUITS.flat_map {|suit| Card.new(rank,suit) } }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
module Blackjack
|
2
|
+
class Game
|
3
|
+
attr_accessor :seed
|
4
|
+
attr_accessor :amount_decks
|
5
|
+
attr_accessor :options
|
6
|
+
attr_accessor :players
|
7
|
+
attr_accessor :dealer
|
8
|
+
attr_accessor :actions
|
9
|
+
attr_accessor :deck
|
10
|
+
attr_accessor :balance
|
11
|
+
attr_accessor :finished
|
12
|
+
attr_accessor :bets
|
13
|
+
|
14
|
+
def initialize(args={})
|
15
|
+
self.seed = args.fetch(:seed)
|
16
|
+
self.bets = args.fetch(:bets)
|
17
|
+
self.amount_decks = args.fetch(:amount_decks, 1)
|
18
|
+
self.balance = args.fetch(:balance, 0)
|
19
|
+
self.actions = []
|
20
|
+
prepare
|
21
|
+
load_actions(args.delete(:actions) || [])
|
22
|
+
end
|
23
|
+
|
24
|
+
def prepare
|
25
|
+
self.deck = Deck.new(amount_decks, seed)
|
26
|
+
initialize_players
|
27
|
+
give_out_cards
|
28
|
+
# one special case: all players have a BJ, then it's dealers turn
|
29
|
+
dealer.play! if all_players_finished?
|
30
|
+
end
|
31
|
+
|
32
|
+
def initialize_players
|
33
|
+
self.players = bets.collect{ |amount| Player.new(self, amount) }
|
34
|
+
self.dealer = Dealer.new(self)
|
35
|
+
reindex_players!
|
36
|
+
end
|
37
|
+
|
38
|
+
def reindex_players!
|
39
|
+
players.each_with_index {|player, index| player.position = index}
|
40
|
+
end
|
41
|
+
|
42
|
+
def load_actions(actions)
|
43
|
+
actions.compact.each do |action|
|
44
|
+
load_action(action)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def current_player
|
49
|
+
players.detect(&:playing?)
|
50
|
+
end
|
51
|
+
|
52
|
+
def possible_actions
|
53
|
+
current_player&.possible_actions
|
54
|
+
end
|
55
|
+
|
56
|
+
def load_action(action)
|
57
|
+
send(action)
|
58
|
+
end
|
59
|
+
|
60
|
+
def give_out_cards
|
61
|
+
players.each(&:take_card!)
|
62
|
+
dealer.take_card!
|
63
|
+
players.each(&:take_card!)
|
64
|
+
end
|
65
|
+
|
66
|
+
def american_rules?
|
67
|
+
false
|
68
|
+
end
|
69
|
+
|
70
|
+
def hit!
|
71
|
+
if current_player&.hit!
|
72
|
+
self.actions << :hit!
|
73
|
+
hit! if current_player&.must_hit?
|
74
|
+
true
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def stand!
|
79
|
+
if current_player&.stand!
|
80
|
+
self.actions << :stand!
|
81
|
+
hit! if current_player&.must_hit?
|
82
|
+
dealer.play! if all_players_finished?
|
83
|
+
true
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def double!
|
88
|
+
if current_player&.double!
|
89
|
+
self.actions << :double!
|
90
|
+
hit! if current_player&.must_hit?
|
91
|
+
dealer.play! if all_players_finished?
|
92
|
+
true
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def split!
|
97
|
+
if current_player.split!
|
98
|
+
self.actions << :split!
|
99
|
+
hit! if current_player&.must_hit?
|
100
|
+
true
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def finish!
|
105
|
+
self.finished = true
|
106
|
+
end
|
107
|
+
|
108
|
+
def finished?
|
109
|
+
finished
|
110
|
+
end
|
111
|
+
|
112
|
+
def all_players_finished?
|
113
|
+
players.all?(&:finished?)
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
117
|
+
end
|
@@ -0,0 +1,179 @@
|
|
1
|
+
module Blackjack
|
2
|
+
class Player
|
3
|
+
attr_accessor :splitted
|
4
|
+
attr_accessor :game
|
5
|
+
attr_accessor :cards
|
6
|
+
attr_accessor :finished
|
7
|
+
attr_accessor :position
|
8
|
+
attr_accessor :amount
|
9
|
+
|
10
|
+
def initialize(game, amount, options={})
|
11
|
+
self.game = game
|
12
|
+
self.cards = []
|
13
|
+
self.finished = false
|
14
|
+
self.amount = amount
|
15
|
+
self.splitted = options.fetch(:splitted, false)
|
16
|
+
if splitted?
|
17
|
+
game.balance -= amount
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# :nocov:
|
22
|
+
def inspect
|
23
|
+
"<Player##{position} (#{points}): #{cards.collect(&:inspect).join(" ")} possible_actions: #{possible_actions}>"
|
24
|
+
end
|
25
|
+
# :nocov:
|
26
|
+
|
27
|
+
def his_turn?
|
28
|
+
previous_players.all?(&:finished?)
|
29
|
+
end
|
30
|
+
|
31
|
+
def previous_players
|
32
|
+
game.players.select{|other| other.position < position}
|
33
|
+
end
|
34
|
+
|
35
|
+
def finish!
|
36
|
+
raise "already finished" if finished?
|
37
|
+
self.finished = true
|
38
|
+
points # do we need this?
|
39
|
+
end
|
40
|
+
|
41
|
+
def playing?
|
42
|
+
!finished?
|
43
|
+
end
|
44
|
+
|
45
|
+
def finished?
|
46
|
+
finished
|
47
|
+
end
|
48
|
+
|
49
|
+
def busted?
|
50
|
+
points > 21
|
51
|
+
end
|
52
|
+
|
53
|
+
def must_hit?
|
54
|
+
cards.count == 1 || points <= 8 && !can_split?
|
55
|
+
end
|
56
|
+
|
57
|
+
def blackjack?
|
58
|
+
cards.count == 2 && points == 21 && !splitted?
|
59
|
+
end
|
60
|
+
|
61
|
+
def can_hit?
|
62
|
+
his_turn? && !finished? && points <= 20
|
63
|
+
end
|
64
|
+
|
65
|
+
def can_stand?
|
66
|
+
!finished?
|
67
|
+
end
|
68
|
+
|
69
|
+
def can_split?
|
70
|
+
!splitted? && !finished? && cards.count == 2 && cards.first.points == cards.last.points && enough_balance_available?
|
71
|
+
end
|
72
|
+
|
73
|
+
def can_double?
|
74
|
+
!splitted_aces? && !finished? && cards.count == 2 && [9,10,11].include?(points) && enough_balance_available?
|
75
|
+
end
|
76
|
+
|
77
|
+
def splitted?
|
78
|
+
splitted
|
79
|
+
end
|
80
|
+
|
81
|
+
def splitted_aces?
|
82
|
+
splitted? && cards.first.ace?
|
83
|
+
end
|
84
|
+
|
85
|
+
def won_with_blackjack?
|
86
|
+
blackjack? && !game.dealer.blackjack?
|
87
|
+
end
|
88
|
+
|
89
|
+
def enough_balance_available?
|
90
|
+
game.balance >= amount
|
91
|
+
end
|
92
|
+
|
93
|
+
def result
|
94
|
+
end
|
95
|
+
|
96
|
+
def take_card!
|
97
|
+
raise "must hit! instead of taking a card" if cards.count >= 2
|
98
|
+
# the initial card round
|
99
|
+
self.cards << game.deck.draw
|
100
|
+
finish! if blackjack?
|
101
|
+
end
|
102
|
+
|
103
|
+
def hit!
|
104
|
+
raise "waiting for previous player to finish" unless his_turn?
|
105
|
+
if can_hit?
|
106
|
+
card = game.deck.draw
|
107
|
+
self.cards << card
|
108
|
+
if blackjack? || points==21 || busted?
|
109
|
+
finish!
|
110
|
+
else
|
111
|
+
points
|
112
|
+
end
|
113
|
+
else
|
114
|
+
raise "can't hit anymore"
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
def stand!
|
119
|
+
finish!
|
120
|
+
end
|
121
|
+
|
122
|
+
def points
|
123
|
+
total = cards.sum(&:points)
|
124
|
+
if total > 21 && cards.any?(&:ace?)
|
125
|
+
# check if we can count some aces as a 1 to be still good
|
126
|
+
|
127
|
+
cards.count(&:ace?).times do
|
128
|
+
total -= 10
|
129
|
+
return total if total <= 21
|
130
|
+
end
|
131
|
+
end
|
132
|
+
total
|
133
|
+
end
|
134
|
+
|
135
|
+
def possible_actions
|
136
|
+
candidates = []
|
137
|
+
candidates << :split! if can_split?
|
138
|
+
candidates << :double! if can_double?
|
139
|
+
if can_hit?
|
140
|
+
candidates << :hit!
|
141
|
+
candidates << :stand!
|
142
|
+
end
|
143
|
+
candidates
|
144
|
+
end
|
145
|
+
|
146
|
+
def double!
|
147
|
+
raise "can't double" unless can_double?
|
148
|
+
game.balance -= amount
|
149
|
+
self.amount += amount
|
150
|
+
hit!
|
151
|
+
stand! unless finished?
|
152
|
+
end
|
153
|
+
|
154
|
+
def split!
|
155
|
+
raise "can't split" unless can_split?
|
156
|
+
# take the second card and make it a new hand
|
157
|
+
# and reindex_players all the other hands
|
158
|
+
new_player = Player.new(game, amount, splitted: true)
|
159
|
+
new_player.cards << cards.pop
|
160
|
+
# insert in the hand behind him
|
161
|
+
game.players.insert(position+1, new_player)
|
162
|
+
game.reindex_players!
|
163
|
+
hit!
|
164
|
+
self.splitted = true
|
165
|
+
end
|
166
|
+
|
167
|
+
# :nocov:
|
168
|
+
def status
|
169
|
+
return :playing if playing?
|
170
|
+
return :busted if busted?
|
171
|
+
return :blackjack if won_with_blackjack?
|
172
|
+
return :waiting_for_dealer unless game.dealer.finished?
|
173
|
+
return :push if points == game.dealer.points
|
174
|
+
return :win if points > game.dealer.points || game.dealer.busted?
|
175
|
+
:lose
|
176
|
+
end
|
177
|
+
# :nocov:
|
178
|
+
end
|
179
|
+
end
|
data/redjack.gemspec
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "blackjack/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "redjack"
|
7
|
+
spec.version = Blackjack::VERSION
|
8
|
+
spec.authors = ["Tim Kretschmer"]
|
9
|
+
spec.email = ["tim@krtschmr.de"]
|
10
|
+
|
11
|
+
spec.summary = %q{redjack is a Black Jack game written in Ruby}
|
12
|
+
spec.description = %q{A replayable Black Jack game based in Ruby}
|
13
|
+
spec.homepage = "https://github.com/krtschmr/redjack"
|
14
|
+
|
15
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
16
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
17
|
+
if spec.respond_to?(:metadata)
|
18
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
19
|
+
else
|
20
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
21
|
+
"public gem pushes."
|
22
|
+
end
|
23
|
+
|
24
|
+
# Specify which files should be added to the gem when it is released.
|
25
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
26
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
27
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
28
|
+
end
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
|
34
|
+
spec.add_development_dependency "bundler"
|
35
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
36
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
37
|
+
spec.add_development_dependency "simplecov"
|
38
|
+
spec.add_development_dependency "pry"
|
39
|
+
end
|
40
|
+
|
metadata
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: redjack
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tim Kretschmer
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-10-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
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
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: simplecov
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: A replayable Black Jack game based in Ruby
|
84
|
+
email:
|
85
|
+
- tim@krtschmr.de
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".rspec"
|
92
|
+
- ".travis.yml"
|
93
|
+
- Gemfile
|
94
|
+
- Gemfile.lock
|
95
|
+
- LICENSE.txt
|
96
|
+
- README.md
|
97
|
+
- Rakefile
|
98
|
+
- bin/console
|
99
|
+
- bin/setup
|
100
|
+
- lib/blackjack.rb
|
101
|
+
- lib/blackjack/card.rb
|
102
|
+
- lib/blackjack/dealer.rb
|
103
|
+
- lib/blackjack/deck.rb
|
104
|
+
- lib/blackjack/game.rb
|
105
|
+
- lib/blackjack/player.rb
|
106
|
+
- lib/blackjack/version.rb
|
107
|
+
- redjack.gemspec
|
108
|
+
homepage: https://github.com/krtschmr/redjack
|
109
|
+
licenses: []
|
110
|
+
metadata: {}
|
111
|
+
post_install_message:
|
112
|
+
rdoc_options: []
|
113
|
+
require_paths:
|
114
|
+
- lib
|
115
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
requirements: []
|
126
|
+
rubygems_version: 3.0.6
|
127
|
+
signing_key:
|
128
|
+
specification_version: 4
|
129
|
+
summary: redjack is a Black Jack game written in Ruby
|
130
|
+
test_files: []
|