Skip to content

Commit

Permalink
improve quality of 2 piece tsd puzzles
Browse files Browse the repository at this point in the history
  • Loading branch information
Spentine committed Jun 28, 2024
1 parent 7ccb7c0 commit 1d16a37
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 45 deletions.
15 changes: 14 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { SRS_mono, SRS_color } from "./stacker/rs.js";
import { GameRenderer } from "./render.js";
import { InputHandler } from "./input.js";
import { gameModes, puzzles } from "./modes.js";
import { puzzleJSONs } from "./puzzles.js";

var userSettings = {
"version": 1,
Expand Down Expand Up @@ -318,6 +319,7 @@ function tickFrameGame() {
if (game.end){
if (game.end.ending === "noPieces") {
console.log("Failed Puzzle " + currentPuzzle);
console.log(JSON.stringify(puzzleJSONs[puzzleSet][currentPuzzle]));
startGameSettings(puzzles[puzzleSet][currentPuzzle].outputData());
} else {
console.log("Passed Puzzle " + currentPuzzle);
Expand Down Expand Up @@ -358,4 +360,15 @@ function tickFrame() {
window.requestAnimationFrame(tickFrame);
document.addEventListener("keydown", function (e) { inputHandler.keyDown(e) });
document.addEventListener("keyup", function (e) { inputHandler.keyUp(e) });
document.addEventListener("DOMContentLoaded", DOMLoaded);
document.addEventListener("DOMContentLoaded", DOMLoaded);

// testing stuff
{
window.skipPuzzle = () => {
startGame({
"mode": "puzzleMode",
"puzzleSet": puzzleSet,
"exceptPuzzles": [currentPuzzle],
});
}
}
44 changes: 18 additions & 26 deletions modes.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
import { SRS_mono, SRS_color } from "./stacker/rs.js";

import {
easyTSDPuzzles,
twoPieceTSDPuzzles,
kaidanTSDPuzzles,
STMBCavePuzzles,
SZPropPuzzles,
donationTSDPuzzles,
MiscPuzzles,
MiscPuzzlesHard,
} from "./puzzles.js";
import { puzzleJSONs } from "./puzzles.js";

// import * as importedPuzzles from "./puzzles.json";

Expand All @@ -27,6 +17,7 @@ function importPuzzlesFromJSON(puzzleSet) {
for (let i=0; i<puzzleSet.length; i++) {
puzzleSet[i] = new Puzzle(puzzleSet[i]);
}
return puzzleSet;
}

const template = {
Expand Down Expand Up @@ -347,24 +338,24 @@ class Puzzle {
}

// use a list once it gets too much
importPuzzlesFromJSON(easyTSDPuzzles);
importPuzzlesFromJSON(twoPieceTSDPuzzles);
importPuzzlesFromJSON(kaidanTSDPuzzles);
importPuzzlesFromJSON(STMBCavePuzzles);
importPuzzlesFromJSON(SZPropPuzzles);
importPuzzlesFromJSON(donationTSDPuzzles);
importPuzzlesFromJSON(MiscPuzzles);
importPuzzlesFromJSON(MiscPuzzlesHard);

mirrorPuzzles(easyTSDPuzzles);
mirrorPuzzles(twoPieceTSDPuzzles);
mirrorPuzzles(kaidanTSDPuzzles);
mirrorPuzzles(STMBCavePuzzles);
mirrorPuzzles(SZPropPuzzles);
mirrorPuzzles(donationTSDPuzzles);
const puzzles = {};

const k = Object.keys(puzzleJSONs)
for (let i=0; i<k.length; i++) {
puzzles[k[i]] = importPuzzlesFromJSON(structuredClone(puzzleJSONs[k[i]]));
}

mirrorPuzzles(puzzles.easyTSDPuzzles);
// mirrorPuzzles(twoPieceTSDPuzzles);
mirrorPuzzles(puzzles.kaidanTSDPuzzles);
mirrorPuzzles(puzzles.STMBCavePuzzles);
mirrorPuzzles(puzzles.SZPropPuzzles);
mirrorPuzzles(puzzles.donationTSDPuzzles);

const mediumTSDPuzzles = [...twoPieceTSDPuzzles, ...kaidanTSDPuzzles, ...STMBCavePuzzles, ...SZPropPuzzles];
puzzles.mediumTSDPuzzles = [...puzzles.twoPieceTSDPuzzles, ...puzzles.kaidanTSDPuzzles, ...puzzles.STMBCavePuzzles, ...puzzles.SZPropPuzzles];

/*
const puzzles = {
"easyTSDPuzzles": easyTSDPuzzles,
"twoPieceTSDPuzzles": twoPieceTSDPuzzles,
Expand All @@ -376,5 +367,6 @@ const puzzles = {
"MiscPuzzles": MiscPuzzles,
"MiscPuzzlesHard": MiscPuzzlesHard,
};
*/

export { Puzzle, gameModes, puzzles };
70 changes: 52 additions & 18 deletions puzzles.js
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,7 @@ const twoPieceTSDPuzzles = [
},
{
"type": "sendLines",
"board": {"board":[[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[1,0,0,0,0,0,0,0,1,1],[1,1,1,1,0,0,0,0,1,1],[1,1,1,1,1,0,0,0,1,1],[1,1,0,1,1,1,1,1,1,1],[1,1,0,1,1,1,1,1,1,1],[1,1,1,0,1,1,1,1,1,1],[1,1,1,1,1,1,0,1,1,1],[1,1,1,1,1,1,0,1,1,1],[1,1,1,1,1,1,1,1,0,1],[1,1,1,1,1,1,1,1,0,1],[1,1,1,1,1,1,1,1,0,1]],"type":"mono"},
"board": {"board":[[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[1,0,0,0,0,0,0,0,0,0],[1,1,1,1,0,0,0,0,1,1],[1,1,1,1,1,0,0,0,1,1],[1,1,1,1,1,0,1,1,1,1],[1,1,1,1,1,0,1,1,1,1],[1,1,1,1,1,1,1,1,1,0],[1,1,1,1,1,1,1,1,1,0],[1,1,1,1,1,1,1,1,1,0],[1,1,1,1,1,1,1,1,1,0],[1,1,1,1,1,1,1,1,1,0],[1,0,1,1,1,1,1,1,1,1],[1,0,1,1,1,1,1,1,1,1],[1,0,1,1,1,1,1,1,1,1]],"type":"mono"},
"pieces": ["J", "I", "T"],
"data": {
"hold": false,
Expand Down Expand Up @@ -1357,7 +1357,7 @@ const twoPieceTSDPuzzles = [
},
{
"type": "sendLines",
"board": {"board":[[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[1,1,0,0,0,0,0,0,0,1],[1,1,1,0,0,0,0,0,0,1],[1,1,1,1,1,1,1,0,1,1],[1,1,1,1,1,1,1,0,1,1],[1,1,1,1,1,1,1,0,1,1],[1,1,1,1,1,0,1,1,1,1],[1,1,1,1,1,1,1,1,1,0],[1,1,1,1,1,1,1,1,1,0],[1,1,1,1,0,1,1,1,1,1],[1,0,1,1,1,1,1,1,1,1],[1,0,1,1,1,1,1,1,1,1],[1,0,1,1,1,1,1,1,1,1]],"type":"mono"},
"board": {"board":[[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,1,1,1],[0,0,0,0,0,0,1,1,1,1],[0,0,0,0,0,0,1,1,1,1],[1,1,1,1,0,1,1,1,1,1],[1,1,1,1,0,1,1,1,1,1],[1,1,1,1,0,1,1,1,1,1],[1,1,1,1,0,1,1,1,1,1],[1,1,1,0,1,1,1,1,1,1],[1,1,1,0,1,1,1,1,1,1],[1,1,1,0,1,1,1,1,1,1],[1,1,1,0,1,1,1,1,1,1]],"type":"mono"},
"pieces": ["J", "Z", "T"],
"data": {
"hold": false,
Expand All @@ -1366,7 +1366,7 @@ const twoPieceTSDPuzzles = [
},
{
"type": "sendLines",
"board": {"board":[[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,1,1],[0,0,0,0,0,1,1,1,1,1],[1,1,1,0,1,1,1,1,1,1],[1,1,1,0,1,1,1,1,1,1],[1,1,1,1,0,1,1,1,1,1],[1,1,1,1,0,1,1,1,1,1],[1,1,1,1,0,1,1,1,1,1],[1,1,1,1,1,1,1,1,0,1],[1,1,1,1,1,1,1,1,0,1],[1,1,1,1,1,1,1,1,0,1],[1,1,1,1,1,1,1,1,0,1],[1,1,1,1,1,1,1,1,0,1],[1,1,1,1,1,1,1,1,0,1],[1,1,1,1,1,1,1,1,0,1],[1,1,1,1,1,1,1,1,0,1]],"type":"mono"},
"board": {"board":[[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,1],[1,0,0,0,0,0,1,1,1,1],[1,1,1,1,0,1,1,1,1,1],[0,1,1,1,1,1,1,1,1,1],[0,1,1,1,1,1,1,1,1,1],[1,1,1,1,1,0,1,1,1,1],[1,1,1,1,1,0,1,1,1,1],[1,1,1,0,1,1,1,1,1,1],[1,1,1,0,1,1,1,1,1,1],[1,1,1,1,1,1,1,1,1,0],[1,1,1,1,1,1,1,1,1,0]],"type":"mono"},
"pieces": ["J", "I", "T"],
"data": {
"hold": false,
Expand All @@ -1387,7 +1387,7 @@ const twoPieceTSDPuzzles = [
},
{
"type": "sendLines",
"board": {"board":[[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,1],[1,0,0,0,0,0,1,1,1,1],[1,1,1,1,0,1,1,1,1,1],[1,1,1,1,0,1,1,1,1,1],[1,1,1,1,1,1,0,1,1,1],[1,1,1,1,1,1,0,1,1,1],[1,1,1,1,1,1,0,1,1,1],[1,1,1,1,1,1,0,1,1,1],[1,1,1,1,1,1,0,1,1,1],[1,1,1,1,1,1,0,1,1,1]],"type":"mono"},
"board": {"board":[[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[1,1,0,0,0,0,0,1,1,1],[1,1,1,1,1,0,1,1,1,1],[0,1,1,1,1,1,1,1,1,1],[0,1,1,1,1,1,1,1,1,1],[0,1,1,1,1,1,1,1,1,1],[0,1,1,1,1,1,1,1,1,1],[0,1,1,1,1,1,1,1,1,1],[0,1,1,1,1,1,1,1,1,1]],"type":"mono"},
"pieces": ["J", "I", "T"],
"data": {
"hold": false,
Expand Down Expand Up @@ -2472,6 +2472,7 @@ const MiscPuzzlesHard = [
}
},

// created by Spentine
{
"type": "sendLines",
"board": {"board":[[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,1,1],[0,0,0,0,0,0,0,0,1,1],[0,0,0,0,0,0,1,1,1,1],[1,0,0,0,0,0,0,1,1,1],[1,1,1,1,0,0,0,1,1,1],[1,1,1,1,1,0,0,1,1,1]],"type":"mono"},
Expand All @@ -2482,12 +2483,24 @@ const MiscPuzzlesHard = [
}
},

// created by Spentine
{ // srs puzzle
"type": "sendLines",
"board": {"board":[[0,0,0,0,0,0,0,0,0,0],[0,1,0,1,0,1,0,0,0,1],[1,0,1,0,1,0,1,0,1,0],[0,1,1,0,0,0,0,0,0,0],[1,0,0,0,0,0,1,0,0,1],[0,1,0,0,1,0,0,0,1,0],[1,0,0,1,0,0,1,0,0,0],[0,1,0,0,0,0,1,0,0,1],[1,0,0,0,1,0,0,0,1,0],[0,1,0,1,0,0,1,0,0,0],[1,0,0,0,0,0,1,0,0,1],[0,1,0,0,1,0,0,0,1,0],[0,1,0,1,0,0,1,0,0,0],[1,0,0,0,0,0,1,0,0,1],[0,0,0,0,1,0,0,0,1,0],[0,0,1,0,0,0,1,0,0,0],[1,0,0,1,0,0,0,0,0,1],[0,0,1,0,1,0,0,0,1,0],[0,0,1,1,1,1,1,1,1,1],[1,0,1,1,1,1,1,1,1,1]],"type":"mono"},
"pieces": ["S"],
"data": {
"hold": false,
"requiredLines": 1,
}
},

];

const MiscPuzzles = [

// created by Spentine
{
// all created by Spentine

{ // TSD
"type": "sendLines",
"board": {"board":[[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,1,1,1,1,1],[0,1,0,0,0,1,1,1,1,1],[1,1,1,0,0,0,1,1,1,1]],"type":"mono"},
"pieces": ["J", "Z", "T"],
Expand All @@ -2497,8 +2510,7 @@ const MiscPuzzles = [
}
},

// created by Spentine
{
{ // TSD
"type": "sendLines",
"board": {"board":[[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,1,1,0,0],[1,1,1,1,0,0,1,1,1,0],[1,1,1,1,1,0,1,1,0,0],[1,1,1,1,1,1,1,1,0,0],[1,1,1,1,1,1,1,1,1,0],[1,1,1,1,1,1,1,1,1,0],[1,1,1,1,1,1,1,1,1,0],[1,1,1,1,1,1,1,1,1,0],[1,1,1,1,1,1,1,1,1,0],[1,1,1,1,1,1,1,1,1,0],[1,1,1,1,1,1,1,1,1,0]],"type":"mono"},
"pieces": ["Z", "J", "T"],
Expand All @@ -2508,6 +2520,26 @@ const MiscPuzzles = [
}
},

{ // PC
"type": "sendLines",
"board": {"board":[[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,1,1,1,1,1,1,1,1],[0,0,0,0,1,1,1,1,1,1],[0,0,0,0,1,1,1,1,1,1],[0,0,1,1,1,1,1,1,1,1]],"type":"mono"},
"pieces": ["J", "S", "J"],
"data": {
"hold": false,
"requiredLines": 10,
}
},

{ // PC iljjltjjjljijli
"type": "sendLines",
"board": {"board":[[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[1,1,1,1,1,0,1,1,1,1],[1,1,1,1,0,1,1,1,1,1],[1,1,1,1,1,1,0,1,1,1],[1,1,1,0,1,1,1,1,1,1],[1,1,1,1,1,1,1,0,1,1],[1,1,0,1,1,1,1,1,1,1],[1,1,1,1,1,1,1,1,0,1],[1,0,1,1,1,1,1,1,1,1],[1,1,1,1,1,1,1,1,1,0],[0,1,1,1,1,1,1,1,1,1]],"type":"mono"},
"pieces": ["I", "L", "J", "J", "L", "T", "J", "J", "J", "L", "J", "I", "J", "L", "I"],
"data": {
"hold": false,
"requiredLines": 41,
}
},

];

const donationTSDPuzzles = [
Expand Down Expand Up @@ -2845,13 +2877,15 @@ const donationTSDPuzzles = [
*/

export {
easyTSDPuzzles,
twoPieceTSDPuzzles,
kaidanTSDPuzzles,
STMBCavePuzzles,
SZPropPuzzles,
donationTSDPuzzles,
MiscPuzzles,
MiscPuzzlesHard,
};
const puzzleJSONs = {
"easyTSDPuzzles": easyTSDPuzzles,
"twoPieceTSDPuzzles": twoPieceTSDPuzzles,
"kaidanTSDPuzzles": kaidanTSDPuzzles,
"STMBCavePuzzles": STMBCavePuzzles,
"SZPropPuzzles": SZPropPuzzles,
"donationTSDPuzzles": donationTSDPuzzles,
"MiscPuzzles": MiscPuzzles,
"MiscPuzzlesHard": MiscPuzzlesHard,
};

export { puzzleJSONs };

0 comments on commit 1d16a37

Please sign in to comment.