99_game 1.0.3.pre → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/99_game +7 -5
  3. data/lib/99_game.rb +9 -6
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 30ae4069e621a9c88f1863df08986026ee921183
4
- data.tar.gz: 914762fed37089ec68abc59d33f661aaa7578f20
3
+ metadata.gz: 6fa8a98e8c91329f233727d87ce7408047aa281e
4
+ data.tar.gz: dd2700c65e5cdeff1d392bfe57ac8c595f4409d0
5
5
  SHA512:
6
- metadata.gz: f51081a2ed2bfea6ee3d7d62fac9dad72b0942ac4fff7fc13a6b69c8c456cb24bf126d8ef75ed59b3b1827d86d638979dc3e2d20c8226bc62b20698e26252beb
7
- data.tar.gz: bb39a9eb7a453e27edfd96017482e90442018bda95991493bff704aad8dfd684ec79cdd6c207d84838a063720123a702b496b4835962fdaa11b5ad897f0caa2c
6
+ metadata.gz: a08fb3a9561db47a8f95a63857c9a47f5bcffb0f0d9b93814b5fc0a670051069f81b8e5cd05c95c9a8c5a91639cf7d4073e57512968a55efa55c3183d0f9a950
7
+ data.tar.gz: d4a4943ed9d9316b1687f883869b8dabbb62b7787dce0e0578639df74ff97681ff377228258743fc369eb9f80af9dc64d5c034fe4de358fe0cc5e008804f9085
@@ -39,10 +39,6 @@ END { # Thanks for playing
39
39
  puts "\n\tThanks for playing 99!"
40
40
  sleep(3)
41
41
  }
42
- def pause(p)
43
- sleep(p)
44
- puts
45
- end
46
42
  $value, value1, value2, value3, dealer, user = 0,0,0,0, Hand.new, Hand.new
47
43
  loop do
48
44
  $deck.shuffle!
@@ -89,7 +85,13 @@ loop do
89
85
  user.view
90
86
  pause(0.5)
91
87
  print "\tPick a card to play by typing in the name of the card => "
92
- user.play(UserCard.new(gets.chomp))
88
+ input, turn = gets.chomp, true
89
+ for card in user.hand
90
+ if card.num == converter(input) && turn
91
+ user.play(card)
92
+ turn = false
93
+ end
94
+ end
93
95
  pause(1.5)
94
96
  puts "\tYou drew a(n) #{user.hand[2].num}"
95
97
  pause(0.5)
@@ -1,3 +1,12 @@
1
+ def pause(p)
2
+ sleep(p)
3
+ puts
4
+ end
5
+ def converter(input)
6
+ if input == input.capitalize; return input.to_i
7
+ else; return input.capitalize
8
+ end
9
+ end
1
10
  class CardError < Exception; end
2
11
  class Card # Represents a card in the deck
3
12
  attr_reader :num
@@ -22,12 +31,6 @@ class Card # Represents a card in the deck
22
31
  end
23
32
  def initialize(card); @num = card; end
24
33
  end
25
- class UserCard < Card # This class converts user input into a Card-like object
26
- attr_reader :num
27
- @@num = {King: "King", K: "King", Ace: "Ace", A: "Ace", Queen: "Queen", Q: "Queen", Jack: "Jack", J: "Jack", Joker: "Joker", "$".to_sym => "Joker"}
28
- def _num; @@num; end
29
- def initialize(number=""); @@num.default, @num = number.to_i, @@num[number.capitalize.to_sym]; end
30
- end
31
34
  class Hand # Creates a object that holds and can play cards
32
35
  attr_reader :hand
33
36
  def initialize; @hand = [$deck.shift, $deck.shift, $deck.shift]; end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: 99_game
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3.pre
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zachary Perlmutter
@@ -40,9 +40,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
40
40
  version: 2.0.0
41
41
  required_rubygems_version: !ruby/object:Gem::Requirement
42
42
  requirements:
43
- - - ">"
43
+ - - ">="
44
44
  - !ruby/object:Gem::Version
45
- version: 1.3.1
45
+ version: '0'
46
46
  requirements: []
47
47
  rubyforge_project:
48
48
  rubygems_version: 2.3.0