Skip to content

Commit

Permalink
[puzzle-geometry] Allow --vertexmoves for non-tetrahedral puzzles where
Browse files Browse the repository at this point in the history
it is ignored (previously it was generating no useful output in at least
some cases).  Bug reported and patch suggested by Arhan Chaudhary.
  • Loading branch information
rokicki committed Jan 26, 2025
1 parent 2a8f498 commit a0bf3f7
Showing 1 changed file with 31 additions and 28 deletions.
59 changes: 31 additions & 28 deletions src/cubing/puzzle-geometry/PuzzleGeometry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2129,42 +2129,45 @@ export class PuzzleGeometry {
}
r.push(parsedmove[5]);
}
} else if (this.options.vertexMoves && !this.options.allMoves) {
} else {
const msg = this.movesetgeos[k];
if (msg[1] !== msg[3]) {
for (let i = 0; i < slices; i++) {
if (msg[1] !== "v") {
if (this.options.outerBlockMoves) {
r.push([i + 1, slices]);
} else {
r.push([i + 1]);
}
r.push(1);
} else {
if (this.options.outerBlockMoves) {
r.push([0, i]);
const isTetrahedron = msg[1] !== msg[3];
if (this.options.vertexMoves && isTetrahedron && !this.options.allMoves) {
if (msg[1] !== msg[3]) {
for (let i = 0; i < slices; i++) {
if (msg[1] !== "v") {
if (this.options.outerBlockMoves) {
r.push([i + 1, slices]);
} else {
r.push([i + 1]);
}
r.push(1);
} else {
r.push([i, i]);
if (this.options.outerBlockMoves) {
r.push([0, i]);
} else {
r.push([i, i]);
}
r.push(1);
}
r.push(1);
}
}
}
} else {
for (let i = 0; i <= slices; i++) {
if (!this.options.allMoves && i + i === slices) {
continue;
}
if (this.options.outerBlockMoves) {
if (i + i > slices) {
r.push([i, slices]);
} else {
for (let i = 0; i <= slices; i++) {
if (!this.options.allMoves && i + i === slices) {
continue;
}
if (this.options.outerBlockMoves) {
if (i + i > slices) {
r.push([i, slices]);
} else {
r.push([0, i]);
}
} else {
r.push([0, i]);
r.push([i, i]);
}
} else {
r.push([i, i]);
r.push(1);
}
r.push(1);
}
}
if (this.fixedCubie >= 0) {
Expand Down

0 comments on commit a0bf3f7

Please sign in to comment.