rpsg 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -7
  3. data/Rakefile +8 -0
  4. data/bin/rpsg +8 -10
  5. data/html/Constants.html +138 -0
  6. data/html/PrivateMethods.html +241 -0
  7. data/html/README_md.html +139 -0
  8. data/html/RPSG.html +112 -0
  9. data/html/RockPapaerScissorsGame.html +268 -0
  10. data/html/created.rid +7 -0
  11. data/html/css/fonts.css +167 -0
  12. data/html/css/rdoc.css +590 -0
  13. data/html/fonts/Lato-Light.ttf +0 -0
  14. data/html/fonts/Lato-LightItalic.ttf +0 -0
  15. data/html/fonts/Lato-Regular.ttf +0 -0
  16. data/html/fonts/Lato-RegularItalic.ttf +0 -0
  17. data/html/fonts/SourceCodePro-Bold.ttf +0 -0
  18. data/html/fonts/SourceCodePro-Regular.ttf +0 -0
  19. data/html/images/add.png +0 -0
  20. data/html/images/arrow_up.png +0 -0
  21. data/html/images/brick.png +0 -0
  22. data/html/images/brick_link.png +0 -0
  23. data/html/images/bug.png +0 -0
  24. data/html/images/bullet_black.png +0 -0
  25. data/html/images/bullet_toggle_minus.png +0 -0
  26. data/html/images/bullet_toggle_plus.png +0 -0
  27. data/html/images/date.png +0 -0
  28. data/html/images/delete.png +0 -0
  29. data/html/images/find.png +0 -0
  30. data/html/images/loadingAnimation.gif +0 -0
  31. data/html/images/macFFBgHack.png +0 -0
  32. data/html/images/package.png +0 -0
  33. data/html/images/page_green.png +0 -0
  34. data/html/images/page_white_text.png +0 -0
  35. data/html/images/page_white_width.png +0 -0
  36. data/html/images/plugin.png +0 -0
  37. data/html/images/ruby.png +0 -0
  38. data/html/images/tag_blue.png +0 -0
  39. data/html/images/tag_green.png +0 -0
  40. data/html/images/transparent.png +0 -0
  41. data/html/images/wrench.png +0 -0
  42. data/html/images/wrench_orange.png +0 -0
  43. data/html/images/zoom.png +0 -0
  44. data/html/index.html +96 -0
  45. data/html/js/darkfish.js +161 -0
  46. data/html/js/jquery.js +4 -0
  47. data/html/js/navigation.js +142 -0
  48. data/html/js/navigation.js.gz +0 -0
  49. data/html/js/search.js +109 -0
  50. data/html/js/search_index.js +1 -0
  51. data/html/js/search_index.js.gz +0 -0
  52. data/html/js/searcher.js +229 -0
  53. data/html/js/searcher.js.gz +0 -0
  54. data/html/table_of_contents.html +101 -0
  55. data/lib/Constants.rb +19 -11
  56. data/lib/PrivateMethods.rb +4 -0
  57. data/lib/rpsg/version.rb +3 -1
  58. data/rpsg.gemspec +1 -1
  59. data/test/rpsg.rb +1 -0
  60. metadata +51 -1
@@ -1,22 +1,30 @@
1
+ # create module that holds all contents for this script
1
2
  module Constants
2
- CHOICES = [['r', 'rock'], ['p', 'paper'], ['s', 'scissors']] # create 2d list of choices
3
- NTRY_TO_SYM = { # define entry to symbol (key to value)
3
+
4
+ # create 2d list of choices
5
+ CHOICES = [['r', 'rock'], ['p', 'paper'], ['s', 'scissors']]
6
+
7
+ # define entry to symbol (key to value)
8
+ NTRY_TO_SYM = {
4
9
  CHOICES[0][0] => :ROCK , CHOICES[0][1] => :ROCK ,
5
10
  CHOICES[1][0] => :PAPER , CHOICES[1][1] => :PAPER ,
6
11
  CHOICES[2][0] => :SCISSORS, CHOICES[2][1] => :SCISSORS
7
12
  }
8
- VALID_ENTRIES = NTRY_TO_SYM.keys # define valid entries
9
- COMPUTER_CHOICES = NTRY_TO_SYM.values # define computer choices
13
+
14
+ # define valid entries
15
+ VALID_ENTRIES = NTRY_TO_SYM.keys
16
+
17
+ # define computer choices
18
+ COMPUTER_CHOICES = NTRY_TO_SYM.values
19
+
20
+ # create winners 2d list array with format: winning choice, losing choice
10
21
  WINNERS = [
11
- # format: player choice, computer choice
12
22
  [:SCISSORS, :PAPER ],
13
23
  [:PAPER , :ROCK ],
14
24
  [:ROCK , :SCISSORS]
15
25
  ]
16
- LOSERS = WINNERS.map { |winning_choice,losing_choice| [losing_choice,winning_choice] } # this will take the original WINNERS array and flip the symbols, thus returning a loss for the user/player
17
- INIT_STRINGS = [
18
- "You are about to enter a rock-paper-scissors best of 3 match.",
19
- "Press the return/enter key to continue...",
20
- ""
21
- ]
26
+
27
+ # this will take the original WINNERS array and flip the symbols, thus returning a loss for the user/player
28
+ LOSERS = WINNERS.map { |winning_choice,losing_choice| [losing_choice,winning_choice] }
29
+
22
30
  end
@@ -1,5 +1,7 @@
1
+ # add module for private methods for the rpsg calculations
1
2
  module PrivateMethods
2
3
  class << self
4
+ # make a definition that asks for the players choice
3
5
  def player_choice
4
6
  loop do
5
7
  print "\nChoose: Rock (r), Paper (p), or Scissors (s): \n"
@@ -20,11 +22,13 @@ module PrivateMethods
20
22
  # end
21
23
  end
22
24
  end
25
+ # define outcomes of players choice against cpu
23
26
  def player_outcome(plays)
24
27
  return :WIN if Constants::WINNERS.include?(plays)
25
28
  return :LOSE if Constants::LOSERS.include?(plays)
26
29
  return :TIE if !:WIN | !:LOSE
27
30
  end
31
+ # define final outcome that gives the result of who one the whole match
28
32
  def final_outcome(pl,co)
29
33
  return :WIN if pl > co
30
34
  return :LOSE if pl < co
@@ -1,3 +1,5 @@
1
+ # specify the version for the rubygem
1
2
  module RPSG
2
- VERSION = "0.1.1"
3
+ # create version constant for the rubygem
4
+ VERSION = "0.1.2"
3
5
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "rpsg"
3
- spec.version = "0.1.1"
3
+ spec.version = "0.1.2"
4
4
  spec.date = "2017-10-12"
5
5
  spec.summary = "A Rock Paper Scissors Game Ruby Gem"
6
6
  spec.description = <<-EOF
@@ -1 +1,2 @@
1
+ # load from bin directory
1
2
  load "bin/rpsg"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rpsg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - bag3318
@@ -85,6 +85,56 @@ files:
85
85
  - README.md
86
86
  - Rakefile
87
87
  - bin/rpsg
88
+ - html/Constants.html
89
+ - html/PrivateMethods.html
90
+ - html/README_md.html
91
+ - html/RPSG.html
92
+ - html/RockPapaerScissorsGame.html
93
+ - html/created.rid
94
+ - html/css/fonts.css
95
+ - html/css/rdoc.css
96
+ - html/fonts/Lato-Light.ttf
97
+ - html/fonts/Lato-LightItalic.ttf
98
+ - html/fonts/Lato-Regular.ttf
99
+ - html/fonts/Lato-RegularItalic.ttf
100
+ - html/fonts/SourceCodePro-Bold.ttf
101
+ - html/fonts/SourceCodePro-Regular.ttf
102
+ - html/images/add.png
103
+ - html/images/arrow_up.png
104
+ - html/images/brick.png
105
+ - html/images/brick_link.png
106
+ - html/images/bug.png
107
+ - html/images/bullet_black.png
108
+ - html/images/bullet_toggle_minus.png
109
+ - html/images/bullet_toggle_plus.png
110
+ - html/images/date.png
111
+ - html/images/delete.png
112
+ - html/images/find.png
113
+ - html/images/loadingAnimation.gif
114
+ - html/images/macFFBgHack.png
115
+ - html/images/package.png
116
+ - html/images/page_green.png
117
+ - html/images/page_white_text.png
118
+ - html/images/page_white_width.png
119
+ - html/images/plugin.png
120
+ - html/images/ruby.png
121
+ - html/images/tag_blue.png
122
+ - html/images/tag_green.png
123
+ - html/images/transparent.png
124
+ - html/images/wrench.png
125
+ - html/images/wrench_orange.png
126
+ - html/images/zoom.png
127
+ - html/index.html
128
+ - html/js/darkfish.js
129
+ - html/js/jquery.js
130
+ - html/js/navigation.js
131
+ - html/js/navigation.js.gz
132
+ - html/js/search.js
133
+ - html/js/search_index.js
134
+ - html/js/search_index.js.gz
135
+ - html/js/searcher.js
136
+ - html/js/searcher.js.gz
137
+ - html/table_of_contents.html
88
138
  - lib/Constants.rb
89
139
  - lib/PrivateMethods.rb
90
140
  - lib/rpsg/version.rb