rubyks 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/lib/rubyks.rb +42 -0
- metadata +7 -9
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NjBjM2I2MDhjMDBiMGFiMjE5NzIwY2E3NzA5Njg5ODJlMjMyNGMzNw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
OTE3NzBkM2E1NDkwNjA2NDM4MjIwNmY5ZDUxZjEyZDRmNzZkNjRhNQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZGQ5YzI2ODJmZjc2ZTBmYTdmMWQ3ZWFjMThhYjA0NmNkYzMwMTRmMmQ1YWJk
|
10
|
+
OGRiYjVhYWM1MzE2ZTdiNmJkMTlmMjNjZDkyM2RjMDUzY2Y3ODAyNTg2Mjgx
|
11
|
+
ZDQ1YzY1YzczMzg1ZTU5YTA0M2M5NGQ4ZDcyZjk1ZjMwYmY1ZDk=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MWJjYWIzZTMxZmU4NTNjNDMxYTcxNTZjZThkMDAyODdjZWRjMjQ1NTIyNWZm
|
14
|
+
ZDYwM2Q3M2Y1ZTY3OTJkMWFlOTYyYjQ4ZDc4YjE5YWZlYmRmZWQzYzM1ZTM0
|
15
|
+
ZWE2YTdlYWRlZTE3YjU2ODU4Mzg2ZjY2OGIyNTNlMmM2ZmFkNWQ=
|
data/lib/rubyks.rb
CHANGED
@@ -836,3 +836,45 @@ class Cube
|
|
836
836
|
end
|
837
837
|
self
|
838
838
|
end
|
839
|
+
|
840
|
+
#This is a software model of a Rubik's cube, providing a dynamic data structure with which to describe the state and orientation of any cube in any legal position.
|
841
|
+
#
|
842
|
+
#I have included a set of solver methods that work every time, although pretty inefficiently. If you come across an edge case, please let me know!
|
843
|
+
#
|
844
|
+
#It's my hope that some people will use this nomenclature to write more efficient solving algorithms than mine. My intent was to reproduce my own thought process when solving, and I am not a speedcuber, I just know one basic way to solve the cube and wanted to see if I could make my program run that same routine (more or less).
|
845
|
+
#
|
846
|
+
#
|
847
|
+
#DATA STRUCTURE:
|
848
|
+
#
|
849
|
+
#The @cube attribute contains 6 arrays of 9 elements, each array describes one side of the cube like so:
|
850
|
+
#
|
851
|
+
# @cube[0] - top
|
852
|
+
# @cube[1] - left
|
853
|
+
# @cube[2] - back
|
854
|
+
# @cube[3] - right
|
855
|
+
# @cube[4] - front
|
856
|
+
# @cube[5] - bottom
|
857
|
+
#
|
858
|
+
#The first element @cube[x][0] in any array describes the center square of that face, and remains static in relation to the other sides, just as a real cube's center square would.
|
859
|
+
#
|
860
|
+
#The remaining array elements from [1] - [8] start at "12 o'clock" and move clockwise. Thus: Even numbers are middle cubies and odd numbers are always corner cubies.
|
861
|
+
#
|
862
|
+
# |8|1|2|
|
863
|
+
# |7|0|3|
|
864
|
+
# |6|5|4|
|
865
|
+
#
|
866
|
+
#"12 o'clock" is constant amongst all sides of the cube, and refers to what "north" would be if the cube was unfolded into two dimensions like so:
|
867
|
+
#
|
868
|
+
# 1
|
869
|
+
# 5,4,0,2
|
870
|
+
# 3
|
871
|
+
#
|
872
|
+
#When cube orientation procedures are applied, the "address" of each side remains consistent with the above diagram, even as the sides themselves represent different numbers. (The sides could just as easily be assigned any symbol or string or whatnott, just as long as each side started off all the same thing, the cube would be in a legal state).
|
873
|
+
#
|
874
|
+
#For example: if you created a new cube and then applied Cube#turn, the sides would appear like so:
|
875
|
+
#
|
876
|
+
# 4
|
877
|
+
# 5,3,0,1
|
878
|
+
# 2
|
879
|
+
#
|
880
|
+
#But the address of the location of these sides would remain static. This is so that complex move combinations can be applied to a cube regardless of its orientation to the "viewer."
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubyks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.5
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jeff Fowler
|
@@ -12,8 +11,7 @@ cert_chain: []
|
|
12
11
|
date: 2013-08-22 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: Provides a data structure to represent a Rubik's cube and functionality
|
15
|
-
to perform simple transformations on that cube, in addition to a
|
16
|
-
algorithm.
|
14
|
+
to perform simple transformations on that cube, in addition to a basic solving algorithm.
|
17
15
|
email:
|
18
16
|
- jeff@jeffalanfowler.com
|
19
17
|
executables: []
|
@@ -22,27 +20,27 @@ extra_rdoc_files: []
|
|
22
20
|
files:
|
23
21
|
- lib/rubyks.rb
|
24
22
|
homepage: http://github.com/urthbound/rubyks
|
25
|
-
licenses:
|
23
|
+
licenses:
|
24
|
+
- MIT
|
25
|
+
metadata: {}
|
26
26
|
post_install_message:
|
27
27
|
rdoc_options: []
|
28
28
|
require_paths:
|
29
29
|
- lib
|
30
30
|
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
-
none: false
|
32
31
|
requirements:
|
33
32
|
- - ! '>='
|
34
33
|
- !ruby/object:Gem::Version
|
35
34
|
version: '0'
|
36
35
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
37
|
-
none: false
|
38
36
|
requirements:
|
39
37
|
- - ! '>='
|
40
38
|
- !ruby/object:Gem::Version
|
41
39
|
version: '0'
|
42
40
|
requirements: []
|
43
41
|
rubyforge_project:
|
44
|
-
rubygems_version:
|
42
|
+
rubygems_version: 2.0.7
|
45
43
|
signing_key:
|
46
|
-
specification_version:
|
44
|
+
specification_version: 4
|
47
45
|
summary: Rubik's cube model and simple solving algorithm
|
48
46
|
test_files: []
|