console-blackjack 1.1.2 → 1.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8781f1af6d69e2392f58e37933d197ce9097e9ff96ed9982a07ce17b57faefd7
4
- data.tar.gz: fa1d6c2d7dcfadf3606b938567d3d582b65a3cef941a3bf146aa4acd19d9715e
3
+ metadata.gz: a80968fb789ad02815a1d598eeaf4ceaabd4ea7d683fa7a5f392dcb116314355
4
+ data.tar.gz: 7e15b203fb77e927ceb9a3d630d7129244c15564f5ace1c33c16b34e69590e06
5
5
  SHA512:
6
- metadata.gz: 3c95571ebeffc86fb789d8a379d3444e0a276c7932cbb84bb5b6942089213f52e4edd0d4fb04a365544dc653e88266a7223ecae22734a1c55ed9bbac9bd10b48
7
- data.tar.gz: 9a10243734d00fcea80056e328a37cb3dea02c8b3adb853d94c5fe88282093574178c6a4131540ee0af4343e2e2dc1c3b819dd14a41fdd2d40644497562e151c
6
+ metadata.gz: f8caf4b44ba2ffa0a6e2ae2dc16dfee13b0537ab68d1ee09b84ed48d0b78dd7eb80e93d74fb2212ebb85b7e3138b138faa20a9bf4e2c6080462cf804d9d69de9
7
+ data.tar.gz: 5fcd249be0447eca9aee18e6aace72834b93c63995555baf4e270d8a190fce78ff666c1eb876353e95103c3139b6b6a719bec106c85133230aa84ed668c06ac6
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- ruby '3.2.1'
3
+ ruby '3.2.2'
4
4
 
5
5
  source 'https://rubygems.org'
6
6
 
data/Gemfile.lock CHANGED
@@ -1,61 +1,80 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- activesupport (7.0.4.2)
4
+ activesupport (7.1.2)
5
+ base64
6
+ bigdecimal
5
7
  concurrent-ruby (~> 1.0, >= 1.0.2)
8
+ connection_pool (>= 2.2.5)
9
+ drb
6
10
  i18n (>= 1.6, < 2)
7
11
  minitest (>= 5.1)
12
+ mutex_m
8
13
  tzinfo (~> 2.0)
9
14
  ast (2.4.2)
15
+ base64 (0.2.0)
16
+ bigdecimal (3.1.4)
10
17
  concurrent-ruby (1.2.2)
18
+ connection_pool (2.4.1)
11
19
  diff-lcs (1.5.0)
12
20
  docile (1.4.0)
13
- factory_bot (6.2.1)
21
+ drb (2.2.0)
22
+ ruby2_keywords
23
+ factory_bot (6.4.2)
14
24
  activesupport (>= 5.0.0)
15
- i18n (1.12.0)
25
+ i18n (1.14.1)
16
26
  concurrent-ruby (~> 1.0)
17
- json (2.6.3)
18
- minitest (5.18.0)
19
- parallel (1.22.1)
20
- parser (3.2.1.1)
27
+ json (2.7.1)
28
+ language_server-protocol (3.17.0.3)
29
+ minitest (5.20.0)
30
+ mutex_m (0.2.0)
31
+ parallel (1.23.0)
32
+ parser (3.2.2.4)
21
33
  ast (~> 2.4.1)
34
+ racc
35
+ racc (1.7.3)
22
36
  rainbow (3.1.1)
23
- rake (13.0.6)
24
- regexp_parser (2.7.0)
25
- rexml (3.2.5)
37
+ rake (13.1.0)
38
+ regexp_parser (2.8.3)
39
+ rexml (3.2.6)
26
40
  rspec (3.12.0)
27
41
  rspec-core (~> 3.12.0)
28
42
  rspec-expectations (~> 3.12.0)
29
43
  rspec-mocks (~> 3.12.0)
30
- rspec-core (3.12.1)
44
+ rspec-core (3.12.2)
31
45
  rspec-support (~> 3.12.0)
32
- rspec-expectations (3.12.2)
46
+ rspec-expectations (3.12.3)
33
47
  diff-lcs (>= 1.2.0, < 2.0)
34
48
  rspec-support (~> 3.12.0)
35
- rspec-mocks (3.12.3)
49
+ rspec-mocks (3.12.6)
36
50
  diff-lcs (>= 1.2.0, < 2.0)
37
51
  rspec-support (~> 3.12.0)
38
- rspec-support (3.12.0)
39
- rubocop (1.48.0)
52
+ rspec-support (3.12.1)
53
+ rubocop (1.58.0)
40
54
  json (~> 2.3)
55
+ language_server-protocol (>= 3.17.0)
41
56
  parallel (~> 1.10)
42
- parser (>= 3.2.0.0)
57
+ parser (>= 3.2.2.4)
43
58
  rainbow (>= 2.2.2, < 4.0)
44
59
  regexp_parser (>= 1.8, < 3.0)
45
60
  rexml (>= 3.2.5, < 4.0)
46
- rubocop-ast (>= 1.26.0, < 2.0)
61
+ rubocop-ast (>= 1.30.0, < 2.0)
47
62
  ruby-progressbar (~> 1.7)
48
63
  unicode-display_width (>= 2.4.0, < 3.0)
49
- rubocop-ast (1.27.0)
64
+ rubocop-ast (1.30.0)
50
65
  parser (>= 3.2.1.0)
51
- rubocop-capybara (2.17.1)
66
+ rubocop-capybara (2.19.0)
52
67
  rubocop (~> 1.41)
68
+ rubocop-factory_bot (2.24.0)
69
+ rubocop (~> 1.33)
53
70
  rubocop-rake (0.6.0)
54
71
  rubocop (~> 1.0)
55
- rubocop-rspec (2.19.0)
56
- rubocop (~> 1.33)
72
+ rubocop-rspec (2.25.0)
73
+ rubocop (~> 1.40)
57
74
  rubocop-capybara (~> 2.17)
75
+ rubocop-factory_bot (~> 2.22)
58
76
  ruby-progressbar (1.13.0)
77
+ ruby2_keywords (0.0.5)
59
78
  simplecov (0.22.0)
60
79
  docile (~> 1.1)
61
80
  simplecov-html (~> 0.11)
@@ -64,9 +83,10 @@ GEM
64
83
  simplecov_json_formatter (0.1.4)
65
84
  tzinfo (2.0.6)
66
85
  concurrent-ruby (~> 1.0)
67
- unicode-display_width (2.4.2)
86
+ unicode-display_width (2.5.0)
68
87
 
69
88
  PLATFORMS
89
+ arm64-darwin-22
70
90
  ruby
71
91
 
72
92
  DEPENDENCIES
@@ -79,7 +99,7 @@ DEPENDENCIES
79
99
  simplecov
80
100
 
81
101
  RUBY VERSION
82
- ruby 3.2.1p31
102
+ ruby 3.2.2p53
83
103
 
84
104
  BUNDLED WITH
85
- 2.3.15
105
+ 2.4.22
data/README.md CHANGED
@@ -38,3 +38,4 @@ I've written Blackjack in several other languages:
38
38
  - [Elixir](https://github.com/gdonald/blackjack-ex)
39
39
  - [Python](https://github.com/gdonald/blackjack-py)
40
40
  - [C with SDL](https://github.com/gdonald/blackjack-c-sdl)
41
+ - [Emacs Lisp](https://github.com/gdonald/blackjack-el)
data/bj.txt CHANGED
@@ -1 +1 @@
1
- 1|1|1|10000|500
1
+ 1|1|1|9000|500
Binary file
@@ -5,7 +5,7 @@ require 'rake'
5
5
  Gem::Specification.new do |spec|
6
6
  spec.required_ruby_version = '>= 3.2'
7
7
  spec.name = 'console-blackjack'
8
- spec.version = '1.1.2'
8
+ spec.version = '1.1.4'
9
9
  spec.summary = 'Console Blackjack'
10
10
  spec.description = 'Blackjack for your console, full version.'
11
11
  spec.author = 'Greg Donald'
@@ -10,20 +10,20 @@ class PlayerHand < Hand
10
10
 
11
11
  MAX_PLAYER_HANDS = 7
12
12
 
13
- attr_accessor :blackjack, :bet, :status, :payed, :cards, :stood
13
+ attr_accessor :blackjack, :bet, :status, :paid, :cards, :stood
14
14
 
15
15
  def initialize(blackjack, bet)
16
16
  super(blackjack)
17
17
  @bet = bet
18
18
  @status = :unknown
19
- @payed = false
19
+ @paid = false
20
20
  @stood = false
21
21
  end
22
22
 
23
23
  def pay(dealer_hand_value, dealer_busted)
24
- return if payed
24
+ return if paid
25
25
 
26
- self.payed = true
26
+ self.paid = true
27
27
  player_hand_value = value(:soft)
28
28
 
29
29
  if player_hand_won?(dealer_busted, dealer_hand_value, player_hand_value)
@@ -68,12 +68,12 @@ class PlayerHand < Hand
68
68
  return false unless no_more_actions?
69
69
 
70
70
  self.played = true
71
- collect_busted_hand if !payed && busted?
71
+ collect_busted_hand if !paid && busted?
72
72
  true
73
73
  end
74
74
 
75
75
  def collect_busted_hand
76
- self.payed = true
76
+ self.paid = true
77
77
  self.status = :lost
78
78
  blackjack.money -= bet
79
79
  end
@@ -23,7 +23,7 @@ class Shoe
23
23
  end
24
24
 
25
25
  def needs_to_shuffle?
26
- return true if cards.size.zero?
26
+ return true if cards.empty?
27
27
 
28
28
  cards_dealt = total_cards - cards.size
29
29
  used = cards_dealt / total_cards.to_f * 100.0
@@ -38,8 +38,8 @@ class Shoe
38
38
  def new_regular
39
39
  self.cards = []
40
40
  num_decks.times do
41
- (0..3).each do |suit_value|
42
- (0..12).each do |value|
41
+ 4.times do |suit_value|
42
+ 13.times do |value|
43
43
  cards << Card.new(blackjack, value, suit_value)
44
44
  end
45
45
  end
@@ -50,7 +50,7 @@ class Shoe
50
50
  def new_irregular(values = [])
51
51
  self.cards = []
52
52
  while cards.count < total_cards
53
- (0..3).each do |suit_value|
53
+ 4.times do |suit_value|
54
54
  next if cards.count >= total_cards
55
55
 
56
56
  values.each do |value|
data/lib/blackjack.rb CHANGED
@@ -162,7 +162,7 @@ class Blackjack
162
162
  player_hand = current_player_hand
163
163
  player_hand.bet /= 2
164
164
  player_hand.played = true
165
- player_hand.payed = true
165
+ player_hand.paid = true
166
166
  player_hand.status = :lost
167
167
 
168
168
  self.money -= player_hand.bet
@@ -24,8 +24,8 @@ RSpec.describe PlayerHand do
24
24
  expect(player_hand.status).to eq(:unknown)
25
25
  end
26
26
 
27
- it 'has not been payed' do
28
- expect(player_hand.payed).to be_falsey
27
+ it 'has not been paid' do
28
+ expect(player_hand.paid).to be_falsey
29
29
  end
30
30
  end
31
31
 
@@ -550,8 +550,8 @@ RSpec.describe PlayerHand do
550
550
  end
551
551
 
552
552
  describe '#pay' do
553
- it 'returns if already payed' do
554
- player_hand.payed = true
553
+ it 'returns if already paid' do
554
+ player_hand.paid = true
555
555
  allow(player_hand).to receive(:value)
556
556
  player_hand.pay(18, false)
557
557
  expect(player_hand).to_not have_received(:value)
@@ -565,10 +565,10 @@ RSpec.describe PlayerHand do
565
565
  end
566
566
 
567
567
  context 'when dealer is not busted' do
568
- it 'hand is set to payed' do
568
+ it 'hand is set to paid' do
569
569
  player_hand.cards << ten << ten
570
570
  player_hand.pay(18, false)
571
- expect(player_hand.payed).to be_truthy
571
+ expect(player_hand.paid).to be_truthy
572
572
  end
573
573
 
574
574
  it 'hand status is won' do
@@ -48,16 +48,14 @@ RSpec.describe Blackjack do
48
48
 
49
49
  context 'when busted' do
50
50
  it 'returns false' do
51
- allow(player_hand).to receive(:blackjack?).and_return(false)
52
- allow(player_hand).to receive(:busted?).and_return(true)
51
+ allow(player_hand).to receive_messages(blackjack?: false, busted?: true)
53
52
  expect(blackjack).to_not be_need_to_play_dealer_hand
54
53
  end
55
54
  end
56
55
 
57
56
  context 'when blackjack' do
58
57
  it 'returns false' do
59
- allow(player_hand).to receive(:busted?).and_return(false)
60
- allow(player_hand).to receive(:blackjack?).and_return(true)
58
+ allow(player_hand).to receive_messages(busted?: false, blackjack?: true)
61
59
  expect(blackjack).to_not be_need_to_play_dealer_hand
62
60
  end
63
61
  end
@@ -811,9 +809,9 @@ RSpec.describe Blackjack do
811
809
  expect(player_hand.played).to be_truthy
812
810
  end
813
811
 
814
- it 'sets hand as payed' do
812
+ it 'sets hand as paid' do
815
813
  blackjack.insure_hand
816
- expect(player_hand.payed).to be_truthy
814
+ expect(player_hand.paid).to be_truthy
817
815
  end
818
816
 
819
817
  it 'sets hand status as :lost' do
@@ -5,7 +5,7 @@ FactoryBot.define do
5
5
  game { nil }
6
6
  bet { 500 }
7
7
  status { :unknown }
8
- payed { false }
8
+ paid { false }
9
9
  stood { false }
10
10
 
11
11
  initialize_with { new(game, bet) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: console-blackjack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Donald
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-11 00:00:00.000000000 Z
11
+ date: 2023-12-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Blackjack for your console, full version.
14
14
  email: gdonald@gmail.com
@@ -24,8 +24,7 @@ files:
24
24
  - Rakefile
25
25
  - bin/console-blackjack
26
26
  - bj.txt
27
- - console-blackjack-1.1.0.gem
28
- - console-blackjack-1.1.1.gem
27
+ - console-blackjack-1.1.3.gem
29
28
  - console-blackjack.gemspec
30
29
  - lib/blackjack.rb
31
30
  - lib/blackjack/card.rb
@@ -39,19 +38,19 @@ files:
39
38
  - lib/blackjack/shoe.rb
40
39
  - lib/blackjack/split_hand.rb
41
40
  - lib/blackjack/utils.rb
41
+ - spec/blackjack/card_spec.rb
42
+ - spec/blackjack/dealer_hand_spec.rb
43
+ - spec/blackjack/format_spec.rb
44
+ - spec/blackjack/hand_spec.rb
45
+ - spec/blackjack/player_hand_spec.rb
46
+ - spec/blackjack/shoe_spec.rb
47
+ - spec/blackjack_spec.rb
42
48
  - spec/factories/blackjack_factory.rb
43
49
  - spec/factories/card_factory.rb
44
50
  - spec/factories/dealer_hand_factory.rb
45
51
  - spec/factories/hand_factory.rb
46
52
  - spec/factories/player_hand_factory.rb
47
53
  - spec/factories/shoe_factory.rb
48
- - spec/lib/blackjack/card_spec.rb
49
- - spec/lib/blackjack/dealer_hand_spec.rb
50
- - spec/lib/blackjack/format_spec.rb
51
- - spec/lib/blackjack/hand_spec.rb
52
- - spec/lib/blackjack/player_hand_spec.rb
53
- - spec/lib/blackjack/shoe_spec.rb
54
- - spec/lib/blackjack_spec.rb
55
54
  - spec/spec_helper.rb
56
55
  - ss1.png
57
56
  - ss2.png
@@ -79,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
78
  - !ruby/object:Gem::Version
80
79
  version: '0'
81
80
  requirements: []
82
- rubygems_version: 3.4.7
81
+ rubygems_version: 3.4.22
83
82
  signing_key:
84
83
  specification_version: 4
85
84
  summary: Console Blackjack
Binary file
Binary file
File without changes
File without changes
File without changes
File without changes