edlvj_codebreaker 0.1.0 → 0.2.0
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/lib/edlvj_codebreaker.rb +5 -0
- data/lib/game.rb +3 -3
- metadata +3 -12
- data/.gitignore +0 -9
- data/.travis.yml +0 -5
- data/Gemfile +0 -4
- data/README.md +0 -23
- data/Rakefile +0 -11
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/codebreaker.gemspec +0 -35
- data/lib/codebreaker/version.rb +0 -3
- data/stat.yml +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f78075789b83a3053df6c40879d9a77326d56c5f
|
4
|
+
data.tar.gz: 07be937d067e70c09eb1b73c88b475aa4baa0aa8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a6df57495a5ecf5360ff0dcab8fbeb70097327b0b7443605a3c7f6371c92ec5929d86781233e7fa948f244013f8a178103ef4dd91ebcf2a5e9e79f95c9fc133
|
7
|
+
data.tar.gz: 78cbd261d7e5ef8e53226819738ac84bb3e62fa7d405b1b47d5d8e72cc6a0e723d6613fc0cb6e3b1b31fece4bf6f6643c16a8762d3f5f62601fb7e320481e37e
|
data/lib/game.rb
CHANGED
@@ -19,6 +19,7 @@ module Codebreaker
|
|
19
19
|
def match_guess(code)
|
20
20
|
return "Your code is not valid" unless code.match(/(^([1-6]{4})$)/)
|
21
21
|
|
22
|
+
@win_status = true if @secret_code == code
|
22
23
|
@attempts -= 1
|
23
24
|
secret = @secret_code.chars.map(&:to_i)
|
24
25
|
|
@@ -31,9 +32,8 @@ module Codebreaker
|
|
31
32
|
secret[secret.find_index(number)] = nil
|
32
33
|
res << WRONG_POSITION
|
33
34
|
end
|
34
|
-
|
35
|
-
|
36
|
-
@win_status = true if res.join == '++++'
|
35
|
+
end
|
36
|
+
|
37
37
|
res.join
|
38
38
|
end
|
39
39
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: edlvj_codebreaker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ed Goryach
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -59,18 +59,9 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
-
- ".gitignore"
|
63
|
-
- ".travis.yml"
|
64
|
-
- Gemfile
|
65
|
-
- README.md
|
66
|
-
- Rakefile
|
67
|
-
- bin/console
|
68
|
-
- bin/setup
|
69
|
-
- codebreaker.gemspec
|
70
|
-
- lib/codebreaker/version.rb
|
71
62
|
- lib/console.rb
|
63
|
+
- lib/edlvj_codebreaker.rb
|
72
64
|
- lib/game.rb
|
73
|
-
- stat.yml
|
74
65
|
homepage: https://github.com/edlvj/ruby_codebreaker
|
75
66
|
licenses: []
|
76
67
|
metadata:
|
data/.gitignore
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/README.md
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
_____ _ ______ _
|
2
|
-
/ __ \ | | | ___ \ | |
|
3
|
-
| / \/ ___ __| | ___| |_/ /_ __ __ _| | _____ _ __
|
4
|
-
| | / _ \ / _` |/ _ \ ___ \ '__/ _` | |/ / _ \ '__|
|
5
|
-
| \__/\ (_) | (_| | __/ |_/ / | | (_| | < __/ |
|
6
|
-
\____/\___/ \__,_|\___\____/|_| \__,_|_|\_\___|_|
|
7
|
-
|
8
|
-
|
9
|
-
A great way to get started gathering user stories is to do a high-level brain dump of the sorts of things we might like to do. Here are some titles to get started:
|
10
|
-
|
11
|
-
Start game - When a new game was started, the game generates secret code. The code should have 4 items.
|
12
|
-
|
13
|
-
Code-breaker submits guess - The code-breaker propose a guess, and the system replies by marking the guess according to the marking algorithm.
|
14
|
-
|
15
|
-
Code-breaker wins game - The code-breaker propose a guess that matches the secret code exactly. The system responds by marking the guess with four + signs.
|
16
|
-
|
17
|
-
Code-breaker loses game - After some number of turns, the game tells the code-breaker that the game is over (need to decide how many turns and whether to reveal the code).
|
18
|
-
|
19
|
-
Code-breaker plays again - After the game is won or lost, the system prompts the code-breaker to play again. If the code-breaker indicates yes, a new game begins. If the code-breaker indicates no, the system shuts down.
|
20
|
-
|
21
|
-
Code-breaker requests hint - At any time during a game, the code-breaker can request a hint, at which point the system reveals one of the numbers in the secret code.
|
22
|
-
|
23
|
-
Code-breaker saves score - After the game is won or lost, the code-breaker can opt to save information about the game: who (initials?), how many turns, and so on.
|
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "./lib/console.rb"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
Codebreaker::Console.new.play
|
14
|
-
|
data/bin/setup
DELETED
data/codebreaker.gemspec
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'codebreaker/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "edlvj_codebreaker"
|
8
|
-
spec.version = Codebreaker::VERSION
|
9
|
-
spec.authors = ["Ed Goryach"]
|
10
|
-
spec.email = ["gorachedik96@gmail.com"]
|
11
|
-
|
12
|
-
spec.summary = %q{"Codebreaker"}
|
13
|
-
spec.description = %q{"Codebreaker"}
|
14
|
-
spec.homepage = "https://github.com/edlvj/ruby_codebreaker"
|
15
|
-
|
16
|
-
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
-
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
-
if spec.respond_to?(:metadata)
|
19
|
-
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
20
|
-
else
|
21
|
-
raise "RubyGems 2.0 or newer is required to protect against " \
|
22
|
-
"public gem pushes."
|
23
|
-
end
|
24
|
-
|
25
|
-
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
26
|
-
f.match(%r{^(test|spec|features)/})
|
27
|
-
end
|
28
|
-
spec.bindir = "exe"
|
29
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
|
-
spec.require_paths = ["lib"]
|
31
|
-
|
32
|
-
spec.add_development_dependency "bundler", "~> 1.13"
|
33
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
34
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
35
|
-
end
|
data/lib/codebreaker/version.rb
DELETED