Class: TwistyPuzzles::CompiledSkewbAlgorithm

Inherits:
CompiledAlgorithm show all
Defined in:
lib/twisty_puzzles/compiled_skewb_algorithm.rb

Overview

Wrapper of the native C implementation of a compiled algorithm for a particular cube size.

Constant Summary collapse

NATIVE_CLASS =
Native::SkewbAlgorithm
EMPTY =
for_moves([])

Instance Attribute Summary

Attributes inherited from CompiledAlgorithm

#inverse, #native

Class Method Summary collapse

Methods inherited from CompiledAlgorithm

#+, #apply_to, #initialize, #mirror, #rotate_by

Methods included from ReversibleApplyable

#apply_temporarily_to, #apply_to_dupped

Constructor Details

This class inherits a constructor from TwistyPuzzles::CompiledAlgorithm

Class Method Details

.for_moves(moves) ⇒ Object



19
20
21
22
# File 'lib/twisty_puzzles/compiled_skewb_algorithm.rb', line 19

def self.for_moves(moves)
  native = Native::SkewbAlgorithm.new(moves.map { |m| transform_move(m) })
  new(native)
end

.transform_move(move) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/twisty_puzzles/compiled_skewb_algorithm.rb', line 8

def self.transform_move(move)
  case move
  when Rotation
    [:rotation, move.axis_face.face_symbol, move.direction.value]
  when SkewbMove
    [:move, move.axis_corner.face_symbols, move.direction.value]
  else
    raise TypeError
  end
end