scrambler 0.1.1 → 0.1.2

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.
@@ -5,10 +5,10 @@ module Scrambler
5
5
  variants = %w(-- ++)
6
6
  variants_for_u = ["'", ""]
7
7
  (1..lines).map do |line|
8
- ((1..columns).map do |column|
9
- turns.sample + variants.sample
8
+ ((0..(columns-1)).map do |column|
9
+ turns[column % 2] + variants.sample
10
10
  end + ["U#{variants_for_u.sample}"]).join(" ")
11
11
  end.join("\n")
12
12
  end
13
13
  end
14
- end
14
+ end
@@ -1,3 +1,3 @@
1
1
  module Scrambler
2
- VERSION = "0.1.1"
3
- end
2
+ VERSION = "0.1.2"
3
+ end
@@ -3,8 +3,10 @@ require "spec_helper"
3
3
  describe Scrambler::Megaminx do
4
4
  let(:valid_turns) { %w(R++ R-- D++ D--) }
5
5
 
6
+ subject { Scrambler::Megaminx.new.scramble }
7
+
6
8
  it "should default to 7 lines and 10 columns" do
7
- lines = subject.scramble.split("\n")
9
+ lines = subject.split("\n")
8
10
  lines.should have(7).elements
9
11
  lines.each do |line|
10
12
  line.split(" ").should have(11).elements
@@ -12,16 +14,28 @@ describe Scrambler::Megaminx do
12
14
  end
13
15
 
14
16
  it "should have U / U' at the end of each line" do
15
- subject.scramble.split("\n").each do |line|
17
+ subject.split("\n").each do |line|
16
18
  line.should match(/U'?\Z/)
17
19
  end
18
20
  end
19
21
 
20
22
  it "should contain R++/R-- and D++/D-- turns at the first 'column' turns" do
21
- subject.scramble.split("\n"). each do |line|
23
+ subject.split("\n"). each do |line|
22
24
  line.split(" ")[0..-2].each do |turn|
23
25
  valid_turns.should include(turn)
24
26
  end
25
27
  end
26
28
  end
27
- end
29
+
30
+ it "should switch between R and D turns, beginning with R" do
31
+ basic_turns = subject.split("\n").first.split(" ").map { |t| t[0..0] }
32
+ basic_turns[0].should == "R"
33
+ basic_turns[1].should == "D"
34
+ basic_turns[2].should == "R"
35
+ basic_turns[3].should == "D"
36
+ basic_turns[4].should == "R"
37
+ basic_turns[5].should == "D"
38
+ basic_turns[6].should == "R"
39
+ basic_turns[7].should == "D"
40
+ end
41
+ end
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scrambler
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 31
4
5
  prerelease:
5
- version: 0.1.1
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 2
10
+ version: 0.1.2
6
11
  platform: ruby
7
12
  authors:
8
13
  - Tim Habermaas
@@ -20,7 +25,12 @@ dependencies:
20
25
  requirements:
21
26
  - - ~>
22
27
  - !ruby/object:Gem::Version
23
- version: 2.6.0
28
+ hash: 47
29
+ segments:
30
+ - 2
31
+ - 8
32
+ - 0
33
+ version: 2.8.0
24
34
  type: :development
25
35
  version_requirements: *id001
26
36
  - !ruby/object:Gem::Dependency
@@ -31,6 +41,9 @@ dependencies:
31
41
  requirements:
32
42
  - - ">="
33
43
  - !ruby/object:Gem::Version
44
+ hash: 3
45
+ segments:
46
+ - 0
34
47
  version: "0"
35
48
  type: :development
36
49
  version_requirements: *id002
@@ -86,12 +99,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
86
99
  requirements:
87
100
  - - ">="
88
101
  - !ruby/object:Gem::Version
102
+ hash: 3
103
+ segments:
104
+ - 0
89
105
  version: "0"
90
106
  required_rubygems_version: !ruby/object:Gem::Requirement
91
107
  none: false
92
108
  requirements:
93
109
  - - ">="
94
110
  - !ruby/object:Gem::Version
111
+ hash: 3
112
+ segments:
113
+ - 0
95
114
  version: "0"
96
115
  requirements: []
97
116
 
@@ -102,4 +121,3 @@ specification_version: 3
102
121
  summary: Scrambler for cubes and other puzzles
103
122
  test_files: []
104
123
 
105
- has_rdoc: