game_codebreaker 1.0.0 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/game_codebreaker +6 -6
- data/lib/game_codebreaker.rb +7 -6
- data/lib/game_codebreaker/game.rb +6 -5
- data/lib/game_codebreaker/memory.rb +1 -1
- data/lib/game_codebreaker/version.rb +1 -1
- metadata +3 -15
- data/.gitignore +0 -14
- data/.rspec +0 -2
- data/.travis.yml +0 -4
- data/Gemfile +0 -4
- data/LICENSE.txt +0 -21
- data/README.md +0 -43
- data/Rakefile +0 -6
- data/bin/console +0 -14
- data/bin/setup +0 -7
- data/game_codebreaker.gemspec +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b92dad88c42c152b384eac9027bdea064a6ec94
|
4
|
+
data.tar.gz: 21178551d370b1932342f582d0b768f1f016a219
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa6802d63856c41f9a34c2d2a64fd9784956ac5cce66ebb40366dddf5e7823a7597f961c4b19220d4b2734f06eec7c3a4e7f9087283c7039265fcbe2dc4ea812
|
7
|
+
data.tar.gz: 349b21e9647c817b2e4984e1760cb5fc4b06ab67c2fa82167c961105a91d785de3284f18f44eed3f1226eed3dc2c936ac6e0dd3cce17431508daba530f34b733
|
data/bin/game_codebreaker
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
require "byebug"
|
3
|
+
require_relative '../lib/game_codebreaker'
|
5
4
|
|
6
5
|
module GameCodebreaker
|
7
6
|
|
@@ -15,7 +14,8 @@ module GameCodebreaker
|
|
15
14
|
level = question( mess :level )
|
16
15
|
length = question( mess :length ).to_i
|
17
16
|
length = 4 if length <= 0
|
18
|
-
game = Game.new(level: (Options.level(level))[:level], hint: (Options.level(level))[:hint],
|
17
|
+
game = Game.new(level: (Options.level(level))[:level], hint: (Options.level(level))[:hint],
|
18
|
+
length: length, level_name: level)
|
19
19
|
play( game )
|
20
20
|
end
|
21
21
|
|
@@ -43,7 +43,7 @@ module GameCodebreaker
|
|
43
43
|
def cheat( string, game )
|
44
44
|
if string == "cheat"
|
45
45
|
p game.code
|
46
|
-
play(game)
|
46
|
+
play( game )
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -51,7 +51,7 @@ module GameCodebreaker
|
|
51
51
|
if string == "get hint"
|
52
52
|
game.get_hint
|
53
53
|
p game.hints.last
|
54
|
-
play(game)
|
54
|
+
play( game )
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
@@ -87,7 +87,7 @@ module GameCodebreaker
|
|
87
87
|
print_info( memory.info(user) )
|
88
88
|
end
|
89
89
|
end
|
90
|
-
|
90
|
+
|
91
91
|
def print_info( array )
|
92
92
|
p "Name: " << array[0]
|
93
93
|
p "Surname: " << array[1]
|
data/lib/game_codebreaker.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
require_relative "game_codebreaker/version"
|
2
|
+
require_relative "game_codebreaker/user"
|
3
|
+
require_relative "game_codebreaker/options"
|
4
|
+
require_relative "game_codebreaker/memory"
|
5
|
+
require_relative "game_codebreaker/game"
|
5
6
|
|
6
|
-
|
7
|
-
|
7
|
+
module GameCodebreaker
|
8
|
+
end
|
@@ -1,20 +1,21 @@
|
|
1
|
-
|
1
|
+
require_relative "options"
|
2
2
|
|
3
3
|
module GameCodebreaker
|
4
4
|
class Game
|
5
5
|
|
6
6
|
JUST_A_MAGIC_NUMBER = 10
|
7
7
|
|
8
|
-
attr_reader :code, :length, :level, :turns, :history, :hint, :win, :hints, :game_over
|
8
|
+
attr_reader :code, :length, :level, :turns, :history, :hint, :win, :hints, :game_over, :level_name
|
9
9
|
|
10
10
|
def initialize( code: "", length: 4, level: (Options.level)[:level], turns: 0, history: [],
|
11
11
|
hint: (Options.level)[:hint], hinted: 0, win: false, game_over: false,
|
12
|
-
hints: [] )
|
12
|
+
hints: [], level_name: 'low' )
|
13
13
|
@code, @length = code, length
|
14
14
|
@level, @turns = level, turns
|
15
15
|
@history, @hint = history, hint
|
16
|
-
@hinted, @win
|
16
|
+
@hinted, @win, = hinted, win
|
17
17
|
@hints, @game_over = hints, game_over
|
18
|
+
@level_name = level_name
|
18
19
|
generate_code if @code == ""
|
19
20
|
raise ArgumentError, 'Length code must be equal to variable with name \'length\'' if @code.size != @length
|
20
21
|
end
|
@@ -25,8 +26,8 @@ module GameCodebreaker
|
|
25
26
|
human = string.split(//)
|
26
27
|
list = [@code, human.join("")]
|
27
28
|
result = process( skynet, human )
|
28
|
-
check_game( result )
|
29
29
|
@turns += 1; @history << ( list << result )
|
30
|
+
check_game( result )
|
30
31
|
end
|
31
32
|
|
32
33
|
def get_hint
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: game_codebreaker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- woodcrust
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -84,23 +84,11 @@ description: PLAY NOW!
|
|
84
84
|
email:
|
85
85
|
- roboucrop@gmail.com
|
86
86
|
executables:
|
87
|
-
- console
|
88
87
|
- game_codebreaker
|
89
|
-
- setup
|
90
88
|
extensions: []
|
91
89
|
extra_rdoc_files: []
|
92
90
|
files:
|
93
|
-
- ".gitignore"
|
94
|
-
- ".rspec"
|
95
|
-
- ".travis.yml"
|
96
|
-
- Gemfile
|
97
|
-
- LICENSE.txt
|
98
|
-
- README.md
|
99
|
-
- Rakefile
|
100
|
-
- bin/console
|
101
91
|
- bin/game_codebreaker
|
102
|
-
- bin/setup
|
103
|
-
- game_codebreaker.gemspec
|
104
92
|
- lib/game_codebreaker.rb
|
105
93
|
- lib/game_codebreaker/game.rb
|
106
94
|
- lib/game_codebreaker/memory.rb
|
@@ -120,7 +108,7 @@ metadata: {}
|
|
120
108
|
post_install_message:
|
121
109
|
rdoc_options: []
|
122
110
|
require_paths:
|
123
|
-
-
|
111
|
+
- lib
|
124
112
|
required_ruby_version: !ruby/object:Gem::Requirement
|
125
113
|
requirements:
|
126
114
|
- - ">="
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2015 TODO: Write your name
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
data/README.md
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
# GameCodebreaker for RubyGarage
|
2
|
-
|
3
|
-
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/game_codebreaker`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
|
-
|
7
|
-
## Installation
|
8
|
-
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
use in console: game_codebreaker start
|
13
|
-
|
14
|
-
gem 'game_codebreaker'
|
15
|
-
```
|
16
|
-
|
17
|
-
And then execute:
|
18
|
-
|
19
|
-
$ bundle
|
20
|
-
|
21
|
-
Or install it yourself as:
|
22
|
-
|
23
|
-
$ gem install game_codebreaker
|
24
|
-
|
25
|
-
## Usage
|
26
|
-
|
27
|
-
TODO: Write usage instructions here
|
28
|
-
|
29
|
-
## Development
|
30
|
-
|
31
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
32
|
-
|
33
|
-
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).
|
34
|
-
|
35
|
-
## Contributing
|
36
|
-
|
37
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/game_codebreaker.
|
38
|
-
|
39
|
-
|
40
|
-
## License
|
41
|
-
|
42
|
-
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
43
|
-
|
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "game_codebreaker"
|
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
DELETED
data/game_codebreaker.gemspec
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'game_codebreaker/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "game_codebreaker"
|
8
|
-
spec.version = GameCodebreaker::VERSION
|
9
|
-
spec.authors = ["woodcrust"]
|
10
|
-
spec.email = ["roboucrop@gmail.com"]
|
11
|
-
|
12
|
-
spec.summary = %q{This is game codebreaker for your terminal}
|
13
|
-
spec.description = %q{PLAY NOW!}
|
14
|
-
spec.homepage = "https://github.com/woodcrust/Codebreaker"
|
15
|
-
spec.license = "MIT"
|
16
|
-
|
17
|
-
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
-
# delete this section to allow pushing this gem to any host.
|
19
|
-
|
20
|
-
# spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
-
# # spec.files = Dir['lib/**/*']
|
22
|
-
# # spec.bindir = "exe"
|
23
|
-
# spec.bindir = "bin"
|
24
|
-
# # spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
|
-
# spec.executables = ["game_codebreaker"]
|
26
|
-
# spec.require_paths = ["lib"]
|
27
|
-
|
28
|
-
spec.files = `git ls-files`.split("\n")
|
29
|
-
spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
30
|
-
spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
31
|
-
spec.require_paths = ["./"]
|
32
|
-
|
33
|
-
spec.add_development_dependency "bundler", "~> 1.10"
|
34
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
35
|
-
spec.add_development_dependency "rspec", "~> 3.4"
|
36
|
-
spec.add_development_dependency "rspec-collection_matchers", "~> 1.1"
|
37
|
-
spec.add_development_dependency 'byebug', '~> 8.0'
|
38
|
-
end
|