Class: TwistyPuzzles::SlashCommutator

Inherits:
PureCommutator show all
Defined in:
lib/twisty_puzzles/commutator.rb

Overview

Slash commutator of the form A B A2 B’ A.

Instance Attribute Summary

Attributes inherited from PureCommutator

#first_part, #second_part

Instance Method Summary collapse

Methods inherited from PureCommutator

#eql?, #hash, #initialize

Methods inherited from Commutator

#cancellations

Constructor Details

This class inherits a constructor from TwistyPuzzles::PureCommutator

Instance Method Details

#algorithmObject



130
131
132
# File 'lib/twisty_puzzles/commutator.rb', line 130

def algorithm
  first_part + second_part + (first_part * 2) + second_part.inverse + first_part
end

#inverseObject



122
123
124
# File 'lib/twisty_puzzles/commutator.rb', line 122

def inverse
  SlashCommutator.new(first_part.inverse, second_part)
end

#to_sObject



126
127
128
# File 'lib/twisty_puzzles/commutator.rb', line 126

def to_s
  "[#{@first_part}/#{@second_part}]"
end