Class: TwistyPuzzles::CubeDirection

Inherits:
AbstractDirection show all
Defined in:
lib/twisty_puzzles/cube_direction.rb

Overview

Represents the direction of a cube move or rotation.

Constant Summary collapse

NUM_DIRECTIONS =
4
NON_ZERO_DIRECTIONS =
(1...NUM_DIRECTIONS).map { |d| new(d) }.freeze
ALL_DIRECTIONS =
Array.new(NUM_DIRECTIONS) { |d| new(d) }.freeze
ZERO =
new(0)
FORWARD =
new(1)
DOUBLE =
new(2)
BACKWARD =
new(3)

Constants inherited from AbstractDirection

AbstractDirection::POSSIBLE_DIRECTION_NAMES, AbstractDirection::POSSIBLE_SKEWB_DIRECTION_NAMES, AbstractDirection::SIMPLE_DIRECTION_NAMES, AbstractDirection::SIMPLE_SKEWB_DIRECTION_NAMES

Instance Attribute Summary

Attributes inherited from AbstractDirection

#value

Instance Method Summary collapse

Methods inherited from AbstractDirection

#+, #<=>, #eql?, #hash, #initialize, #inverse, #non_zero?, #zero?

Constructor Details

This class inherits a constructor from TwistyPuzzles::AbstractDirection

Instance Method Details

#double_move?Boolean

Returns:

  • (Boolean)


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

def double_move?
  @value == 2
end

#nameObject



16
17
18
# File 'lib/twisty_puzzles/cube_direction.rb', line 16

def name
  SIMPLE_DIRECTION_NAMES[@value]
end