Class: RubiksCube::TwoCycleSolution
- Defined in:
- lib/rubiks_cube/two_cycle_solution.rb
Overview
Very inefficient two-cycle solving algorithm (aka bicycle solution) Useful for learning and blindfold
Instance Attribute Summary
Attributes inherited from Solution
Instance Method Summary collapse
Methods inherited from Solution
#initialize, #length, #solved?, #state
Constructor Details
This class inherits a constructor from RubiksCube::Solution
Instance Method Details
#pretty ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/rubiks_cube/two_cycle_solution.rb', line 14 def pretty solution.each_slice(3).map do |setup, correction, undo| step = [] step << "Setup:\t#{setup}" unless setup.empty? step << "Fix:\t#{correction}" step << "Undo:\t#{undo}" unless undo.empty? step.join "\n" end.join("\n\n").strip end |
#solution ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/rubiks_cube/two_cycle_solution.rb', line 5 def solution @solution ||= begin solution = [] solution << solution_for(:permutation) solution << solution_for(:orientation) solution.flatten end end |