puzzled 0.2 → 0.9

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  Puzzled?
2
2
  ========
3
- Generates scrambles for the Rubik's Cube.
3
+ Generates scrambles for the Mini Cube (2x2x2), Rubik's Cube (3x3x3), Revenge Cube (4x4x4), and Professor's Cube (5x5x5).
4
4
 
5
5
  Usage
6
6
  -----
@@ -11,14 +11,19 @@ Install:
11
11
  Play:
12
12
 
13
13
  > require 'puzzled'
14
- > Puzzled::RubiksCube.new.scramble 10
15
14
 
15
+ > Puzzled::MiniCube.new.scramble 10
16
+ #=> ["U'", "B2", "U2", "D'", "F'", "U'", "D", "F2", "B", "U2"]
17
+
18
+ > Puzzled::RubiksCube.new.scramble 10
16
19
  #=> ["F", "D'", "U", "F", "U'", "D2", "F2", "B", "U", "B'"]
17
20
 
18
21
  > Puzzled::RevengeCube.new.scramble 10
19
-
20
22
  #=> ["L", "R'", "u", "d2", "f2", "D", "B", "b", "r'", "L'"]
21
23
 
24
+ > Puzzled::ProfessorsCube.new.scramble 10
25
+ #=> ["D'", "F2", "L2", "F", "f", "d", "l'", "F'", "B'", "R"]
26
+
22
27
  Test:
23
28
 
24
29
  $ git clone git://github.com/huntca/puzzled.git
@@ -0,0 +1,4 @@
1
+ module Puzzled
2
+ class MiniCube < RubiksCube
3
+ end
4
+ end
@@ -0,0 +1,8 @@
1
+ module Puzzled
2
+ class ProfessorsCube < RevengeCube
3
+ # Retun Professor's Cube scramble of length n
4
+ def scramble(n=60)
5
+ super(n)
6
+ end
7
+ end
8
+ end
@@ -1,3 +1,3 @@
1
1
  module Puzzled
2
- VERSION = "0.2"
2
+ VERSION = "0.9"
3
3
  end
data/lib/puzzled.rb CHANGED
@@ -2,3 +2,5 @@ require "puzzled/version"
2
2
  require "puzzled/cube"
3
3
  require "puzzled/rubiks_cube"
4
4
  require "puzzled/revenge_cube"
5
+ require "puzzled/mini_cube"
6
+ require "puzzled/professors_cube"
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe Puzzled::MiniCube do
4
+ describe "#scramble" do
5
+ before(:each) do
6
+ @mini_cube = Puzzled::MiniCube.new
7
+ end
8
+
9
+ it "returns correct number of moves by default" do
10
+ @mini_cube.scramble.size.should == 25
11
+ end
12
+
13
+ it "contains only valid moves" do
14
+ moves = ["F","B","L","R","D","U"]
15
+ contains_valid_moves(@mini_cube.scramble, moves)
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe Puzzled::ProfessorsCube do
4
+ describe "#scramble" do
5
+ before(:each) do
6
+ @professors_cube= Puzzled::ProfessorsCube.new
7
+ end
8
+
9
+ it "returns correct number of moves by default" do
10
+ @professors_cube.scramble.size == 60
11
+ end
12
+
13
+ it "contains only valid moves" do
14
+ moves = ["F","B","L","R","D","U",
15
+ "f","b","l","r","d","u"]
16
+ contains_valid_moves(@professors_cube.scramble, moves)
17
+ end
18
+
19
+ it "contains some slice moves" do
20
+ contains_slice_moves(@professors_cube.scramble)
21
+ end
22
+ end
23
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: puzzled
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: "0.2"
5
+ version: "0.9"
6
6
  platform: ruby
7
7
  authors:
8
8
  - Chris Hunt
@@ -39,11 +39,15 @@ files:
39
39
  - Rakefile
40
40
  - lib/puzzled.rb
41
41
  - lib/puzzled/cube.rb
42
+ - lib/puzzled/mini_cube.rb
43
+ - lib/puzzled/professors_cube.rb
42
44
  - lib/puzzled/revenge_cube.rb
43
45
  - lib/puzzled/rubiks_cube.rb
44
46
  - lib/puzzled/version.rb
45
47
  - puzzled.gemspec
46
48
  - spec/cube_spec.rb
49
+ - spec/mini_cube_spec.rb
50
+ - spec/professors_cube_spec.rb
47
51
  - spec/revenge_cube_spec.rb
48
52
  - spec/rubiks_cube_spec.rb
49
53
  - spec/spec_helper.rb
@@ -76,6 +80,8 @@ specification_version: 3
76
80
  summary: Rubik's Cube scramble generator.
77
81
  test_files:
78
82
  - spec/cube_spec.rb
83
+ - spec/mini_cube_spec.rb
84
+ - spec/professors_cube_spec.rb
79
85
  - spec/revenge_cube_spec.rb
80
86
  - spec/rubiks_cube_spec.rb
81
87
  - spec/spec_helper.rb