Class: TwistyPuzzles::Midge

Inherits:
Part
  • Object
show all
Extended by:
EdgeLike
Defined in:
lib/twisty_puzzles/cube.rb

Overview

Represents one midge or the position of one midge on the cube.

Constant Summary collapse

FACES =
2
ELEMENTS =
generate_parts

Constants included from CubeConstants

CubeConstants::ALPHABET_SIZE, CubeConstants::CHIRALITY_FACE_SYMBOLS, CubeConstants::FACE_NAMES, CubeConstants::FACE_SYMBOLS, CubeConstants::OPPOSITE_FACE_SYMBOLS, CubeConstants::SKEWB_STICKERS

Instance Attribute Summary

Attributes inherited from Part

#face_symbols, #piece_index

Class Method Summary collapse

Instance Method Summary collapse

Methods included from EdgeLike

valid?

Methods inherited from Part

#<=>, #base_index_on_face, #corresponding_part, #eql?, exists_on_cube_size?, exists_on_odd_cube_sizes?, #faces, for_face_symbols, for_face_symbols_internal, for_index, generate_parts, #hash, #initialize, #inspect, max_cube_size, max_parseable_face_symbols, min_parseable_face_symbols, #mirror, parse, #rotate_by, #rotate_by_rotation, #rotate_face_symbol_up, #rotate_face_up, #rotations, #solved_coordinate, #solved_face, #to_s, #turned_equals?, valid?

Methods included from Utils::ArrayHelper

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

Methods included from CubeConstants

#chirality_canonical_face_symbol, #opposite_face_symbol, #valid_chirality?

Constructor Details

This class inherits a constructor from TwistyPuzzles::Part

Class Method Details

.exists_on_even_cube_sizes?Boolean

Returns:

  • (Boolean)


488
489
490
# File 'lib/twisty_puzzles/cube.rb', line 488

def self.exists_on_even_cube_sizes?
  false
end

.min_cube_sizeObject



484
485
486
# File 'lib/twisty_puzzles/cube.rb', line 484

def self.min_cube_size
  5
end

Instance Method Details

#base_index_on_other_face(_face, cube_size, _incarnation_index) ⇒ Object

One index of such a piece on a on a NxN face.



493
494
495
# File 'lib/twisty_puzzles/cube.rb', line 493

def base_index_on_other_face(_face, cube_size, _incarnation_index)
  [0, Coordinate.middle(cube_size)]
end

#num_incarnations(cube_size) ⇒ Object



497
498
499
# File 'lib/twisty_puzzles/cube.rb', line 497

def num_incarnations(cube_size)
  cube_size >= 5 && cube_size.odd? ? 1 : 0
end