Class: TwistyPuzzles::XCenter

Inherits:
MoveableCenter show all
Defined in:
lib/twisty_puzzles/cube.rb

Overview

Represents one X center or the position of one X center on the cube.

Constant Summary collapse

CORRESPONDING_PART_CLASS =
Corner
ELEMENTS =
generate_parts

Constants inherited from MoveableCenter

MoveableCenter::FACES

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 MoveableCenter

#corresponding_part

Attributes inherited from Part

#face_symbols, #piece_index

Instance Method Summary collapse

Methods inherited from MoveableCenter

#eql?, #face_symbol, for_face_symbols, generate_parts, #initialize, #inspect, max_parseable_face_symbols, min_cube_size, min_parseable_face_symbols, #neighbor?, #neighbors, #rotate_by, valid?

Methods inherited from Part

#<=>, #base_index_on_face, #corresponding_part, #eql?, exists_on_cube_size?, exists_on_even_cube_sizes?, 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_cube_size, 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::MoveableCenter

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.



677
678
679
# File 'lib/twisty_puzzles/cube.rb', line 677

def base_index_on_other_face(_face, _cube_size, incarnation_index)
  [1 + incarnation_index, 1 + incarnation_index]
end

#num_incarnations(cube_size) ⇒ Object



672
673
674
# File 'lib/twisty_puzzles/cube.rb', line 672

def num_incarnations(cube_size)
  cube_size > 3 ? (cube_size / 2) - 1 : 0
end