Skip to content

Commit

Permalink
Puzzle x16380 (#161)
Browse files Browse the repository at this point in the history
1. Added puzzle
2. Support for Forced answer puzzles

Co-authored-by: Michael Fuller <[email protected]>
  • Loading branch information
mgatelabs and Michael Fuller authored Mar 17, 2022
1 parent c8ec1cf commit 8320a6d
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 2 deletions.
22 changes: 22 additions & 0 deletions src/app/data-source.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,28 @@ export class DataSourceService {
info.locationX = Number(item.x);
info.locationY = y;

if (item.forced) {
info.forced = [];
for (let j = 0; j < item.forced.length; j++) {
let v: number = 0;
switch (item.forced[j]) {
case 'N':
v = 0;
break;
case 'E':
v = 1;
break;
case 'S':
v = 2;
break;
case 'W':
v = 3;
break;
}
info.forced.push(v);
}
}

if (item.camera) {
info.camera = item.camera;
}
Expand Down
8 changes: 7 additions & 1 deletion src/app/puzzle-view/puzzle-view.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,15 @@ export class PuzzleViewComponent implements OnInit, AfterViewInit {
conns.push(sample);
}

let solverFunc = SOLVER.unifiedSolution;

if (this.puzzleInfo!.forced && this.puzzleInfo!.forced.length > 0) {
solverFunc = SOLVER.customSolution(this.puzzleInfo!.forced!);
}

let puzzleDef: SOLVER.PuzzleDefinition = {
initialState: faces,
isFinalState: SOLVER.unifiedSolution,
isFinalState: solverFunc,
maximumNumber: this.puzzleInfo!.type == PuzzleType.SPIN ? 4 : 3,
stateTransitions: conns,
};
Expand Down
1 change: 1 addition & 0 deletions src/app/shared/puzzle-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export class PuzzleInfo {
public orthoWidth: number = 12;
public edit: Array<boolean> = [];
public islandIndex: number = 0;
public forced?: Array<number> = undefined;

getCubes(): Array<PuzzleCube> {
let result = new Array<PuzzleCube>();
Expand Down
21 changes: 20 additions & 1 deletion src/assets/location_cubes.json
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,26 @@
{ "id": "x16440", "x": 284, "y": 6101.5, "island": "wata" },
{ "id": "x16432", "x": 156.5, "y": 6149.5, "island": "wata" },
{ "id": "x16346", "x": 115, "y": 5908, "island": "wata" },
{ "id": "x16380", "x": -196.5, "y": 6126.5, "island": "wata" },
{
"id": "x16380",
"x": -196.5,
"y": 6126.5,
"count": "4",
"type": "SPIN",
"camera": [1, 2.15, 2],
"face": "N",
"description": "This puzzle is located north statue of the seven up on a hill. No chest, it unlocks another puzzle element. Just make every cube face in-ward",
"connection": [[0], [1], [2], [3]],
"direction": ["S", "S", "E", "W"],
"forced": ["N", "E", "S", "W"],
"position": [
[-1, -1, 0.55],
[-4.5, 0.5, -3],
[-1.5, -1, -7],
[3.75, -1.5, -3]
],
"island": "wata"
},
{ "id": "x16384", "x": -103.5, "y": 6172.5, "island": "wata" },
{ "id": "x16415", "x": 67, "y": 6381, "island": "wata" },
{ "id": "x16444", "x": 306.5, "y": 6233.5, "island": "wata" },
Expand Down

0 comments on commit 8320a6d

Please sign in to comment.