bestgemever 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/Gemfile +4 -0
- data/README.md +41 -0
- data/Rakefile +2 -0
- data/bestgemever.gemspec +31 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/bestgemever/rockpaperscissors.rb +79 -0
- data/lib/bestgemever/version.rb +3 -0
- data/lib/bestgemever.rb +6 -0
- metadata +83 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 25615e56e843c342878bf72ccd9dc348e57420d1
|
4
|
+
data.tar.gz: a2cd28abac31d25fa1921357da05c72f1c23132c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5e986f6734df11ea3086350ac3e348fe16e518c139c30dfef443729e2d0ef8bcd079561a6a16e2272e8c4d82e4b589c99118e28466cadece44024976253e2bf3
|
7
|
+
data.tar.gz: 106f6e0235003d2b088dc6b6b980eb9942ea5d9074c30e6deb065cf4e143659f9ccf5f3d657cae9593ec9b325d766233b600224c8440529b8f7d95799be52974
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
# Bestgemever
|
3
|
+
|
4
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/bestgemever`. To experiment with that code, run `bin/console` for an interactive prompt.
|
5
|
+
|
6
|
+
TODO: Delete this and the text above, and describe your gem
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'bestgemever'
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install bestgemever
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
TODO: Write usage instructions here
|
27
|
+
|
28
|
+
## Development
|
29
|
+
|
30
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
31
|
+
|
32
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
33
|
+
|
34
|
+
## Contributing
|
35
|
+
|
36
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bestgemever.
|
37
|
+
|
38
|
+
Thomas Lo
|
39
|
+
Ellen Sun
|
40
|
+
|
41
|
+
============
|
data/Rakefile
ADDED
data/bestgemever.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'bestgemever/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "bestgemever"
|
8
|
+
spec.version = Bestgemever::VERSION
|
9
|
+
spec.authors = ["Thomas Lo", "Ellen Sun"]
|
10
|
+
spec.email = ["wagaiznogoud@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{A simple Rock Paper Scissors game.}
|
13
|
+
spec.description = %q{Single or Multiplayer RPS game.}
|
14
|
+
spec.homepage = "https://github.com/thomasjinlo/bestgemever.git"
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
17
|
+
# delete this section to allow pushing this gem to any host.
|
18
|
+
if spec.respond_to?(:metadata)
|
19
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
20
|
+
else
|
21
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
22
|
+
end
|
23
|
+
|
24
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
spec.bindir = "exe"
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
|
29
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
30
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
31
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "bestgemever"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
module Bestgemever
|
2
|
+
|
3
|
+
class RockPaperScissors
|
4
|
+
|
5
|
+
|
6
|
+
OPTIONS = ["rock", "paper", "scissors"]
|
7
|
+
|
8
|
+
|
9
|
+
def play_game
|
10
|
+
start
|
11
|
+
type = game_type
|
12
|
+
if type == 'c'
|
13
|
+
player_input
|
14
|
+
computer_input
|
15
|
+
match(@player, @computer)
|
16
|
+
else
|
17
|
+
player1 = player_input
|
18
|
+
player2 = player_input
|
19
|
+
match(player1, player2)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
def start
|
25
|
+
puts "Welcome to Rock, Paper, Scissors!"
|
26
|
+
puts "Rock beats Scissors, Scissors beats Paper, and Paper beats Rock"
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
def game_type
|
31
|
+
puts "Do you want to play against the computer(c) or another player(p)?"
|
32
|
+
type = gets.chomp
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
def player_input
|
37
|
+
puts "What is your choice?"
|
38
|
+
@player = gets.chomp
|
39
|
+
|
40
|
+
until OPTIONS.include? @player
|
41
|
+
puts "Please enter one of the following: rock, paper, scissors"
|
42
|
+
@player = gets.chomp
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
def computer_input
|
48
|
+
@computer = ["rock", "paper", "scissors"].sample
|
49
|
+
puts "Computer: #{@computer}"
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
def match(player, computer)
|
55
|
+
if player == computer
|
56
|
+
puts "It's a tie"
|
57
|
+
elsif player == "rock"
|
58
|
+
if computer == "scissors"
|
59
|
+
puts "Rock beats Scissors!"
|
60
|
+
else
|
61
|
+
puts "Paper beats Rock!"
|
62
|
+
end
|
63
|
+
elsif player == "scissors"
|
64
|
+
if computer == "rock"
|
65
|
+
puts "Rock beats Scissors!"
|
66
|
+
else
|
67
|
+
puts "Scissors beats Paper!"
|
68
|
+
end
|
69
|
+
elsif player == "paper"
|
70
|
+
if computer == "rock"
|
71
|
+
puts "Paper beats Rock!"
|
72
|
+
else
|
73
|
+
puts "Scissors beats Paper!"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
data/lib/bestgemever.rb
ADDED
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bestgemever
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Thomas Lo
|
8
|
+
- Ellen Sun
|
9
|
+
autorequire:
|
10
|
+
bindir: exe
|
11
|
+
cert_chain: []
|
12
|
+
date: 2016-01-06 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.11'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '1.11'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rake
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '10.0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '10.0'
|
42
|
+
description: Single or Multiplayer RPS game.
|
43
|
+
email:
|
44
|
+
- wagaiznogoud@gmail.com
|
45
|
+
executables: []
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- Gemfile
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- bestgemever.gemspec
|
54
|
+
- bin/console
|
55
|
+
- bin/setup
|
56
|
+
- lib/bestgemever.rb
|
57
|
+
- lib/bestgemever/rockpaperscissors.rb
|
58
|
+
- lib/bestgemever/version.rb
|
59
|
+
homepage: https://github.com/thomasjinlo/bestgemever.git
|
60
|
+
licenses: []
|
61
|
+
metadata:
|
62
|
+
allowed_push_host: https://rubygems.org
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
requirements: []
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.4.8
|
80
|
+
signing_key:
|
81
|
+
specification_version: 4
|
82
|
+
summary: A simple Rock Paper Scissors game.
|
83
|
+
test_files: []
|