GemCodebreaker 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +3 -0
- data/.fasterer.yml +2 -0
- data/bin/{console.rb → console} +3 -3
- data/lib/GemCodebreaker/classes/game.rb +4 -4
- data/lib/GemCodebreaker/gem_codebreaker.rb +0 -1
- data/lib/GemCodebreaker/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d68658435b24026df49116af030e2ed5ef790fdd7975f9c0532fbb1318cbef11
|
4
|
+
data.tar.gz: e5693bc8fb47255ff1db31912f2c53214e6976cc42b025f62a249381139aad1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0e3a636cbdc10ec10e12fc548088be337159ffd74f4c732543a695916a0b81ed91fb6bb8a98dfd8c93feb7cc84415ca6e5849c29e34a97c0f5e14444f80afaf
|
7
|
+
data.tar.gz: 9c083514277ee9eea3ed8997b845bf78a11ee44e4ebccd23ee073b6df7b5e632fb5a1b84eaf07d539d4a654bfb3c832cd937eadc3f44af2ba7432d2b26f16cf1
|
data/.circleci/config.yml
CHANGED
data/.fasterer.yml
CHANGED
data/bin/{console.rb → console}
RENAMED
@@ -1,9 +1,9 @@
|
|
1
|
-
|
1
|
+
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
#
|
3
|
+
# frozen_string_literal: true
|
4
4
|
|
5
5
|
require 'bundler/setup'
|
6
|
-
require 'GemCodebreaker'
|
6
|
+
require 'GemCodebreaker/gem_codebreaker'
|
7
7
|
|
8
8
|
# You can add fixtures and/or initialization code here to make experimenting
|
9
9
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module GemCodebreaker
|
4
4
|
# Game class
|
5
5
|
class Game
|
6
|
-
LENGTH_OF_SECRET_CODE =
|
6
|
+
LENGTH_OF_SECRET_CODE = 4
|
7
7
|
DIGIT_RANGE = (1..6).freeze
|
8
8
|
|
9
9
|
include GameConfigurations
|
@@ -23,12 +23,12 @@ module GemCodebreaker
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def generate_secret_code
|
26
|
-
@secrete_code = LENGTH_OF_SECRET_CODE.map { rand DIGIT_RANGE }
|
26
|
+
@secrete_code = (1..LENGTH_OF_SECRET_CODE).map { rand DIGIT_RANGE }
|
27
27
|
end
|
28
28
|
|
29
29
|
def guess_valid?(user_code)
|
30
30
|
validate_string(user_code)
|
31
|
-
validate_guess_length if user_code.length != LENGTH_OF_SECRET_CODE
|
31
|
+
validate_guess_length if user_code.length != LENGTH_OF_SECRET_CODE
|
32
32
|
validate_chars_range unless user_code[/\A[1-6]{4}\z/]
|
33
33
|
true
|
34
34
|
end
|
@@ -44,7 +44,7 @@ module GemCodebreaker
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def win_game?
|
47
|
-
@matcher_hash[:plus] == LENGTH_OF_SECRET_CODE
|
47
|
+
@matcher_hash[:plus] == LENGTH_OF_SECRET_CODE
|
48
48
|
end
|
49
49
|
|
50
50
|
def game_over?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: GemCodebreaker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vasyl
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fasterer
|
@@ -125,7 +125,7 @@ files:
|
|
125
125
|
- Gemfile.lock
|
126
126
|
- LICENSE.txt
|
127
127
|
- README.md
|
128
|
-
- bin/console
|
128
|
+
- bin/console
|
129
129
|
- bin/setup
|
130
130
|
- lib/GemCodebreaker/classes/codemaker.rb
|
131
131
|
- lib/GemCodebreaker/classes/game.rb
|