codebreaker_gapdn 0.1.5
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.
- checksums.yaml +7 -0
- data/.circleci/config.yml +72 -0
- data/.fasterer.yml +20 -0
- data/.gitignore +52 -0
- data/.rspec +3 -0
- data/.rubocop.yml +7 -0
- data/.travis.yml +7 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +70 -0
- data/README.md +1 -0
- data/Rakefile +8 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/codebreaker.gemspec +31 -0
- data/lib/codebreaker_gapdn.rb +11 -0
- data/lib/codebreaker_gapdn/game.rb +69 -0
- data/lib/codebreaker_gapdn/version.rb +5 -0
- data/lib/database/.gitignore +1 -0
- data/lib/database/data_handler.rb +16 -0
- data/lib/database/statistic.rb +59 -0
- data/lib/entities/base_class.rb +18 -0
- data/lib/entities/difficulty.rb +22 -0
- data/lib/entities/guess.rb +21 -0
- data/lib/entities/user.rb +21 -0
- data/lib/helper/validator.rb +19 -0
- metadata +164 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 17e569d90bc3bc6a0d2c60fbe04c70253626960fccde2d34ca6ca49bfe76cdc3
|
4
|
+
data.tar.gz: 7df1594eb22d1212fac874cda151bf77c4afcce819f8f0ff6550aa26ad265bec
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 84448cf2d46dd00ecbb65fbc3e58421ddf4ec282ba33857e5955aa3494206bd1743c7a8371619a03f60b842a81e34ee84847efd5c1a4f086d76eff956d66fe42
|
7
|
+
data.tar.gz: a7b37af4708aca170ae22841cadde125745ef1488800c16597888e4ddbc882a1c1fab18d9acc1819047953dbffe3863b93b7123f75e0a5fd014f594e53df7e06
|
@@ -0,0 +1,72 @@
|
|
1
|
+
version: 2.1
|
2
|
+
|
3
|
+
executors:
|
4
|
+
default:
|
5
|
+
working_directory: ~/repo
|
6
|
+
description: The official CircleCI Ruby Docker image
|
7
|
+
docker:
|
8
|
+
- image: circleci/ruby:2.6.3-node
|
9
|
+
|
10
|
+
caches:
|
11
|
+
- &bundle_cache v1-repo-{{ checksum "Gemfile.lock" }}
|
12
|
+
|
13
|
+
commands:
|
14
|
+
run_linters:
|
15
|
+
description: command to start linters
|
16
|
+
steps:
|
17
|
+
- run:
|
18
|
+
name: rubocop
|
19
|
+
command: bundle exec rubocop
|
20
|
+
- run:
|
21
|
+
name: fasterer
|
22
|
+
command: bundle exec fasterer
|
23
|
+
|
24
|
+
run_specs:
|
25
|
+
steps:
|
26
|
+
- run:
|
27
|
+
name: run specs
|
28
|
+
command: |
|
29
|
+
mkdir /tmp/test-results
|
30
|
+
TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
|
31
|
+
bundle exec rspec --format progress \
|
32
|
+
--out /tmp/test-results/rspec.xml \
|
33
|
+
--format progress \
|
34
|
+
$TEST_FILES
|
35
|
+
defaults:
|
36
|
+
steps:
|
37
|
+
- checkout
|
38
|
+
- restore_cache:
|
39
|
+
key: *bundle_cache
|
40
|
+
- run: gem install bundler:2.0.2
|
41
|
+
- run: bundle install
|
42
|
+
- save_cache:
|
43
|
+
key: *bundle_cache
|
44
|
+
paths:
|
45
|
+
- bundle vendor/bundle
|
46
|
+
|
47
|
+
jobs:
|
48
|
+
lintering:
|
49
|
+
executor: default
|
50
|
+
steps:
|
51
|
+
- defaults
|
52
|
+
- run_linters
|
53
|
+
run_specs:
|
54
|
+
executor: default
|
55
|
+
steps:
|
56
|
+
- defaults
|
57
|
+
- run_specs
|
58
|
+
|
59
|
+
workflows:
|
60
|
+
version: 2.
|
61
|
+
build:
|
62
|
+
jobs:
|
63
|
+
- lintering:
|
64
|
+
filters:
|
65
|
+
branches:
|
66
|
+
only: develop
|
67
|
+
- run_specs:
|
68
|
+
filters:
|
69
|
+
branches:
|
70
|
+
only: develop
|
71
|
+
requires:
|
72
|
+
- lintering
|
data/.fasterer.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
speedups:
|
2
|
+
rescue_vs_respond_to: true
|
3
|
+
module_eval: true
|
4
|
+
shuffle_first_vs_sample: true
|
5
|
+
for_loop_vs_each: true
|
6
|
+
each_with_index_vs_while: false
|
7
|
+
map_flatten_vs_flat_map: true
|
8
|
+
reverse_each_vs_reverse_each: true
|
9
|
+
select_first_vs_detect: true
|
10
|
+
sort_vs_sort_by: true
|
11
|
+
fetch_with_argument_vs_block: true
|
12
|
+
keys_each_vs_each_key: true
|
13
|
+
hash_merge_bang_vs_hash_brackets: true
|
14
|
+
block_vs_symbol_to_proc: true
|
15
|
+
proc_call_vs_yield: true
|
16
|
+
gsub_vs_tr: true
|
17
|
+
select_last_vs_reverse_detect: true
|
18
|
+
getter_vs_attr_reader: true
|
19
|
+
setter_vs_attr_writer: true
|
20
|
+
|
data/.gitignore
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
## Specific to RubyMotion:
|
17
|
+
.dat*
|
18
|
+
.repl_history
|
19
|
+
build/
|
20
|
+
*.bridgesupport
|
21
|
+
build-iPhoneOS/
|
22
|
+
build-iPhoneSimulator/
|
23
|
+
|
24
|
+
## Specific to RubyMotion (use of CocoaPods):
|
25
|
+
#
|
26
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
27
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
28
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
29
|
+
#
|
30
|
+
# vendor/Pods/
|
31
|
+
|
32
|
+
## Documentation cache and generated files:
|
33
|
+
/.yardoc/
|
34
|
+
/_yardoc/
|
35
|
+
/doc/
|
36
|
+
/rdoc/
|
37
|
+
|
38
|
+
## Environment normalization:
|
39
|
+
/.bundle/
|
40
|
+
/vendor/bundle
|
41
|
+
/lib/bundler/man/
|
42
|
+
|
43
|
+
# for a library or gem, you might want to ignore these files since the code is
|
44
|
+
# intended to run in multiple environments; otherwise, check them in:
|
45
|
+
# Gemfile.lock
|
46
|
+
# .ruby-version
|
47
|
+
# .ruby-gemset
|
48
|
+
|
49
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
50
|
+
.rvmrc
|
51
|
+
.rspec_status
|
52
|
+
.DS_Store
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
codebreaker_gapdn (0.1.5)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ast (2.4.0)
|
10
|
+
colorize (0.8.1)
|
11
|
+
diff-lcs (1.3)
|
12
|
+
docile (1.3.2)
|
13
|
+
fasterer (0.8.1)
|
14
|
+
colorize (~> 0.7)
|
15
|
+
ruby_parser (>= 3.14.1)
|
16
|
+
jaro_winkler (1.5.4)
|
17
|
+
json (2.2.0)
|
18
|
+
parallel (1.19.1)
|
19
|
+
parser (2.6.5.0)
|
20
|
+
ast (~> 2.4.0)
|
21
|
+
rainbow (3.0.0)
|
22
|
+
rake (10.5.0)
|
23
|
+
rspec (3.9.0)
|
24
|
+
rspec-core (~> 3.9.0)
|
25
|
+
rspec-expectations (~> 3.9.0)
|
26
|
+
rspec-mocks (~> 3.9.0)
|
27
|
+
rspec-core (3.9.0)
|
28
|
+
rspec-support (~> 3.9.0)
|
29
|
+
rspec-expectations (3.9.0)
|
30
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
+
rspec-support (~> 3.9.0)
|
32
|
+
rspec-mocks (3.9.0)
|
33
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
+
rspec-support (~> 3.9.0)
|
35
|
+
rspec-support (3.9.0)
|
36
|
+
rubocop (0.76.0)
|
37
|
+
jaro_winkler (~> 1.5.1)
|
38
|
+
parallel (~> 1.10)
|
39
|
+
parser (>= 2.6)
|
40
|
+
rainbow (>= 2.2.2, < 4.0)
|
41
|
+
ruby-progressbar (~> 1.7)
|
42
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
43
|
+
rubocop-rspec (1.30.1)
|
44
|
+
rubocop (>= 0.60.0)
|
45
|
+
ruby-progressbar (1.10.1)
|
46
|
+
ruby_parser (3.14.1)
|
47
|
+
sexp_processor (~> 4.9)
|
48
|
+
sexp_processor (4.13.0)
|
49
|
+
simplecov (0.17.1)
|
50
|
+
docile (~> 1.1)
|
51
|
+
json (>= 1.8, < 3)
|
52
|
+
simplecov-html (~> 0.10.0)
|
53
|
+
simplecov-html (0.10.2)
|
54
|
+
unicode-display_width (1.6.0)
|
55
|
+
|
56
|
+
PLATFORMS
|
57
|
+
ruby
|
58
|
+
|
59
|
+
DEPENDENCIES
|
60
|
+
bundler (~> 2.0)
|
61
|
+
codebreaker_gapdn!
|
62
|
+
fasterer (~> 0.8.0)
|
63
|
+
rake (~> 10.0)
|
64
|
+
rspec (~> 3.0)
|
65
|
+
rubocop (~> 0.76.0)
|
66
|
+
rubocop-rspec
|
67
|
+
simplecov (~> 0.17.1)
|
68
|
+
|
69
|
+
BUNDLED WITH
|
70
|
+
2.1.2
|
data/README.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# codebreaker
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'codebreaker'
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require 'irb'
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/codebreaker.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'codebreaker_gapdn/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = 'codebreaker_gapdn'
|
9
|
+
spec.version = Codebreaker::VERSION
|
10
|
+
spec.authors = ['gapdn']
|
11
|
+
spec.email = ['dn090784gap@gmail.com']
|
12
|
+
|
13
|
+
spec.summary = 'Write a short summary, because RubyGems requires one.'
|
14
|
+
spec.description = 'Write a longer description or delete this line.'
|
15
|
+
spec.homepage = 'http://mysite.loc'
|
16
|
+
|
17
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
18
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
+
end
|
20
|
+
spec.bindir = 'exe'
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ['lib']
|
23
|
+
|
24
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
25
|
+
spec.add_development_dependency 'fasterer', '~> 0.8.0'
|
26
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
27
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
28
|
+
spec.add_development_dependency 'rubocop', '~> 0.76.0'
|
29
|
+
spec.add_development_dependency 'rubocop-rspec'
|
30
|
+
spec.add_development_dependency 'simplecov', '~> 0.17.1'
|
31
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'yaml'
|
4
|
+
require_relative 'database/data_handler'
|
5
|
+
require_relative 'database/statistic'
|
6
|
+
require_relative 'helper/validator'
|
7
|
+
require_relative 'entities/base_class'
|
8
|
+
require_relative 'entities/user'
|
9
|
+
require_relative 'entities/guess'
|
10
|
+
require_relative 'entities/difficulty'
|
11
|
+
require_relative 'codebreaker_gapdn/game'
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Codebreaker
|
4
|
+
class Game
|
5
|
+
GUESS_PRESENCE = '-'
|
6
|
+
GUESS_PLACE = '+'
|
7
|
+
|
8
|
+
attr_reader :secret_code, :attempts_counter, :hinted_numbers, :current_difficulty
|
9
|
+
|
10
|
+
def initialize(difficulty)
|
11
|
+
@secret_code = create_secret_code
|
12
|
+
@attempts_counter = 0
|
13
|
+
@current_difficulty = difficulty.level
|
14
|
+
@hinted_numbers = @secret_code.sample(@current_difficulty[:hints])
|
15
|
+
end
|
16
|
+
|
17
|
+
def check_number_match(guess)
|
18
|
+
@guess = guess
|
19
|
+
@attempts_counter += 1
|
20
|
+
return win_string if @guess == @secret_code
|
21
|
+
|
22
|
+
number_match(exact_match)
|
23
|
+
end
|
24
|
+
|
25
|
+
def take_hint
|
26
|
+
@hinted_numbers.pop
|
27
|
+
end
|
28
|
+
|
29
|
+
def win?(string)
|
30
|
+
string == win_string
|
31
|
+
end
|
32
|
+
|
33
|
+
def lose?
|
34
|
+
@attempts_counter >= @current_difficulty[:attempts]
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def win_string
|
40
|
+
GUESS_PLACE * Guess::VALID_GUESS_LENGTH
|
41
|
+
end
|
42
|
+
|
43
|
+
def create_secret_code
|
44
|
+
Array.new(4) { rand(0..6) }
|
45
|
+
end
|
46
|
+
|
47
|
+
def exact_match
|
48
|
+
array = @secret_code.dup
|
49
|
+
array.map.with_index do |_char, index|
|
50
|
+
next unless array[index] == @guess[index]
|
51
|
+
|
52
|
+
@guess[index] = nil
|
53
|
+
GUESS_PLACE
|
54
|
+
end.compact
|
55
|
+
end
|
56
|
+
|
57
|
+
def number_match(pluses)
|
58
|
+
code = @secret_code.map.with_index { |char, index| char if @guess[index] }.compact
|
59
|
+
@guess.compact!
|
60
|
+
code.map.with_index do |_char, index|
|
61
|
+
if code.include? @guess[index]
|
62
|
+
code[code.index(@guess[index])] = nil
|
63
|
+
pluses << GUESS_PRESENCE
|
64
|
+
end
|
65
|
+
end
|
66
|
+
pluses.join
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
storage.yml
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DataHandler
|
4
|
+
def self.load(file_path)
|
5
|
+
if File.exist?(file_path)
|
6
|
+
YAML.safe_load(File.read(file_path), [Symbol], [], true)
|
7
|
+
else
|
8
|
+
File.open(file_path, 'w+')
|
9
|
+
false
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.save(file_path, object)
|
14
|
+
File.open(file_path, 'w') { |file| file.write(object.to_yaml) }
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Codebreaker
|
4
|
+
class Statistic
|
5
|
+
include DataHandler
|
6
|
+
|
7
|
+
DATE_FORMAT = '%Y.%m.%d - %T'
|
8
|
+
|
9
|
+
attr_reader :headers, :items
|
10
|
+
|
11
|
+
def initialize(db = __dir__ + '/storage.yml')
|
12
|
+
@db = db
|
13
|
+
@headers = %w[ratign name difficulty attempts_total attempts_used hints_total hints_used]
|
14
|
+
@items = load || []
|
15
|
+
end
|
16
|
+
|
17
|
+
def statistic
|
18
|
+
sort
|
19
|
+
@items.each_with_index.map do |item, index|
|
20
|
+
[
|
21
|
+
index.next, item[:name], item[:difficulty], item[:attempts_total],
|
22
|
+
item[:attempts_used], item[:hints_total], item[:hints_used]
|
23
|
+
]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def add_item(game, username, date_format: DATE_FORMAT)
|
28
|
+
@items << { name: username,
|
29
|
+
difficulty: game.current_difficulty[:name],
|
30
|
+
difficulty_id: game.current_difficulty[:id],
|
31
|
+
attempts_total: game.current_difficulty[:attempts],
|
32
|
+
attempts_used: game.attempts_counter,
|
33
|
+
hints_total: game.current_difficulty[:hints],
|
34
|
+
hints_used: hints_used(game),
|
35
|
+
time: Time.now.strftime(date_format) }
|
36
|
+
save
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def hints_used(game)
|
42
|
+
game.current_difficulty[:hints] - game.hinted_numbers.size
|
43
|
+
end
|
44
|
+
|
45
|
+
def load
|
46
|
+
DataHandler.load(@db)
|
47
|
+
end
|
48
|
+
|
49
|
+
def save
|
50
|
+
DataHandler.save(@db, @items)
|
51
|
+
end
|
52
|
+
|
53
|
+
def sort
|
54
|
+
@items.sort_by! do |item|
|
55
|
+
[-item[:difficulty_id], item[:attempts_used], item[:hints_used]]
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Codebreaker
|
4
|
+
class Difficulty < BaseClass
|
5
|
+
LEVELS = {
|
6
|
+
easy: { attempts: 15, hints: 3, name: 'easy', id: 1 },
|
7
|
+
medium: { attempts: 10, hints: 2, name: 'medium', id: 2 },
|
8
|
+
hell: { attempts: 5, hints: 1, name: 'hell', id: 3 }
|
9
|
+
}.freeze
|
10
|
+
|
11
|
+
attr_reader :errors, :level
|
12
|
+
|
13
|
+
def initialize(level = :easy)
|
14
|
+
@level = LEVELS[level.to_sym]
|
15
|
+
@errors = []
|
16
|
+
end
|
17
|
+
|
18
|
+
def validate
|
19
|
+
@errors << 'unexpected_comand' unless LEVELS.values.include? @level
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Codebreaker
|
4
|
+
class Guess < BaseClass
|
5
|
+
VALID_GUESS_LENGTH = 4
|
6
|
+
VALID_GUESS_RANGE = ('0'..'6').freeze
|
7
|
+
|
8
|
+
attr_accessor :number
|
9
|
+
attr_reader :errors
|
10
|
+
|
11
|
+
def initialize(guess)
|
12
|
+
@number = guess
|
13
|
+
@errors = []
|
14
|
+
end
|
15
|
+
|
16
|
+
def validate
|
17
|
+
@errors << 'error_number_length' unless check_length?(@number, VALID_GUESS_LENGTH)
|
18
|
+
@errors << 'error_number_digit' unless check_number_in_range?(@number, VALID_GUESS_RANGE)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Codebreaker
|
4
|
+
class User < BaseClass
|
5
|
+
VALID_NAME_RANGE = (3..20).freeze
|
6
|
+
VALID_SYMBOLS_RANGE = ('a'..'z').freeze
|
7
|
+
|
8
|
+
attr_accessor :name
|
9
|
+
attr_reader :errors
|
10
|
+
|
11
|
+
def initialize(name = 'Codebreaker')
|
12
|
+
@name = name
|
13
|
+
@errors = []
|
14
|
+
end
|
15
|
+
|
16
|
+
def validate
|
17
|
+
@errors << 'error_name_length' unless check_length_in_range?(@name, VALID_NAME_RANGE)
|
18
|
+
@errors << 'error_name_chars' unless check_symbols_in_range?(@name, VALID_SYMBOLS_RANGE)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Validator
|
4
|
+
def check_length?(string, current_length)
|
5
|
+
string.length == current_length
|
6
|
+
end
|
7
|
+
|
8
|
+
def check_length_in_range?(string, range)
|
9
|
+
range.include? string.length
|
10
|
+
end
|
11
|
+
|
12
|
+
def check_number_in_range?(string, range)
|
13
|
+
string.chars.all? { |char| range.include? char }
|
14
|
+
end
|
15
|
+
|
16
|
+
def check_symbols_in_range?(string, range)
|
17
|
+
string.chars.all? { |char| range.include? char }
|
18
|
+
end
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,164 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: codebreaker_gapdn
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.5
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- gapdn
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-01-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: fasterer
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.8.0
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.8.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.76.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.76.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop-rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simplecov
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.17.1
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.17.1
|
111
|
+
description: Write a longer description or delete this line.
|
112
|
+
email:
|
113
|
+
- dn090784gap@gmail.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".circleci/config.yml"
|
119
|
+
- ".fasterer.yml"
|
120
|
+
- ".gitignore"
|
121
|
+
- ".rspec"
|
122
|
+
- ".rubocop.yml"
|
123
|
+
- ".travis.yml"
|
124
|
+
- Gemfile
|
125
|
+
- Gemfile.lock
|
126
|
+
- README.md
|
127
|
+
- Rakefile
|
128
|
+
- bin/console
|
129
|
+
- bin/setup
|
130
|
+
- codebreaker.gemspec
|
131
|
+
- lib/codebreaker_gapdn.rb
|
132
|
+
- lib/codebreaker_gapdn/game.rb
|
133
|
+
- lib/codebreaker_gapdn/version.rb
|
134
|
+
- lib/database/.gitignore
|
135
|
+
- lib/database/data_handler.rb
|
136
|
+
- lib/database/statistic.rb
|
137
|
+
- lib/entities/base_class.rb
|
138
|
+
- lib/entities/difficulty.rb
|
139
|
+
- lib/entities/guess.rb
|
140
|
+
- lib/entities/user.rb
|
141
|
+
- lib/helper/validator.rb
|
142
|
+
homepage: http://mysite.loc
|
143
|
+
licenses: []
|
144
|
+
metadata: {}
|
145
|
+
post_install_message:
|
146
|
+
rdoc_options: []
|
147
|
+
require_paths:
|
148
|
+
- lib
|
149
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - ">="
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
159
|
+
requirements: []
|
160
|
+
rubygems_version: 3.0.6
|
161
|
+
signing_key:
|
162
|
+
specification_version: 4
|
163
|
+
summary: Write a short summary, because RubyGems requires one.
|
164
|
+
test_files: []
|