twisty_puzzles 0.0.25 → 0.0.26

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2bdb18c89f68fabb32390a700b044586d879472b35a120fa953daf9dd8fe92c6
4
- data.tar.gz: 59033222dd6581dc53383e05a2f5886aee43beeb93578d2db8a7b455133ad07a
3
+ metadata.gz: fa3e196d509ec1452a947269c43028b2ee5e3be803f4d3bf510ef5c170d01310
4
+ data.tar.gz: 704d10067e79b8d78e3eb5367795200695d4445a44873d198936136568ddc3e4
5
5
  SHA512:
6
- metadata.gz: 0aabba50c1c8d8a5edec9359a06be002fc13bf9a9171578920357eafbbb90d96e82fe8c3f3455e95c70080e1e86d974a9ab260fbc0d7e6827c5c1cd2d9c13086
7
- data.tar.gz: 8c9004e6132a9174c5f1e92c8b116bd3d7cc6158e858bcff762f8b7d42a1656795af73243664b0e4186c212536ac43628820e37a8b9ae9b61f5b4db9d9a2af16
6
+ metadata.gz: 197fc8e07f87b42434f8b126fa9fdcec56a5a47f883d7faf892aecf9c440e01d97c991f15734bdfdda42ee95ca78660f2da7cde1d165c37f2613218532894361
7
+ data.tar.gz: 840a076a049ef64a39c82e4b8f6f9721d71be47bc8a232c278bd7f2cc67bd564e2f4dd566b59d1db14582ec6be2a6b4cc6c6001d2eafe51bcb7ce5335dda3bf9
@@ -20,7 +20,9 @@ module TwistyPuzzles
20
20
  @moves = moves
21
21
  end
22
22
 
23
- EMPTY = Algorithm.new([])
23
+ def self.empty
24
+ Algorithm.new([])
25
+ end
24
26
 
25
27
  # Creates a one move algorithm.
26
28
  def self.move(move)
@@ -43,7 +43,7 @@ module TwistyPuzzles
43
43
  raise TypeError unless algorithm.is_a?(Algorithm)
44
44
 
45
45
  CubeState.check_cube_size(cube_size)
46
- alg = Algorithm::EMPTY
46
+ alg = Algorithm.empty
47
47
  algorithm.moves.each do |m|
48
48
  alg = push_with_cancellation(alg, m, cube_size)
49
49
  end
@@ -107,7 +107,7 @@ module TwistyPuzzles
107
107
  def self.rotation_sequences
108
108
  @rotation_sequences ||=
109
109
  begin
110
- trivial_rotation_algs = [Algorithm::EMPTY]
110
+ trivial_rotation_algs = [Algorithm.empty]
111
111
  single_rotation_algs = Rotation::NON_ZERO_ROTATIONS.map { |e| Algorithm.move(e) }
112
112
  combined_rotation_algs = self.combined_rotation_algs
113
113
  rotation_algs = trivial_rotation_algs + single_rotation_algs + combined_rotation_algs
@@ -57,7 +57,7 @@ module TwistyPuzzles
57
57
  end
58
58
 
59
59
  def colors
60
- @face_symbols_to_colors.values
60
+ @face_symbols_to_colors.to_a.sort_by(&:first).map(&:last)
61
61
  end
62
62
 
63
63
  def turned(top_color, front_color)
@@ -173,6 +173,10 @@ module TwistyPuzzles
173
173
  @native = native
174
174
  end
175
175
 
176
+ def to_s
177
+ "#{self.class}(#{face}, #{cube_size}, #{x}, #{y})"
178
+ end
179
+
176
180
  attr_reader :native
177
181
 
178
182
  def face
@@ -286,7 +286,7 @@ module TwistyPuzzles
286
286
  # lie where the given other face currently is.
287
287
  def rotation_to(other)
288
288
  if other == self
289
- Algorithm::EMPTY
289
+ Algorithm.empty
290
290
  else
291
291
  # There can be multiple solutions.
292
292
  axis_face =
@@ -470,7 +470,6 @@ module TwistyPuzzles
470
470
  # Represents one wing or the position of one wing on the cube.
471
471
  class Wing < Part
472
472
  extend EdgeLike
473
- WING_BASE_INDEX_INVERTED_FACE_SYMBOLS = %i[U R B].freeze
474
473
  FACES = 2
475
474
 
476
475
  ELEMENTS = generate_parts
@@ -543,8 +542,7 @@ module TwistyPuzzles
543
542
 
544
543
  # One index of such a piece on a on a NxN face.
545
544
  def base_index_on_other_face(face, _cube_size, incarnation_index)
546
- # TODO: Make this more elegant than hardcoding
547
- inverse = WING_BASE_INDEX_INVERTED_FACE_SYMBOLS.include?(face.face_symbol)
545
+ inverse = face.piece_index.even?
548
546
  coordinates = [0, 1 + incarnation_index]
549
547
  inverse ? coordinates.reverse : coordinates
550
548
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TwistyPuzzles
4
- VERSION = '0.0.25'
4
+ VERSION = '0.0.26'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twisty_puzzles
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.25
4
+ version: 0.0.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernhard F. Brodowsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-10 00:00:00.000000000 Z
11
+ date: 2021-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize