Codebreaker_RG2016 0.1.5 → 0.1.6
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 +4 -4
- data/README.md +40 -3
- data/lib/codebreaker/modules/engine.rb +3 -2
- data/lib/codebreaker/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4683b0f634dfe3bfb3d849372e4755790584e8c
|
4
|
+
data.tar.gz: 732dacf154d721d247f9182e1678f971517992ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08378c29701023d112efe921a34e9635ccc04ae4becc60d3b4078e7d24a9cdf89d530631e110c7fc1ecc78c746fbfd9f9d8c0dd6d93a3e9cf369633ac740c3a5
|
7
|
+
data.tar.gz: 092f09456062104048668516552945aeb0e9891ab9a764524557317cf25961ee85da2359bf6dcc2c03b9cd150f0a8768fa95f5e150598a3d1a030f38ce6f46ce
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[](https://badge.fury.io/rb/Codebreaker_RG2016)
|
2
|
+
|
1
3
|
# Codebreaker
|
2
4
|
|
3
5
|
Codebreaker is a logic game in which a code-breaker tries to break a secret code created by a code-maker. The code-maker, which will be played by the application we’re going to write, creates a secret code of four numbers between 1 and 6.
|
@@ -32,37 +34,72 @@ Or install it yourself as:
|
|
32
34
|
install gem Codebreaker_RG2016 from rubygems.org and from irb type:
|
33
35
|
$ require 'codebreaker'
|
34
36
|
|
35
|
-
|
37
|
+
|
38
|
+
It looks like:
|
36
39
|
|
37
40
|
You should to break a secret code ****.
|
41
|
+
|
38
42
|
Please, enter your name: $ Alex
|
43
|
+
|
39
44
|
You have 7 attempts and 1 hint.
|
45
|
+
|
40
46
|
Type your secret code or "hint": $ hint
|
47
|
+
|
41
48
|
Hint: Secret code contains: 3
|
42
49
|
|
43
50
|
You have 7 attempts and 0 hint.
|
51
|
+
|
44
52
|
Type your secret code or "hint": $ 21321
|
53
|
+
|
45
54
|
You should type 4 numbers in code or "hint"!!!
|
55
|
+
|
46
56
|
$ 6666
|
47
|
-
|
57
|
+
|
58
|
+
+
|
59
|
+
|
48
60
|
You have 7 attempts and 0 hint.
|
61
|
+
|
49
62
|
Type your secret code or "hint": $ 3333
|
50
|
-
|
63
|
+
|
64
|
+
+
|
65
|
+
|
66
|
+
|
51
67
|
...
|
68
|
+
|
69
|
+
|
52
70
|
You have 0 attempts and 0 hint.
|
71
|
+
|
53
72
|
Type your secret code or "hint": $ 3444
|
73
|
+
|
54
74
|
Game over! Secret code is 3614.
|
75
|
+
|
55
76
|
Alex, your score: 0!
|
77
|
+
|
56
78
|
Do you want to start new game?(y/n)
|
79
|
+
|
57
80
|
$ y
|
81
|
+
|
58
82
|
You have 7 attempts and 1 hint.
|
83
|
+
|
59
84
|
Type your secret code or "hint": $ hint
|
85
|
+
|
60
86
|
Hint: Secret code contains: 6
|
87
|
+
|
88
|
+
|
61
89
|
...
|
90
|
+
|
91
|
+
|
62
92
|
Do you want to start new game?(y/n)
|
93
|
+
|
63
94
|
$ n
|
95
|
+
|
64
96
|
Do you want to save your score in score file?(y/n)
|
65
97
|
|
98
|
+
$ y
|
99
|
+
|
100
|
+
You score saved in file: [path]/score/Alex_score.txt
|
101
|
+
|
102
|
+
|
66
103
|
## Contributing
|
67
104
|
|
68
105
|
Bug reports and pull requests are welcome on GitHub at https://github.com/Ajiexwel4/codebreaker. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
@@ -34,8 +34,9 @@ module Codebreaker
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def minuses
|
37
|
-
secret_code = @secret_code.chars.to_a
|
38
|
-
array_player_code.
|
37
|
+
secret_code = @secret_code.chars.to_a
|
38
|
+
array_player_code.map{ |num| secret_code[secret_code.find_index(num)] = "-" if secret_code.include?(num)}
|
39
|
+
secret_code.select{ |num| num == "-" }.drop(pluses.size)
|
39
40
|
end
|
40
41
|
|
41
42
|
def win?
|
data/lib/codebreaker/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Codebreaker_RG2016
|
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
|
- Ajiexwel4
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|