rpsg 0.4.1 → 0.4.2

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 (68) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/doc/created.rid +2 -2
  4. data/doc/js/navigation.js.gz +0 -0
  5. data/doc/js/search_index.js.gz +0 -0
  6. data/doc/js/searcher.js.gz +0 -0
  7. data/lib/rpsg/version.rb +1 -1
  8. data/rpsg.gemspec +2 -3
  9. metadata +2 -62
  10. data/docs/Gemfile +0 -6
  11. data/docs/LICENSE +0 -116
  12. data/docs/_config.yml +0 -73
  13. data/docs/_includes/footer.html +0 -20
  14. data/docs/_includes/header.html +0 -19
  15. data/docs/_layouts/default.html +0 -50
  16. data/docs/_pages/README.txt +0 -47
  17. data/docs/_pages/bundler.txt +0 -26
  18. data/docs/_pages/code.txt +0 -178
  19. data/docs/_pages/index.txt +0 -16
  20. data/docs/_pages/install.txt +0 -110
  21. data/docs/_pages/simple.txt +0 -45
  22. data/docs/_pages/test.md +0 -40
  23. data/docs/_pages/uninstall.txt +0 -19
  24. data/docs/_pages/update.txt +0 -19
  25. data/docs/_sass/jekyll-theme-cayman.scss +0 -346
  26. data/docs/_sass/normalize.scss +0 -424
  27. data/docs/_sass/pace.sass +0 -278
  28. data/docs/_sass/rouge-github.scss +0 -209
  29. data/docs/_sass/variables.scss +0 -23
  30. data/docs/_site/assets/css/style.css +0 -1
  31. data/docs/_site/assets/favicons/android-chrome-192x192.png +0 -0
  32. data/docs/_site/assets/favicons/android-chrome-256x256.png +0 -0
  33. data/docs/_site/assets/favicons/apple-touch-icon.png +0 -0
  34. data/docs/_site/assets/favicons/browserconfig.xml +0 -9
  35. data/docs/_site/assets/favicons/favicon-16x16.png +0 -0
  36. data/docs/_site/assets/favicons/favicon-32x32.png +0 -0
  37. data/docs/_site/assets/favicons/favicon.ico +0 -0
  38. data/docs/_site/assets/favicons/manifest.json +0 -18
  39. data/docs/_site/assets/favicons/mstile-150x150.png +0 -0
  40. data/docs/_site/assets/favicons/safari-pinned-tab.svg +0 -17
  41. data/docs/_site/assets/js/pace.min.js +0 -2
  42. data/docs/_site/bundler.html +0 -108
  43. data/docs/_site/code.html +0 -244
  44. data/docs/_site/index.html +0 -83
  45. data/docs/_site/install.html +0 -244
  46. data/docs/_site/readme.html +0 -132
  47. data/docs/_site/simple.html +0 -111
  48. data/docs/_site/test.html +0 -99
  49. data/docs/_site/uninstall.html +0 -92
  50. data/docs/_site/update.html +0 -92
  51. data/docs/assets/css/style.scss +0 -4
  52. data/docs/assets/favicons/android-chrome-192x192.png +0 -0
  53. data/docs/assets/favicons/android-chrome-256x256.png +0 -0
  54. data/docs/assets/favicons/apple-touch-icon.png +0 -0
  55. data/docs/assets/favicons/browserconfig.xml +0 -9
  56. data/docs/assets/favicons/favicon-16x16.png +0 -0
  57. data/docs/assets/favicons/favicon-32x32.png +0 -0
  58. data/docs/assets/favicons/favicon.ico +0 -0
  59. data/docs/assets/favicons/manifest.json +0 -18
  60. data/docs/assets/favicons/mstile-150x150.png +0 -0
  61. data/docs/assets/favicons/safari-pinned-tab.svg +0 -17
  62. data/docs/assets/js/pace.min.js +0 -2
  63. data/docs/jekyll-theme-cayman.gemspec +0 -18
  64. data/docs/script/bootstrap +0 -6
  65. data/docs/script/cibuild +0 -6
  66. data/docs/script/release +0 -42
  67. data/docs/script/server +0 -3
  68. data/docs/thumbnail.png +0 -0
@@ -1,26 +0,0 @@
1
- ---
2
- layout: default
3
- title: "Using Bundler - RPSG"
4
- permalink: /bundler.html
5
- ---
6
-
7
- # Utilizing Bundler
8
-
9
- * auto-gen TOC:
10
- {:toc}
11
-
12
- > Bundler is an easy and efficient way to get all the correct gem versions installed for `RPSG`
13
-
14
- ## Windows/Mac (OSX)
15
-
16
- ### Using Bundle Install
17
-
18
- 1. Open `Command Prompt`/`Terminal` depending on OS
19
- 2. `cd` to the directory of the `Gemfile` in the `RPSG` repository folder
20
- * do download the `RPSG` repo folder, go [here](https://github.com/bag3318/RPSG){: target="_blank"} and click `Download` then `Download ZIP`
21
- 3. type `bundle install` and hit <kbd>Enter</kbd>/<kbd>Return</kbd> (depending on OS)
22
-
23
- ### Using Bundle Update
24
-
25
- 1. `cd` to the directory of the `Gemfile` in the `RPSG` repository folder
26
- 2. type `bundle update` and hit <kbd>Enter</kbd>/<kbd>Return</kbd> (depending on OS)
@@ -1,178 +0,0 @@
1
- ---
2
- layout: default
3
- permalink: /code.html
4
- title: "Complete Code - RPSG"
5
- ---
6
-
7
- {::comment}
8
- contains complete RPSG code
9
- {:/comment}
10
-
11
- # Complete Code
12
-
13
- * auto-gen TOC:
14
- {:toc}
15
-
16
- > The complete code will look like this:
17
-
18
- ```
19
- % rpsg
20
- ```
21
-
22
- ~~~ruby
23
- #!/usr/bin/env ruby
24
-
25
- =begin
26
- |====================================|
27
- | Req Ruby Ver | Req Ruby Gems Ver |
28
- |--------------|---------------------|
29
- | >= v2.0.0 | >= v2.6.0 |
30
- |====================================|
31
- =end
32
-
33
- # create master class for rpsg
34
- class RockPaperScissorsGame
35
-
36
- # specify the version for the rubygem
37
- module RPSG
38
- # create version constant for the rubygem
39
- VERSION = "0.4.1"
40
- end
41
-
42
- # create module that holds all contents for this script
43
- module ProtectedConstants
44
-
45
- # create 2d list of choices
46
- protected
47
- CHOICES = [['r', 'rock'], ['p', 'paper'], ['s', 'scissors']]
48
-
49
- # define entry to symbol (key to value) dictionary
50
- protected
51
- NTRY_TO_SYM = {
52
- CHOICES[0][0] => :ROCK , CHOICES[0][1] => :ROCK ,
53
- CHOICES[1][0] => :PAPER , CHOICES[1][1] => :PAPER ,
54
- CHOICES[2][0] => :SCISSORS, CHOICES[2][1] => :SCISSORS
55
- }
56
-
57
- # define valid entries
58
- protected
59
- VALID_ENTRIES = NTRY_TO_SYM.keys
60
-
61
- # define computer choices
62
- protected
63
- COMPUTER_CHOICES = NTRY_TO_SYM.values
64
-
65
- # create winners 2d list array with format: winning choice, losing choice
66
- protected # make protected
67
- WINNERS = [
68
- [:SCISSORS, :PAPER ],
69
- [:PAPER , :ROCK ],
70
- [:ROCK , :SCISSORS]
71
- ]
72
-
73
- # this will take the original WINNERS array and flip the symbols, thus returning a loss for the user/player
74
- protected
75
- LOSERS = WINNERS.map { |winning_choice,losing_choice| [losing_choice,winning_choice] }
76
-
77
- end
78
-
79
- # protected_methods :ProtectedConstants
80
-
81
- class << self
82
- # add continue method for asking the user if they want to play rock paper scissors
83
- def continue(str1,str2,str3)
84
- puts str1
85
- print str2
86
- gets
87
- puts str3
88
- end
89
- end
90
-
91
- # print out strings
92
- continue("\nYou are about to enter a rock-paper-scissors best of 3 match.", "\nPress the return/enter key to continue...", "")
93
-
94
- # initialize variables
95
- def initialize
96
- # initialize variables and set all equal to zero
97
- @player_score = @computer_score = @ties = 0
98
- end
99
-
100
- # define play method, this will be the main function for playing rock paper scissors
101
- def play(winning_score)
102
- # make while loop
103
- while @player_score < winning_score && @computer_score < winning_score
104
- puts "\nPlayer score: #{@player_score}, " +
105
- "Computer score: #{@computer_score}, Ties: #{@ties}.\n"
106
- player = PrivateMethods.player_choice
107
- computer = ProtectedConstants::COMPUTER_CHOICES.sample # chooses a random option
108
- puts "\nPlayer chooses #{player.to_s.downcase}."
109
- puts "Computer chooses #{computer.to_s.downcase}.\n"
110
- case PrivateMethods.player_outcome [player, computer]
111
- when :WIN
112
- puts "\n#{player.to_s.capitalize} beats #{computer.to_s.downcase}, player wins the round.\n"
113
- @player_score += 1
114
- when :LOSE
115
- puts "\n#{computer.to_s.capitalize} beats #{player.to_s.downcase}, computer wins the round.\n"
116
- @computer_score += 1
117
- else
118
- puts "\nTie, choose again\n"
119
- @ties += 1
120
- end
121
- end
122
- puts "\nFinal score: player: #{@player_score}, " +
123
- "computer: #{@computer_score} (ties: #{@ties}).\n"
124
- case PrivateMethods.final_outcome(@player_score, @computer_score)
125
- when :WIN
126
- puts "\nPlayer wins!\n"
127
- when :LOSE
128
- puts "\nComputer wins!\n"
129
- else
130
- puts "\nIt's a tie!\n"
131
- end
132
- print "\n[press the enter/return key to exit game]"
133
- gets
134
- end
135
-
136
- private # make private
137
- # add module for private methods for the rpsg calculations
138
- module PrivateMethods
139
- class << self
140
- # make a definition that asks for the players choice
141
- def player_choice
142
- loop do
143
- print "\nChoose: Rock (r), Paper (p), or Scissors (s): "
144
- choice = gets.chomp.downcase
145
- if ProtectedConstants::NTRY_TO_SYM.key?(choice)
146
- return ProtectedConstants::NTRY_TO_SYM[choice]
147
- elsif choice != ProtectedConstants::VALID_ENTRIES
148
- puts "\nThat entry is invalid. Please re-enter.\n"
149
- else
150
- return nil
151
- end
152
- end
153
- end
154
- # define outcomes of players choice against cpu
155
- def player_outcome(plays)
156
- return :WIN if ProtectedConstants::WINNERS.include?(plays)
157
- return :LOSE if ProtectedConstants::LOSERS.include?(plays)
158
- return :TIE if !:WIN | !:LOSE
159
- end
160
- # define final outcome that gives the result of who one the whole match
161
- def final_outcome(pl, co)
162
- return :WIN if pl > co
163
- return :LOSE if pl < co
164
- # return :TIE if pl = co
165
- # there will never be a tie for the final outcome due to the code in the `play()` method
166
- end
167
- end
168
- end
169
- public # make public again
170
-
171
- # private_methods :PrivateMethods
172
-
173
- end
174
-
175
- RockPaperScissorsGame.new.play(2) # best out of 3
176
-
177
- $end
178
- ~~~
@@ -1,16 +0,0 @@
1
- ---
2
- layout: default
3
- title: "Rock Paper Scissors Game - RPSG"
4
- permalink: /index.html
5
- ---
6
-
7
- # Rock Paper Scissors Game
8
-
9
- * auto-gen TOC:
10
- {:toc}
11
-
12
- > Welcome to my **RPSG** home site. I created my `RPSG` gem with __Ruby__, the programming language. {::comment}<br/>{:/comment}
13
-
14
- > _**Please Enjoy! :)**_{: style="text-decoration: underline;"}
15
-
16
-
@@ -1,110 +0,0 @@
1
- ---
2
- layout: default
3
- title: "How to Install - RPSG"
4
- permalink: /install.html
5
- ---
6
-
7
- # Install Guide
8
-
9
- * auto-gen TOC:
10
- {:toc}
11
-
12
- > This guide will tell you how to install everything that is needed for using my **`RPSG`** gem.
13
-
14
- ## For Mac/OSX
15
-
16
- __What you will install:__
17
-
18
- 1. Ruby
19
- 2. RubyGems
20
- 3. Homebrew
21
- 4. RVM
22
- 5. XCode Command Line Tools
23
- 6. RPSG (my RubyGem)
24
-
25
- ### Useful Skills:
26
-
27
- #### To open the Terminal
28
-
29
- 1. Press <kbd>Command</kbd> + <kbd>Space</kbd>
30
- 2. Type in `Terminal`
31
- 3. Press <kbd>Return</kbd>
32
-
33
- #### To Copy
34
-
35
- 1. Press <kbd>Command</kbd> + <kbd>C</kbd>
36
-
37
- #### To Paste
38
-
39
- 1. Press <kbd>Command</kbd> + <kbd>V</kbd>
40
-
41
- ### Step 1 - Installing XCode Command Line Tools
42
-
43
- 1. Open `Terminal` and copy/paste this: `sudo xcode-select --install` and hit <kbd>Return</kbd>
44
- 2. You might need to enter your password a few times
45
-
46
- ### Step 2 - Installing Homebrew
47
-
48
- 1. In the `Terminal`, copy/paste this: `/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"`, and hit <kbd>Return</kbd>
49
- 2. You might need to enter your password
50
-
51
- ### Step 3 - Installing RVM/Ruby/RubyGems
52
-
53
- 1. In the `Terminal`, copy/paste this: `\curl -sSL https://get.rvm.io | bash -s stable --ruby` and hit <kbd>Return</kbd>
54
- 2. You might need to enter your password
55
-
56
- ### Step 4 - Installing RPSG
57
-
58
- 1. Close `Terminal` by pressing <kbd>Command</kbd> + <kbd>Q</kbd>
59
- 2. Open `Terminal` again
60
- 3. Type in the following: `gem install rpsg`, then hit <kbd>Return</kbd>
61
-
62
- ### Step 5 - Running RPSG
63
-
64
- 1. Whenever you want to play Rock Paper Scissors, just open `Terminal` and type in: `rpsg`, then hit <kbd>Return</kbd>
65
-
66
- ## For Windows
67
-
68
- __What you will install:__
69
-
70
- 1. Ruby
71
- 2. RubyGems
72
- 3. RPSG (my RubyGem)
73
-
74
- ### Useful Skills
75
-
76
- #### Opening the Command Prompt
77
-
78
- 1. Press <kbd>Windows</kbd> + <kbd>R</kbd>
79
- 2. Type in `cmd`
80
- 3. Press <kbd>Enter</kbd>
81
-
82
- #### To Copy
83
-
84
- 1. Press <kbd>Control</kbd> + <kbd>C</kbd>
85
-
86
- #### To Paste
87
-
88
- 1. Press <kbd>Control</kbd> + <kbd>V</kbd>
89
-
90
- ### Step 1 - Downloading Ruby Installer
91
-
92
- 1. Open a Web Browser
93
- * Web Browser ex: Chrome, Firefox, IE, Safari, Edge, Opera, etc...
94
- 2. Copy/paste this into the browser's URL bar `https://rubyinstaller.org/downloads/`
95
- 3. Press <kbd>Enter</kbd>
96
- 4. Download the appropriate installer
97
-
98
- ### Step 2 - Installing Ruby & RubyGems
99
-
100
- 1. Open the `rubyinstaller.exe` (may be named differently for you)
101
- 2. Proceed with the installation
102
-
103
- ### Step 3 - Installing RPSG
104
-
105
- 1. Open the `Command Prompt`
106
- 2. Type in the following: `gem install rpsg`
107
-
108
- ### Step 4 - Running RPSG
109
-
110
- 1. Any time you would like to play rock paper scissors, just open the `Command Prompt` and type in: `rpsg` and hit <kbd>enter</kbd>
@@ -1,45 +0,0 @@
1
- ---
2
- layout: default
3
- title: "Simple Code - RPSG"
4
- permalink: /simple.html
5
- ---
6
-
7
- # Simple/Beginners RPS Code
8
-
9
- * auto-gen TOC:
10
- {:toc}
11
-
12
- > This is what a beginner's RPS code might look like
13
-
14
- {% highlight ruby %}
15
- options = ["rock", "paper", "scissors"]
16
- computer_choice = options[rand(options.length)]
17
- puts "What's your choice?"
18
- puts "rock, paper, or scissors"
19
- user_input = gets.chomp.downcase # read user input and convert to lower case
20
- loop do
21
- if (user_input == "rock" || user_input == "paper" || user_input == "scissors")
22
- if (user_input == computer_choice)
23
- puts "We got the same, let's keep playing!"
24
- elsif (user_input == "rock" && computer_choice == "scissors")
25
- puts "computer choice is: " + computer_choice + ", you win! :)"
26
- elsif (user_input == "rock" && computer_choice == "paper")
27
- puts "computer choice is: " + computer_choice + ", computer wins :("
28
- elsif (user_input == "paper" && computer_choice == "scissors")
29
- puts "computer choice is: " + computer_choice + ", computer wins :("
30
- elsif (user_input == "paper" && computer_choice == "rock")
31
- puts "computer choice is: " + computer_choice + ", you win! :)"
32
- elsif (user_input == "scissors" && computer_choice == "rock")
33
- puts "computer choice is: " + computer_choice + ", computer wins :("
34
- elsif (user_input == "scissors" && computer_choice == "paper")
35
- puts "computer choice is: " + computer_choice + ", you win! :)"
36
- end
37
- else
38
- puts "Invalid choice, enter Rock, Paper, or Scissors"
39
- end
40
- break
41
- end
42
-
43
- $end
44
- {% endhighlight %}
45
-
@@ -1,40 +0,0 @@
1
- ---
2
- layout: default
3
- title: "Tests for learning"
4
- permalink: /test.html
5
- ---
6
-
7
- # Comments
8
-
9
- * auto-gen TOC:
10
- {:toc}
11
-
12
- ## Markdown
13
-
14
- [//]: # (comment)
15
- [//]: # "comment"
16
-
17
- ### wrong ways
18
-
19
- [//]: <> (this is not a markdown comment)
20
- [//]: <> "this is not a markdown comment"
21
- [comment]: # (this is not a markdown comment)
22
- [comment]: # "this is not a markdown comment"
23
- [comment]: <> (this is not a markdown comment)
24
- [comment]: <> "this is not a markdown comment"
25
-
26
- ## Kramdown
27
-
28
- {::comment}
29
- comment
30
- {:/comment}
31
-
32
- ## Liquid
33
-
34
- {% comment %}
35
- comment
36
- {% endcomment %}
37
-
38
- ## HTML
39
-
40
- <!-- comment -->
@@ -1,19 +0,0 @@
1
- ---
2
- layout: default
3
- title: "How to Uninstall - RPSG"
4
- permalink: /uninstall.html
5
- ---
6
-
7
- # How to Uninstall
8
-
9
- * auto-gen TOC:
10
- {:toc}
11
-
12
- > This guide will show you how to quickly uninstall `RPSG`
13
-
14
- ## Mac (OSX)/Windows
15
-
16
- 1. Open `Command Prompt`/`Terminal` (depending on OS)
17
- 2. Type in `gem uninstall rpsg`
18
- 3. Hit <kbd>Enter</kbd>/<kbd>Return</kbd> (depending on OS)
19
- 4. Confirm Uninstallation
@@ -1,19 +0,0 @@
1
- ---
2
- layout: default
3
- title: "How to Update - RPSG"
4
- permalink: /update.html
5
- ---
6
-
7
- # Update Guide
8
-
9
- * auto-gen TOC:
10
- {:toc}
11
-
12
- > This guide will show you how to easily update RPSG.
13
-
14
- ## Mac (OSX)/Windows
15
-
16
- 1. Open `Terminal`/`Command Prompt` (depending on OS)
17
- 2. Type in the following: `gem update rpsg`
18
- 3. Hit <kbd>Enter</kbd>/<kbd>Return</kbd> (depending on OS)
19
-