PlayRockPaperScissorsGame 1.3.3 → 1.3.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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/rps.gemspec +3 -3
  3. metadata +5 -4
  4. data/exec/run.bat +0 -13
  5. data/test/test_rps.rb +0 -88
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d0fef3455fa5e3e5d2b7a783a3d6a3b83b262b82
4
- data.tar.gz: 6bf49a0aec2d7800ff643d47564da2f73702a85c
3
+ metadata.gz: d7d53bac50a9efc563e4b13dce2328cf0ad2975b
4
+ data.tar.gz: 7cf7441de5d747b2d23859dce02291aec666a578
5
5
  SHA512:
6
- metadata.gz: '03953e546ba73ed118c126a98cded227c4a094a566b7de0b4851d7acc692bf2817c6e90429d0bfdb1e4614f0444797f36adad848fc82d03d3fb3750f88da3a94'
7
- data.tar.gz: 987e41f2cee2f3c27f82c77dc0e8b73bf4dbac54564fd324ba65183a025fe20baff7dace89fa9d1b0e5e8fd1fd2c38f1e8463d5a5d7e74198f279efc5269964a
6
+ metadata.gz: 324ee550454fdadf4ae6b3c83afbf5fd0ba3ec937a89cd40f95ea1d3cdaeb62d3d2997e82839c16fe2a40d2cd542e0781a3c5434c35449246dce0c7774eefaab
7
+ data.tar.gz: 39ab9c45b3c11f297a6dcd151671c675523fa8ec5798ef720d8f4f1193f7aa44d2ce80dfa31f427a1c0edd9c0e490dfc9a34df071fdcda5f5aa40a1eed47e2a5
data/rps.gemspec CHANGED
@@ -1,14 +1,14 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "PlayRockPaperScissorsGame"
3
- spec.version = "1.3.3"
3
+ spec.version = "1.3.4"
4
4
  spec.date = "2017-03-29"
5
5
  spec.summary = "Rock Paper Scissors"
6
- spec.description = "A Ruby-programmed rock paper scissors game. "
6
+ spec.description = "A Ruby-programmed rock paper scissors game.\nTo install: gem install PlayRockPaperScissorsGame\nTo run: rps , or: PlayRockPaperScissorsGame"
7
7
  spec.author = "bag3318"
8
8
  spec.email = "" # email is disclosed for privacy reasons
9
9
  spec.platform = Gem::Platform::RUBY
10
10
  spec.require_paths = ["lib", "test", "exec", "bin"]
11
- spec.files = ["lib/rps.rb", "lib/ref/PrivateVars.rb", "lib/ref/Constants.rb", "Rakefile", "Gemfile", "test/test_rps.rb", "exec/run.bat", "exec/rps.bash", "exec/uninstall.sh", "rps.gemspec", "LICENSE"]
11
+ spec.files = ["lib/rps.rb", "lib/ref/PrivateVars.rb", "lib/ref/Constants.rb", "Rakefile", "Gemfile", "test/", "exec/", "exec/rps.bash", "exec/uninstall.sh", "rps.gemspec", "LICENSE"]
12
12
  spec.bindir = "bin"
13
13
  spec.executables << "rps"
14
14
  spec.executables << "PlayRockPaperScissorsGame"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: PlayRockPaperScissorsGame
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - bag3318
@@ -52,7 +52,10 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.11.3.9
55
- description: 'A Ruby-programmed rock paper scissors game. '
55
+ description: |-
56
+ A Ruby-programmed rock paper scissors game.
57
+ To install: gem install PlayRockPaperScissorsGame
58
+ To run: rps , or: PlayRockPaperScissorsGame
56
59
  email: ''
57
60
  executables:
58
61
  - rps
@@ -68,13 +71,11 @@ files:
68
71
  - bin/PlayRockPaperScissorsGame
69
72
  - bin/rps
70
73
  - exec/rps.bash
71
- - exec/run.bat
72
74
  - exec/uninstall.sh
73
75
  - lib/ref/Constants.rb
74
76
  - lib/ref/PrivateVars.rb
75
77
  - lib/rps.rb
76
78
  - rps.gemspec
77
- - test/test_rps.rb
78
79
  homepage: https://rubygems.org/gems/PlayRockPaperScissorsGame/
79
80
  licenses:
80
81
  - MIT
data/exec/run.bat DELETED
@@ -1,13 +0,0 @@
1
- @ECHO OFF
2
-
3
- :master
4
-
5
- :process
6
- START cmd.exe /K PlayRockPaperScissorsGame
7
- GOTO:EOF
8
-
9
- CALL:process
10
-
11
- GOTO:EOF
12
-
13
- CALL:master
data/test/test_rps.rb DELETED
@@ -1,88 +0,0 @@
1
- class Test
2
-
3
- class Rake < Test
4
-
5
- module Constants
6
- NTRY_TO_SYM = { 'p' => :PAPER, 'r' => :ROCK, 's' => :SCISSORS };
7
- VALID_ENTRIES = NTRY_TO_SYM.keys;
8
- COMPUTER_CHOICES = NTRY_TO_SYM.values;
9
- WINNERS = [[:SCISSORS, :PAPER], [:PAPER, :ROCK], [:ROCK, :SCISSORS]]; # format: player choice, computer choice
10
- LOSERS = WINNERS.map { |i,j| [j,i] }; # this will take the original WINNERS array and flip the symbols, thus returning a loss for the user/player
11
- INIT_STRINGS = ["You are about to enter a rock-paper-scissors best of 3 match.", "Press the return/enter key to continue...", ""];
12
- end;
13
-
14
- class RockPaperScissorsTest
15
- class << self
16
- def continue(str1, str2, str3)
17
- puts str1;
18
- print str2;
19
- gets;
20
- puts str3;
21
- end;
22
- end;
23
- continue(Constants::INIT_STRINGS[0], Constants::INIT_STRINGS[1], Constants::INIT_STRINGS[2]);
24
- def initialize
25
- @player_score = @computer_score = @ties = 0;
26
- end;
27
- def testPlay(winning_score)
28
- while @player_score < winning_score && @computer_score < winning_score
29
- puts "Player score: #{@player_score}, " +
30
- "Computer score: #{@computer_score}, Ties: #{@ties}";
31
- player = PrivateVars.player_choice;
32
- computer = Constants::COMPUTER_CHOICES.sample;
33
- puts "\nPlayer chooses #{player.to_s.downcase}";
34
- puts "Computer chooses #{computer.to_s.downcase}";
35
- case PrivateVars.player_outcome [player, computer]
36
- when :WIN
37
- puts "#{player.to_s.capitalize} beats #{computer.to_s.downcase}, player wins the round";
38
- @player_score += 1;
39
- when :LOSE
40
- puts "#{computer.to_s.capitalize} beats #{player.to_s.downcase}, computer wins the round";
41
- @computer_score += 1;
42
- else
43
- puts "Tie, choose again";
44
- @ties += 1;
45
- end;
46
- end;
47
- puts "\nFinal score: player: #{@player_score}, " +
48
- "computer: #{@computer_score} (ties: #{@ties})";
49
- case PrivateVars.final_outcome(@player_score, @computer_score)
50
- when :WIN
51
- puts "Player wins!";
52
- when :LOSE
53
- puts "Computer wins!";
54
- else
55
- puts "It's a tie!";
56
- end;
57
- puts "";
58
- gets;
59
- end;
60
- private
61
- module PrivateVars
62
- class << self
63
- def player_choice
64
- loop do
65
- print "Choose rock (r), paper (p) or scissors (s): ";
66
- choice = gets.chomp.downcase;
67
- return Constants::NTRY_TO_SYM[choice] if Constants::NTRY_TO_SYM.key?(choice);
68
- puts "That entry is invalid. Please re-enter";
69
- end;
70
- end;
71
- def player_outcome(plays)
72
- return :WIN if Constants::WINNERS.include?(plays);
73
- return :LOSE if Constants::LOSERS.include?(plays);
74
- return :TIE if !:WIN | !:LOSE;
75
- end;
76
- def final_outcome(pl, co)
77
- return :WIN if pl > co;
78
- return :LOSE if pl < co;
79
- return :TIE if pl = co;
80
- end;
81
- end;
82
- end;
83
- end;
84
- end;
85
- end;
86
-
87
- Test::Rake::RockPaperScissorsTest.new.testPlay(3); # best of 3
88
-