codebracker_simb 0.1.5 → 0.1.8

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
  SHA256:
3
- metadata.gz: 04aaeed8d8b52133e7983c33638677cca1d681823ed6d444d5b5f6cd0b7583e7
4
- data.tar.gz: cbff78104744da21b6d02367369ec9337af65f3449a5d5ad562cb72fa7ae841c
3
+ metadata.gz: 0e68585db1780f68c71384bfcc7daa1520be4a81a6832d102ab05f2c7e249f73
4
+ data.tar.gz: a1edd6963b2a4718bb471dec3b114891d5ecec097eb851697bc8baee1fca60f2
5
5
  SHA512:
6
- metadata.gz: 127fba528333160aa2a5402c5b6d535196edad52122902f09dbb01a2f1ae548e16f0e5318ecad520407a998ace2a2f750d02c2fd7a9a9d1230a13283e5ee8af8
7
- data.tar.gz: '028d0d8a11230e1432122f58f88922879f44d7efe2e0af56e0281c8a7557806dccefad7abcee4671e29ed943fdc4f2447ab7d64b1ea8f7a33f9cd356a982f068'
6
+ metadata.gz: 12d35b75120ab80a1dcf48704b1ef24b4ad0fdfb800bb0736ef21755cf7ec44083c400433701f5b189781d79fd3266a4cce3aa8f1d2560c8202129537c1a0bd1
7
+ data.tar.gz: d7699f2722e3aedd6a1b79c1354086e36652e0e0e0f0b21c791f204349ee5ab0b00c3275c18c9bd3406ab499111b2e5a8ae7c8481ab21dd4883b59c980d18037
@@ -5,7 +5,7 @@ module CodebrackerSimb
5
5
  def initialize(code, ans)
6
6
  @ans = ans
7
7
  @code = code
8
- @columns_with_plus = []
8
+ @filled_column = []
9
9
  super([[nil, nil, nil, nil], [nil, nil, nil, nil], [nil, nil, nil, nil], [nil, nil, nil, nil]])
10
10
  end
11
11
 
@@ -33,7 +33,7 @@ module CodebrackerSimb
33
33
  each_with_index do |line, i|
34
34
  if @code[i] == @ans[i]
35
35
  line[i] = :plus
36
- @columns_with_plus << i
36
+ @filled_column << i
37
37
  end
38
38
  end
39
39
  end
@@ -41,7 +41,10 @@ module CodebrackerSimb
41
41
  def fill_with_minus
42
42
  each_with_index do |line, i|
43
43
  line.each_with_index do |_el, j|
44
- line[j] = :minus if @code[i] == @ans[j] && !line[j] && !@columns_with_plus.include?(j)
44
+ if @code[i] == @ans[j] && !line[j] && !@filled_column.include?(j)
45
+ line[j] = :minus
46
+ @filled_column << j
47
+ end
45
48
  end
46
49
  end
47
50
  end
@@ -16,7 +16,7 @@ module CodebrackerSimb
16
16
  CONGRATULATIONS = 'Congratulations! You broked a code, master!'
17
17
 
18
18
  def initialize(complexity)
19
- @attempts = attempts(complexity)
19
+ @attempts = set_attempts(complexity)
20
20
  end
21
21
 
22
22
  def play
@@ -37,8 +37,8 @@ module CodebrackerSimb
37
37
  @code = Array.new(4) { rand(1..6) }
38
38
  end
39
39
 
40
- def end_with_win?(result)
41
- result == '++++'
40
+ def end_with_win?
41
+ code == answer
42
42
  end
43
43
 
44
44
  def refresh_attempts_quantity
@@ -48,7 +48,7 @@ module CodebrackerSimb
48
48
  end
49
49
  end
50
50
 
51
- def attempts(complexity)
51
+ def set_attempts(complexity)
52
52
  case complexity
53
53
  when 'easy'
54
54
  14
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CodebrackerSimb
4
- VERSION = "0.1.5"
4
+ VERSION = "0.1.8"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codebracker_simb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - max
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-26 00:00:00.000000000 Z
11
+ date: 2022-08-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Write a longer description or delete this line.
14
14
  email: