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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 875daa4171da9fe143856060cbf1339ef4a122af
4
- data.tar.gz: 80c9f4c1aa0d747ce09c664f2a13c15f55835c97
3
+ metadata.gz: f4683b0f634dfe3bfb3d849372e4755790584e8c
4
+ data.tar.gz: 732dacf154d721d247f9182e1678f971517992ab
5
5
  SHA512:
6
- metadata.gz: 4268c7fd9de42ac7cb116f1d96fbba9583c99840072a1dacf2cee4fa47a339cbede0c94fb55676e7b842e458efb3529e84403e1aa32729646152d2154bc1b941
7
- data.tar.gz: bc7c0b04d6cf3e372200ea3eb3e2e83d84e8449609b5fc206e8c60db2386084c166e751e67441c920ebe13531a1a466a89a9ecc5645204a27e3448ada8af862c
6
+ metadata.gz: 08378c29701023d112efe921a34e9635ccc04ae4becc60d3b4078e7d24a9cdf89d530631e110c7fc1ecc78c746fbfd9f9d8c0dd6d93a3e9cf369633ac740c3a5
7
+ data.tar.gz: 092f09456062104048668516552945aeb0e9891ab9a764524557317cf25961ee85da2359bf6dcc2c03b9cd150f0a8768fa95f5e150598a3d1a030f38ce6f46ce
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Gem Version](https://badge.fury.io/rb/Codebreaker_RG2016.svg)](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
- ## It looks like:
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.sort
38
- array_player_code.sort.map.with_index { |num, index| '-' if num == secret_code[index] }.compact.drop(pluses.size)
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?
@@ -1,3 +1,3 @@
1
1
  module Codebreaker
2
- VERSION = '0.1.5'.freeze
2
+ VERSION = '0.1.6'.freeze
3
3
  end
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.5
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-06 00:00:00.000000000 Z
11
+ date: 2016-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler