diff --git a/src/app/data-source.service.ts b/src/app/data-source.service.ts index 8cb6e8d..c774454 100644 --- a/src/app/data-source.service.ts +++ b/src/app/data-source.service.ts @@ -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; } diff --git a/src/app/puzzle-view/puzzle-view.component.ts b/src/app/puzzle-view/puzzle-view.component.ts index ed724de..63406db 100644 --- a/src/app/puzzle-view/puzzle-view.component.ts +++ b/src/app/puzzle-view/puzzle-view.component.ts @@ -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, }; diff --git a/src/app/shared/puzzle-info.ts b/src/app/shared/puzzle-info.ts index c009431..d2fc497 100644 --- a/src/app/shared/puzzle-info.ts +++ b/src/app/shared/puzzle-info.ts @@ -19,6 +19,7 @@ export class PuzzleInfo { public orthoWidth: number = 12; public edit: Array = []; public islandIndex: number = 0; + public forced?: Array = undefined; getCubes(): Array { let result = new Array(); diff --git a/src/assets/location_cubes.json b/src/assets/location_cubes.json index 7eca38b..f797cac 100644 --- a/src/assets/location_cubes.json +++ b/src/assets/location_cubes.json @@ -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" },