added sequence code generation
This commit is contained in:
parent
bfee51eff4
commit
0fd62dca81
141
dist/tetrion.js
vendored
141
dist/tetrion.js
vendored
@ -959,6 +959,17 @@ Tetris.prototype = {
|
|||||||
document.getElementById("Openers").appendChild(newOpener);
|
document.getElementById("Openers").appendChild(newOpener);
|
||||||
|
|
||||||
|
|
||||||
|
// Print Sequence Data to console
|
||||||
|
console.log("this.hintQueue = new Array(");
|
||||||
|
this.shapeQueue.slice().reverse().forEach( function(shape, idx) { console.log("shapes.getShape("+shape.nType()+"),"); } );
|
||||||
|
|
||||||
|
console.log("var hintDataList = [");
|
||||||
|
var shapes = [];
|
||||||
|
this.shapeQueue.slice().reverse().forEach( function(shape, idx) { shapes.push(shape.x); shapes.push(shape.y); shapes.push(shape.state); } );
|
||||||
|
|
||||||
|
console.log(shapes.join(",") + "];");
|
||||||
|
console.log("this.createHintQueue(hintDataList);");
|
||||||
|
|
||||||
openers.addSequence(this.shapeQueue);
|
openers.addSequence(this.shapeQueue);
|
||||||
//this.setFreePlay();
|
//this.setFreePlay();
|
||||||
this.gameState = consts.GAMESTATES[1];
|
this.gameState = consts.GAMESTATES[1];
|
||||||
@ -1699,6 +1710,46 @@ var openerGenerator = {
|
|||||||
shapes.getShape(3),
|
shapes.getShape(3),
|
||||||
shapes.getShape(3));
|
shapes.getShape(3));
|
||||||
break;
|
break;
|
||||||
|
case 11:
|
||||||
|
this.shapeQueue = new Array(
|
||||||
|
shapes.getShape(0),
|
||||||
|
shapes.getShape(1),
|
||||||
|
shapes.getShape(4),
|
||||||
|
shapes.getShape(5),
|
||||||
|
shapes.getShape(6),
|
||||||
|
shapes.getShape(2),
|
||||||
|
shapes.getShape(3),
|
||||||
|
shapes.getShape(4),
|
||||||
|
shapes.getShape(5),
|
||||||
|
shapes.getShape(6),
|
||||||
|
shapes.getShape(0),
|
||||||
|
shapes.getShape(1),
|
||||||
|
shapes.getShape(2),
|
||||||
|
shapes.getShape(3),
|
||||||
|
shapes.getShape(4),
|
||||||
|
shapes.getShape(5),
|
||||||
|
shapes.getShape(6),
|
||||||
|
shapes.getShape(3),
|
||||||
|
shapes.getShape(0),
|
||||||
|
shapes.getShape(2),
|
||||||
|
shapes.getShape(3),
|
||||||
|
shapes.getShape(4),
|
||||||
|
shapes.getShape(5),
|
||||||
|
shapes.getShape(3),
|
||||||
|
shapes.getShape(4),
|
||||||
|
shapes.getShape(1),
|
||||||
|
shapes.getShape(3),
|
||||||
|
shapes.getShape(4),
|
||||||
|
shapes.getShape(0),
|
||||||
|
shapes.getShape(6));
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
this.shapeQueue = new Array(
|
||||||
|
shapes.getShape(0),
|
||||||
|
shapes.getShape(1),
|
||||||
|
shapes.getShape(2),
|
||||||
|
shapes.getShape(3));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
this.shapeQueue.unshift(utils.deepClone(shapes.randomShape()));
|
this.shapeQueue.unshift(utils.deepClone(shapes.randomShape()));
|
||||||
return;
|
return;
|
||||||
@ -1724,6 +1775,13 @@ var openerGenerator = {
|
|||||||
return mino;
|
return mino;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
createHintQueue(hintDataList) {
|
||||||
|
for(var i = 0; i < this.hintQueue.length; i++) {
|
||||||
|
this.hintQueue[i].x = hintDataList[i * 3];
|
||||||
|
this.hintQueue[i].y = hintDataList[i * 3 + 1];
|
||||||
|
this.hintQueue[i].state = this.hintQueue[i].nextState(hintDataList[i * 3 + 2]);
|
||||||
|
}
|
||||||
|
},
|
||||||
// Hint Tetrimions
|
// Hint Tetrimions
|
||||||
initHint(opener) {
|
initHint(opener) {
|
||||||
if(!this.isHintInit || this.hintQueue == undefined) {
|
if(!this.isHintInit || this.hintQueue == undefined) {
|
||||||
@ -1746,11 +1804,7 @@ var openerGenerator = {
|
|||||||
// position x, position y, orientation, position x,...
|
// position x, position y, orientation, position x,...
|
||||||
var hintDataList = [-1,17,1, 3,18,0, 6,18,0, 5,17,1, 3,17,0, 7,16,0, 1,17,2];
|
var hintDataList = [-1,17,1, 3,18,0, 6,18,0, 5,17,1, 3,17,0, 7,16,0, 1,17,2];
|
||||||
|
|
||||||
for(var i = 0; i < this.hintQueue.length; i++) {
|
this.createHintQueue(hintDataList);
|
||||||
this.hintQueue[i].x = hintDataList[i * 3];
|
|
||||||
this.hintQueue[i].y = hintDataList[i * 3 + 1];
|
|
||||||
this.hintQueue[i].state = this.hintQueue[i].nextState(hintDataList[i * 3 + 2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
@ -1973,6 +2027,50 @@ var openerGenerator = {
|
|||||||
this.hintQueue[i].state = this.hintQueue[i].nextState(hintDataList[i * 3 + 2]);
|
this.hintQueue[i].state = this.hintQueue[i].nextState(hintDataList[i * 3 + 2]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 11:
|
||||||
|
this.hintQueue = new Array(
|
||||||
|
shapes.getShape(0),
|
||||||
|
shapes.getShape(1),
|
||||||
|
shapes.getShape(4),
|
||||||
|
shapes.getShape(5),
|
||||||
|
shapes.getShape(6),
|
||||||
|
shapes.getShape(2),
|
||||||
|
shapes.getShape(3),
|
||||||
|
shapes.getShape(4),
|
||||||
|
shapes.getShape(5),
|
||||||
|
shapes.getShape(6),
|
||||||
|
shapes.getShape(0),
|
||||||
|
shapes.getShape(1),
|
||||||
|
shapes.getShape(2),
|
||||||
|
shapes.getShape(3),
|
||||||
|
shapes.getShape(4),
|
||||||
|
shapes.getShape(5),
|
||||||
|
shapes.getShape(6),
|
||||||
|
shapes.getShape(3),
|
||||||
|
shapes.getShape(0),
|
||||||
|
shapes.getShape(2),
|
||||||
|
shapes.getShape(3),
|
||||||
|
shapes.getShape(4),
|
||||||
|
shapes.getShape(5),
|
||||||
|
shapes.getShape(3),
|
||||||
|
shapes.getShape(4),
|
||||||
|
shapes.getShape(1),
|
||||||
|
shapes.getShape(3),
|
||||||
|
shapes.getShape(4),
|
||||||
|
shapes.getShape(0),
|
||||||
|
shapes.getShape(6));
|
||||||
|
var hintDataList = [3,17,1,6,18,0,1,17,3,5,17,3,2,16,3,-1,17,1,4,15,0,5,13,1,3,14,0,-1,14,3,8,15,3,-1,15,0,0,13,0,6,16,2,0,13,2,4,14,0,2,13,3,6,17,1,7,18,0,3,16,1,7,17,2,6,18,0,1,18,0,-1,17,1,2,16,2,5,17,0,0,15,2,3,15,2,6,15,2,8,16,3];
|
||||||
|
this.createHintQueue(hintDataList);
|
||||||
|
break
|
||||||
|
case 12:
|
||||||
|
this.hintQueue = new Array(
|
||||||
|
shapes.getShape(0),
|
||||||
|
shapes.getShape(1),
|
||||||
|
shapes.getShape(2),
|
||||||
|
shapes.getShape(3));
|
||||||
|
var hintDataList = [3,17,1,6,18,0,5,17,2,1,18,0];
|
||||||
|
this.createHintQueue(hintDataList);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
this.hintQueue.unshift(utils.deepClone(shapes.randomShape()));
|
this.hintQueue.unshift(utils.deepClone(shapes.randomShape()));
|
||||||
return;
|
return;
|
||||||
@ -2913,6 +3011,39 @@ ShapeZR.prototype = {
|
|||||||
},
|
},
|
||||||
resetOrigin: function() {
|
resetOrigin: function() {
|
||||||
this.y = this.originY + 1;
|
this.y = this.originY + 1;
|
||||||
|
},
|
||||||
|
nType: function() {
|
||||||
|
|
||||||
|
switch (this.flag) {
|
||||||
|
case 'L':
|
||||||
|
// shape = new ShapeL();
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
case 'O':
|
||||||
|
//shape = new ShapeO();
|
||||||
|
return 1;
|
||||||
|
break;
|
||||||
|
case 'Z':
|
||||||
|
// shape = new ShapeZ();
|
||||||
|
return 2;
|
||||||
|
break;
|
||||||
|
case 'T':
|
||||||
|
// shape = new ShapeT();
|
||||||
|
return 3;
|
||||||
|
break;
|
||||||
|
case 'LR':
|
||||||
|
// shape = new ShapeLR();
|
||||||
|
return 4;
|
||||||
|
break;
|
||||||
|
case 'ZR':
|
||||||
|
// shape = new ShapeZR();
|
||||||
|
return 5;
|
||||||
|
break;
|
||||||
|
case 'I':
|
||||||
|
// shape = new ShapeI();
|
||||||
|
return 6;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,6 +93,8 @@ this.resizebg();
|
|||||||
</ul>
|
</ul>
|
||||||
<ul style="font-size:13px;color:dodgerblue;text-align:left;padding-left:1em;" id="EarlyLOrJPiece">Early L or J Piece:
|
<ul style="font-size:13px;color:dodgerblue;text-align:left;padding-left:1em;" id="EarlyLOrJPiece">Early L or J Piece:
|
||||||
<li style="font-size:12px;padding-left:1em";><a href="#" id="setDTCannonVar">DT Cannon (LS / JZ base)</a></li>
|
<li style="font-size:12px;padding-left:1em";><a href="#" id="setDTCannonVar">DT Cannon (LS / JZ base)</a></li>
|
||||||
|
<li style="font-size:12px;padding-left:1em";><a href="#" id="setDTCannonLHVar">DT Cannon LH (LS / JZ base)</a></li>
|
||||||
|
<li style="font-size:12px;padding-left:1em";><a href="#" id="TestSequence">Test Sequence</a></li>
|
||||||
<li style="font-size:12px;padding-left:1em";><a href="#" id="setMKOStackingVar">MKO Stacking</a></li>
|
<li style="font-size:12px;padding-left:1em";><a href="#" id="setMKOStackingVar">MKO Stacking</a></li>
|
||||||
<li style="font-size:12px;padding-left:1em";><a href="#" id="setPokeminosSTDVar">Pokemino's STD </a></li>
|
<li style="font-size:12px;padding-left:1em";><a href="#" id="setPokeminosSTDVar">Pokemino's STD </a></li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -190,6 +192,8 @@ this.resizebg();
|
|||||||
document.getElementById("setNumberOneVar").addEventListener("click", function() { tetrion.setCurrentOpener(8); } );
|
document.getElementById("setNumberOneVar").addEventListener("click", function() { tetrion.setCurrentOpener(8); } );
|
||||||
document.getElementById("setPelicanVar").addEventListener("click", function() { tetrion.setCurrentOpener(9); } );
|
document.getElementById("setPelicanVar").addEventListener("click", function() { tetrion.setCurrentOpener(9); } );
|
||||||
document.getElementById("setDTCannonTSZbaseVar").addEventListener("click", function() { tetrion.setCurrentOpener(10); } );
|
document.getElementById("setDTCannonTSZbaseVar").addEventListener("click", function() { tetrion.setCurrentOpener(10); } );
|
||||||
|
document.getElementById("setDTCannonLHVar").addEventListener("click", function() { tetrion.setCurrentOpener(11); } );
|
||||||
|
document.getElementById("TestSequence").addEventListener("click", function() { tetrion.setCurrentOpener(12); } );
|
||||||
|
|
||||||
document.getElementById("enablegamepad").addEventListener("click", function() { tetrion.toggleGamepad(); } );
|
document.getElementById("enablegamepad").addEventListener("click", function() { tetrion.toggleGamepad(); } );
|
||||||
|
|
||||||
|
11
src/main.js
11
src/main.js
@ -275,6 +275,17 @@ Tetris.prototype = {
|
|||||||
document.getElementById("Openers").appendChild(newOpener);
|
document.getElementById("Openers").appendChild(newOpener);
|
||||||
|
|
||||||
|
|
||||||
|
// Print Sequence Data to console
|
||||||
|
console.log("this.hintQueue = new Array(");
|
||||||
|
this.shapeQueue.slice().reverse().forEach( function(shape, idx) { console.log("shapes.getShape("+shape.nType()+"),"); } );
|
||||||
|
|
||||||
|
console.log("var hintDataList = [");
|
||||||
|
var shapes = [];
|
||||||
|
this.shapeQueue.slice().reverse().forEach( function(shape, idx) { shapes.push(shape.x); shapes.push(shape.y); shapes.push(shape.state); } );
|
||||||
|
|
||||||
|
console.log(shapes.join(",") + "];");
|
||||||
|
console.log("this.createHintQueue(hintDataList);");
|
||||||
|
|
||||||
openers.addSequence(this.shapeQueue);
|
openers.addSequence(this.shapeQueue);
|
||||||
//this.setFreePlay();
|
//this.setFreePlay();
|
||||||
this.gameState = consts.GAMESTATES[1];
|
this.gameState = consts.GAMESTATES[1];
|
||||||
|
@ -172,6 +172,46 @@ var openerGenerator = {
|
|||||||
shapes.getShape(3),
|
shapes.getShape(3),
|
||||||
shapes.getShape(3));
|
shapes.getShape(3));
|
||||||
break;
|
break;
|
||||||
|
case 11:
|
||||||
|
this.shapeQueue = new Array(
|
||||||
|
shapes.getShape(0),
|
||||||
|
shapes.getShape(1),
|
||||||
|
shapes.getShape(4),
|
||||||
|
shapes.getShape(5),
|
||||||
|
shapes.getShape(6),
|
||||||
|
shapes.getShape(2),
|
||||||
|
shapes.getShape(3),
|
||||||
|
shapes.getShape(4),
|
||||||
|
shapes.getShape(5),
|
||||||
|
shapes.getShape(6),
|
||||||
|
shapes.getShape(0),
|
||||||
|
shapes.getShape(1),
|
||||||
|
shapes.getShape(2),
|
||||||
|
shapes.getShape(3),
|
||||||
|
shapes.getShape(4),
|
||||||
|
shapes.getShape(5),
|
||||||
|
shapes.getShape(6),
|
||||||
|
shapes.getShape(3),
|
||||||
|
shapes.getShape(0),
|
||||||
|
shapes.getShape(2),
|
||||||
|
shapes.getShape(3),
|
||||||
|
shapes.getShape(4),
|
||||||
|
shapes.getShape(5),
|
||||||
|
shapes.getShape(3),
|
||||||
|
shapes.getShape(4),
|
||||||
|
shapes.getShape(1),
|
||||||
|
shapes.getShape(3),
|
||||||
|
shapes.getShape(4),
|
||||||
|
shapes.getShape(0),
|
||||||
|
shapes.getShape(6));
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
this.shapeQueue = new Array(
|
||||||
|
shapes.getShape(0),
|
||||||
|
shapes.getShape(1),
|
||||||
|
shapes.getShape(2),
|
||||||
|
shapes.getShape(3));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
this.shapeQueue.unshift(utils.deepClone(shapes.randomShape()));
|
this.shapeQueue.unshift(utils.deepClone(shapes.randomShape()));
|
||||||
return;
|
return;
|
||||||
@ -197,6 +237,13 @@ var openerGenerator = {
|
|||||||
return mino;
|
return mino;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
createHintQueue(hintDataList) {
|
||||||
|
for(var i = 0; i < this.hintQueue.length; i++) {
|
||||||
|
this.hintQueue[i].x = hintDataList[i * 3];
|
||||||
|
this.hintQueue[i].y = hintDataList[i * 3 + 1];
|
||||||
|
this.hintQueue[i].state = this.hintQueue[i].nextState(hintDataList[i * 3 + 2]);
|
||||||
|
}
|
||||||
|
},
|
||||||
// Hint Tetrimions
|
// Hint Tetrimions
|
||||||
initHint(opener) {
|
initHint(opener) {
|
||||||
if(!this.isHintInit || this.hintQueue == undefined) {
|
if(!this.isHintInit || this.hintQueue == undefined) {
|
||||||
@ -219,11 +266,7 @@ var openerGenerator = {
|
|||||||
// position x, position y, orientation, position x,...
|
// position x, position y, orientation, position x,...
|
||||||
var hintDataList = [-1,17,1, 3,18,0, 6,18,0, 5,17,1, 3,17,0, 7,16,0, 1,17,2];
|
var hintDataList = [-1,17,1, 3,18,0, 6,18,0, 5,17,1, 3,17,0, 7,16,0, 1,17,2];
|
||||||
|
|
||||||
for(var i = 0; i < this.hintQueue.length; i++) {
|
this.createHintQueue(hintDataList);
|
||||||
this.hintQueue[i].x = hintDataList[i * 3];
|
|
||||||
this.hintQueue[i].y = hintDataList[i * 3 + 1];
|
|
||||||
this.hintQueue[i].state = this.hintQueue[i].nextState(hintDataList[i * 3 + 2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
@ -446,6 +489,50 @@ var openerGenerator = {
|
|||||||
this.hintQueue[i].state = this.hintQueue[i].nextState(hintDataList[i * 3 + 2]);
|
this.hintQueue[i].state = this.hintQueue[i].nextState(hintDataList[i * 3 + 2]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 11:
|
||||||
|
this.hintQueue = new Array(
|
||||||
|
shapes.getShape(0),
|
||||||
|
shapes.getShape(1),
|
||||||
|
shapes.getShape(4),
|
||||||
|
shapes.getShape(5),
|
||||||
|
shapes.getShape(6),
|
||||||
|
shapes.getShape(2),
|
||||||
|
shapes.getShape(3),
|
||||||
|
shapes.getShape(4),
|
||||||
|
shapes.getShape(5),
|
||||||
|
shapes.getShape(6),
|
||||||
|
shapes.getShape(0),
|
||||||
|
shapes.getShape(1),
|
||||||
|
shapes.getShape(2),
|
||||||
|
shapes.getShape(3),
|
||||||
|
shapes.getShape(4),
|
||||||
|
shapes.getShape(5),
|
||||||
|
shapes.getShape(6),
|
||||||
|
shapes.getShape(3),
|
||||||
|
shapes.getShape(0),
|
||||||
|
shapes.getShape(2),
|
||||||
|
shapes.getShape(3),
|
||||||
|
shapes.getShape(4),
|
||||||
|
shapes.getShape(5),
|
||||||
|
shapes.getShape(3),
|
||||||
|
shapes.getShape(4),
|
||||||
|
shapes.getShape(1),
|
||||||
|
shapes.getShape(3),
|
||||||
|
shapes.getShape(4),
|
||||||
|
shapes.getShape(0),
|
||||||
|
shapes.getShape(6));
|
||||||
|
var hintDataList = [3,17,1,6,18,0,1,17,3,5,17,3,2,16,3,-1,17,1,4,15,0,5,13,1,3,14,0,-1,14,3,8,15,3,-1,15,0,0,13,0,6,16,2,0,13,2,4,14,0,2,13,3,6,17,1,7,18,0,3,16,1,7,17,2,6,18,0,1,18,0,-1,17,1,2,16,2,5,17,0,0,15,2,3,15,2,6,15,2,8,16,3];
|
||||||
|
this.createHintQueue(hintDataList);
|
||||||
|
break
|
||||||
|
case 12:
|
||||||
|
this.hintQueue = new Array(
|
||||||
|
shapes.getShape(0),
|
||||||
|
shapes.getShape(1),
|
||||||
|
shapes.getShape(2),
|
||||||
|
shapes.getShape(3));
|
||||||
|
var hintDataList = [3,17,1,6,18,0,5,17,2,1,18,0];
|
||||||
|
this.createHintQueue(hintDataList);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
this.hintQueue.unshift(utils.deepClone(shapes.randomShape()));
|
this.hintQueue.unshift(utils.deepClone(shapes.randomShape()));
|
||||||
return;
|
return;
|
||||||
|
@ -844,6 +844,39 @@ ShapeZR.prototype = {
|
|||||||
},
|
},
|
||||||
resetOrigin: function() {
|
resetOrigin: function() {
|
||||||
this.y = this.originY + 1;
|
this.y = this.originY + 1;
|
||||||
|
},
|
||||||
|
nType: function() {
|
||||||
|
|
||||||
|
switch (this.flag) {
|
||||||
|
case 'L':
|
||||||
|
// shape = new ShapeL();
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
case 'O':
|
||||||
|
//shape = new ShapeO();
|
||||||
|
return 1;
|
||||||
|
break;
|
||||||
|
case 'Z':
|
||||||
|
// shape = new ShapeZ();
|
||||||
|
return 2;
|
||||||
|
break;
|
||||||
|
case 'T':
|
||||||
|
// shape = new ShapeT();
|
||||||
|
return 3;
|
||||||
|
break;
|
||||||
|
case 'LR':
|
||||||
|
// shape = new ShapeLR();
|
||||||
|
return 4;
|
||||||
|
break;
|
||||||
|
case 'ZR':
|
||||||
|
// shape = new ShapeZR();
|
||||||
|
return 5;
|
||||||
|
break;
|
||||||
|
case 'I':
|
||||||
|
// shape = new ShapeI();
|
||||||
|
return 6;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user