Class: TwistyPuzzles::FatMSliceMove

Inherits:
CubeMove show all
Includes:
MSlicePrintHelper
Defined in:
lib/twisty_puzzles/cube_move.rb

Overview

A fat M slice move that moves everything but the outer layers.

Constant Summary

Constants inherited from AbstractMove

AbstractMove::AXES, AbstractMove::MOVE_METRICS, AbstractMove::SLICE_FACES, AbstractMove::SLICE_NAMES

Instance Attribute Summary

Attributes inherited from AxisFaceAndDirectionMove

#axis_face, #direction

Instance Method Summary collapse

Methods included from MSlicePrintHelper

#to_s

Methods inherited from CubeMove

#puzzles

Methods inherited from AxisFaceAndDirectionMove

#can_swap?, #canonical_direction, #identifying_fields, #initialize, #mirror, #rotate_by, #same_axis?, #swap_internal, #translated_direction

Methods inherited from AbstractMove

#<=>, #can_swap?, check_move_metric, #decide_meaning, #direction, #eql?, #equivalent?, #hash, #identifying_fields, #identity?, #inverse, #join_with_cancellation, #mirror, #move_count, #prepend_inner_m_slice_move, #puzzles, #rotate_by, #swap, #swap_internal

Methods included from Utils::ArrayHelper

#apply_permutation, #check_types, #find_only, #only, #replace_once, #rotate_out_nils, #turned_equals?

Methods included from Utils::StringHelper

#camel_case_to_snake_case, #format_time, #simple_class_name, #snake_case_class_name

Constructor Details

This class inherits a constructor from TwistyPuzzles::AxisFaceAndDirectionMove

Instance Method Details

#equivalent_internal?(other, cube_size) ⇒ Boolean

Returns:

  • (Boolean)


56
57
58
59
60
61
62
63
64
65
# File 'lib/twisty_puzzles/cube_move.rb', line 56

def equivalent_internal?(other, cube_size)
  case other
  when SliceMove
    return equivalent_slice_move?(other, cube_size)
  when FatMSliceMove
    return @axis_face == other.axis_face.opposite && @direction == other.direction.inverse
  end

  false
end

#prepend_fat_m_slice_move(other, _cube_size) ⇒ Object



35
36
37
38
39
40
# File 'lib/twisty_puzzles/cube_move.rb', line 35

def prepend_fat_m_slice_move(other, _cube_size)
  return unless same_axis?(other)

  other_direction = other.translated_direction(@axis_face)
  Algorithm.move(FatMSliceMove.new(@axis_face, @direction + other_direction))
end

#prepend_fat_move(other, cube_size) ⇒ Object



42
43
44
45
46
# File 'lib/twisty_puzzles/cube_move.rb', line 42

def prepend_fat_move(other, cube_size)
  # Note that changing the order is safe because that method returns nil if no cancellation
  # can be performed.
  other.prepend_fat_m_slice_move(self, cube_size)
end

#prepend_rotation(_other, _cube_size) ⇒ Object



31
32
33
# File 'lib/twisty_puzzles/cube_move.rb', line 31

def prepend_rotation(_other, _cube_size)
  nil
end

#prepend_slice_move(_other, _cube_size) ⇒ Object



48
49
50
# File 'lib/twisty_puzzles/cube_move.rb', line 48

def prepend_slice_move(_other, _cube_size)
  nil
end

#slice_move?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/twisty_puzzles/cube_move.rb', line 52

def slice_move?
  true
end