mastermind_ruby 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.ruby-version +1 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +20 -0
- data/README.md +1 -0
- data/Rakefile +26 -0
- data/TODO.md +35 -0
- data/bin/rake +16 -0
- data/lib/mastermind_ruby/version.rb +3 -0
- data/mastermind_ruby.gemspec +24 -0
- metadata +40 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b265a9601800fa81f1b0ccff86b65c5d57066b4
|
4
|
+
data.tar.gz: e8f10788313f1e9faf38c2e644175f0aae8a5d6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfc794183bf2b29fa43d958a6259707755bfcb9bdaf7d64b9b1122e27c8a5f5e9c8dee520b67576db3b73ea89d53964e31c0cdfa6db685c5a189a0702643cd95
|
7
|
+
data.tar.gz: d4eeede3205907fed91e63293c867bf1ee7f758feb000564e50c4524fe683645f602ff38ccdba5cedc5044023d30e6f342fe90ffe763a4a955e45959b52b5550
|
data/.gitignore
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.2.2
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/README.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Mastermind_ruby
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
|
3
|
+
task :default => :test
|
4
|
+
|
5
|
+
desc 'Run all tests'
|
6
|
+
task :test => ["test:unit", "test:integration"]
|
7
|
+
|
8
|
+
namespace :test do
|
9
|
+
desc 'Run all unit tests'
|
10
|
+
task :unit do
|
11
|
+
puts "----------- Running unit tests ------------"
|
12
|
+
file_list = FileList.new('test/unit/*_test.rb')
|
13
|
+
file_list.each { |file| require_relative file }
|
14
|
+
end
|
15
|
+
|
16
|
+
desc 'Run all integration tests'
|
17
|
+
task :integration do
|
18
|
+
puts "----------- Running integration tests ------------"
|
19
|
+
file_list = FileList.new('test/integration/*_test.rb')
|
20
|
+
file_list.each { |file| require_relative file }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
task :run do
|
25
|
+
trap(0) { system "exe/mastermind" }
|
26
|
+
end
|
data/TODO.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# Phase I
|
2
|
+
|
3
|
+
* Das Spiel hat 6 verschieden Farben für die Codes.
|
4
|
+
* R (red)
|
5
|
+
* Y (yellow)
|
6
|
+
* G (green)
|
7
|
+
* O (orange)
|
8
|
+
* M (magenta)
|
9
|
+
* P (purple)
|
10
|
+
* Die Bewertung der Codes ist wie folgt:
|
11
|
+
* W (white): richtige Farbe an der falschen Position
|
12
|
+
* B (black): richtige Farbe an der richtigen Position
|
13
|
+
* Das Spiel kann über die Kommandozeile gestartet werden. `ruby mastermind.rb`
|
14
|
+
* Nach dem Starten generiert das Programm den geheim Code (4 stellen)
|
15
|
+
* Darauf wird der Benutzer über die Kommandozeiel zur eingabe eines Codes
|
16
|
+
aufgefordert.
|
17
|
+
* Nach der Eingabe des Codes gibt das Programm die entsprechende Bewertung aus.
|
18
|
+
|
19
|
+
Ein möglicher Programmverlauf wäre wie folgt:
|
20
|
+
|
21
|
+
```
|
22
|
+
$ ruby mastermind.rb
|
23
|
+
RRRR
|
24
|
+
=> BB--
|
25
|
+
RRYY
|
26
|
+
=> WBW-
|
27
|
+
RYRP
|
28
|
+
=> WBW-
|
29
|
+
YRRM
|
30
|
+
=> BBB-
|
31
|
+
YRRO
|
32
|
+
=> BBBB
|
33
|
+
|
34
|
+
Code cracked in 5 turns.
|
35
|
+
```
|
data/bin/rake
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'rake' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('rake', 'rake')
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require_relative 'lib/mastermind_ruby/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'mastermind_ruby'
|
5
|
+
s.version = MastermindRuby::VERSION
|
6
|
+
s.date = '2015-08-06'
|
7
|
+
s.summary = "A mastermind library"
|
8
|
+
s.description = "Mastermind or Master Mind is a code-breaking game for two players.
|
9
|
+
The modern game with pegs was invented in 1970 by Mordecai Meirowitz, an Israeli postmaster and telecommunications expert.
|
10
|
+
It resembles an earlier pencil and paper game called Bulls and Cows that may date back a century or more.
|
11
|
+
The library is here to reuse the game logic I wrote, and to make your game (UI) as easy as possible to manage."
|
12
|
+
s.authors = ["Yves Siegrist", "Yves Senn"]
|
13
|
+
s.email = 'y.siegrist@4teamwork.ch'
|
14
|
+
s.homepage =
|
15
|
+
'https://github.com/Elektron1c97/Mastermind_ruby'
|
16
|
+
s.license = 'MIT'
|
17
|
+
|
18
|
+
s.add_development_dependency 'bundler'
|
19
|
+
s.add_development_dependency 'rake'
|
20
|
+
|
21
|
+
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
|
+
s.bindir = "exe"
|
23
|
+
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mastermind_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yves Siegrist
|
@@ -10,7 +10,35 @@ autorequire:
|
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
12
|
date: 2015-08-06 00:00:00.000000000 Z
|
13
|
-
dependencies:
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rake
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
14
42
|
description: |-
|
15
43
|
Mastermind or Master Mind is a code-breaking game for two players.
|
16
44
|
The modern game with pegs was invented in 1970 by Mordecai Meirowitz, an Israeli postmaster and telecommunications expert.
|
@@ -22,11 +50,21 @@ executables:
|
|
22
50
|
extensions: []
|
23
51
|
extra_rdoc_files: []
|
24
52
|
files:
|
53
|
+
- ".gitignore"
|
54
|
+
- ".ruby-version"
|
55
|
+
- Gemfile
|
56
|
+
- Gemfile.lock
|
57
|
+
- README.md
|
58
|
+
- Rakefile
|
59
|
+
- TODO.md
|
60
|
+
- bin/rake
|
25
61
|
- exe/mastermind
|
26
62
|
- lib/mastermind_ruby.rb
|
27
63
|
- lib/mastermind_ruby/code.rb
|
28
64
|
- lib/mastermind_ruby/console_interface.rb
|
29
65
|
- lib/mastermind_ruby/game.rb
|
66
|
+
- lib/mastermind_ruby/version.rb
|
67
|
+
- mastermind_ruby.gemspec
|
30
68
|
homepage: https://github.com/Elektron1c97/Mastermind_ruby
|
31
69
|
licenses:
|
32
70
|
- MIT
|