bt cannon

main
PolicyChanges1@gmail.com 2021-03-22 20:33:47 -04:00
parent b9e575ecbd
commit fa37f623f1
5 changed files with 132 additions and 148 deletions

72
dist/tetrion.js vendored
View File

@ -959,26 +959,40 @@ Tetris.prototype = {
document.getElementById("Openers").appendChild(newOpener);
// Print Sequence Data to console
console.log("this.hintQueue = new Array(");
this.shapeQueue.slice().reverse().forEach( function(shape, idx, arr) { console.log("shapes.getShape("+shape.nType()+ ((idx === arr.length-1) ? "));" : "),") ); } );
// console.log("this.hintQueue = new Array(");
// this.shapeQueue.slice().reverse().forEach( function(shape, idx, arr) { console.log("shapes.getShape("+shape.nType()+ ((idx === arr.length-1) ? "));" : "),") ); } );
var shapes = [];
this.shapeQueue.slice().reverse().forEach( function(shape, idx) { shapes.push(shape.x); shapes.push(shape.y); shapes.push(shape.state); } );
console.log("var hintDataList = [" + shapes.join(",") + "];");
console.log("this.createHintQueue(hintDataList);");
// console.log("var hintDataList = [" + shapes.join(",") + "];");
// console.log("this.createHintQueue(hintDataList);");
openers.addSequence(this.shapeQueue);
var sequenceCode = [];
var shapeArrayStr = [];
this.shapeQueue.slice().reverse().forEach( function(shape, idx, arr) { shapeArrayStr += "shapes.getShape("+shape.nType() + ((idx === arr.length-1) ? "));" : "), ") } );
sequenceCode += "case :\n\tthis.shapeQueue = new Array(" + shapeArrayStr + "\nbreak;" + "\n\n";
sequenceCode += "case :\n\tthis.hintQueue = new Array(" + shapeArrayStr;
sequenceCode += "\n\nvar hintDataList = [" + shapes.join(",") + "];" + "\nthis.createHintQueue(hintDataList);" + "\nbreak;";
prompt("Generated Code:", sequenceCode);
//openers.addSequence(this.shapeQueue);
//this.setFreePlay();
this.gameState = consts.GAMESTATES[1];
//this.gameState = consts.GAMESTATES[1];
this.currentMinoInx = 0;
//this.setCurrentOpener(99999);//this.currentMinoInx);
clearMatrix(this.matrix);
this.currentOpener = 9999;
this.shapeQueue = [];
this.hintQueue = [];
this._recurseGameState();
//this._recurseGameState();
},
setSettings: function() {
var newVal = document.getElementById("setting_value").value;
@ -1003,7 +1017,6 @@ Tetris.prototype = {
this.levelTime = this.startTime;
this.prevInputTime = this.startTime;
// current tetrino index gets set to 0 at the end of opener sequence
//if(this.currentMinoInx == undefined || this.currentMinoInx < 1000) // todo: refactor -- seppuku worthy
this.currentMinoInx = 0;
this.shapeQueue = [];
this.hintQueue = [];
@ -1749,6 +1762,10 @@ var openerGenerator = {
shapes.getShape(2),
shapes.getShape(3));
break;
case 13:
this.shapeQueue = new Array(shapes.getShape(4), shapes.getShape(6), shapes.getShape(1), shapes.getShape(2), shapes.getShape(3), shapes.getShape(5), shapes.getShape(0), shapes.getShape(1), shapes.getShape(0), shapes.getShape(6), shapes.getShape(0), shapes.getShape(5), shapes.getShape(4), shapes.getShape(3), shapes.getShape(4), shapes.getShape(3), shapes.getShape(4));
break;
default:
this.shapeQueue.unshift(utils.deepClone(shapes.randomShape()));
return;
@ -2070,6 +2087,12 @@ var openerGenerator = {
var hintDataList = [3,17,1,6,18,0,5,17,2,1,18,0];
this.createHintQueue(hintDataList);
break;
case 13:
this.hintQueue = new Array(shapes.getShape(4), shapes.getShape(6), shapes.getShape(1), shapes.getShape(2), shapes.getShape(3), shapes.getShape(5), shapes.getShape(0), shapes.getShape(1), shapes.getShape(0), shapes.getShape(6), shapes.getShape(0), shapes.getShape(5), shapes.getShape(4), shapes.getShape(3), shapes.getShape(4), shapes.getShape(3), shapes.getShape(4));
var hintDataList = [0,18,0,3,18,0,-1,17,0,7,18,0,3,17,0,8,16,3,0,15,2,-2,14,0,3,15,2,3,14,0,1,13,3,8,14,3,7,12,2,5,16,2,3,14,3,6,17,3,5,18,0];
this.createHintQueue(hintDataList);
break;
default:
this.hintQueue.unshift(utils.deepClone(shapes.randomShape()));
return;
@ -2375,38 +2398,7 @@ function ShapeO() {
}
function ShapeI() {
/* // North
var state1 = [
[1, 0, 0, 0],
[1, 0, 0, 0],
[1, 0, 0, 0],
[1, 0, 0, 0]
];
// East
var state2 = [
[0, 0, 0, 0],
[0, 0, 0, 0],
[1, 1, 1, 1],
[0, 0, 0, 0]
];
// South
var state3 = [
[0, 0, 1, 0],
[0, 0, 1, 0],
[0, 0, 1, 0],
[0, 0, 1, 0]
];
// West
var state4 = [
[0, 0, 0, 0],
[1, 1, 1, 1],
[0, 0, 0, 0],
[0, 0, 0, 0]
];
*/
// North
var state1 = [
[0, 0, 0, 0],
@ -3120,8 +3112,6 @@ function randomShape() {
}
function getShape(shapei) {
var result = shapei
var shape;

View File

@ -194,6 +194,10 @@ this.resizebg();
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("setStdPCOpenerVar").addEventListener("click", function() { tetrion.setCurrentOpener(13); } );
document.getElementById("setBTCannonVar").addEventListener("click", function() { tetrion.setCurrentOpener(13); } );
document.getElementById("enablegamepad").addEventListener("click", function() { tetrion.toggleGamepad(); } );

View File

@ -275,26 +275,40 @@ Tetris.prototype = {
document.getElementById("Openers").appendChild(newOpener);
// Print Sequence Data to console
console.log("this.hintQueue = new Array(");
this.shapeQueue.slice().reverse().forEach( function(shape, idx, arr) { console.log("shapes.getShape("+shape.nType()+ ((idx === arr.length-1) ? "));" : "),") ); } );
// console.log("this.hintQueue = new Array(");
// this.shapeQueue.slice().reverse().forEach( function(shape, idx, arr) { console.log("shapes.getShape("+shape.nType()+ ((idx === arr.length-1) ? "));" : "),") ); } );
var shapes = [];
this.shapeQueue.slice().reverse().forEach( function(shape, idx) { shapes.push(shape.x); shapes.push(shape.y); shapes.push(shape.state); } );
console.log("var hintDataList = [" + shapes.join(",") + "];");
console.log("this.createHintQueue(hintDataList);");
// console.log("var hintDataList = [" + shapes.join(",") + "];");
// console.log("this.createHintQueue(hintDataList);");
openers.addSequence(this.shapeQueue);
var sequenceCode = [];
var shapeArrayStr = [];
this.shapeQueue.slice().reverse().forEach( function(shape, idx, arr) { shapeArrayStr += "shapes.getShape("+shape.nType() + ((idx === arr.length-1) ? "));" : "), ") } );
sequenceCode += "case :\n\tthis.shapeQueue = new Array(" + shapeArrayStr + "\nbreak;" + "\n\n";
sequenceCode += "case :\n\tthis.hintQueue = new Array(" + shapeArrayStr;
sequenceCode += "\n\nvar hintDataList = [" + shapes.join(",") + "];" + "\nthis.createHintQueue(hintDataList);" + "\nbreak;";
prompt("Generated Code:", sequenceCode);
//openers.addSequence(this.shapeQueue);
//this.setFreePlay();
this.gameState = consts.GAMESTATES[1];
//this.gameState = consts.GAMESTATES[1];
this.currentMinoInx = 0;
//this.setCurrentOpener(99999);//this.currentMinoInx);
clearMatrix(this.matrix);
this.currentOpener = 9999;
this.shapeQueue = [];
this.hintQueue = [];
this._recurseGameState();
//this._recurseGameState();
},
setSettings: function() {
var newVal = document.getElementById("setting_value").value;
@ -319,7 +333,6 @@ Tetris.prototype = {
this.levelTime = this.startTime;
this.prevInputTime = this.startTime;
// current tetrino index gets set to 0 at the end of opener sequence
//if(this.currentMinoInx == undefined || this.currentMinoInx < 1000) // todo: refactor -- seppuku worthy
this.currentMinoInx = 0;
this.shapeQueue = [];
this.hintQueue = [];

View File

@ -212,6 +212,10 @@ var openerGenerator = {
shapes.getShape(2),
shapes.getShape(3));
break;
case 13:
this.shapeQueue = new Array(shapes.getShape(4), shapes.getShape(6), shapes.getShape(1), shapes.getShape(2), shapes.getShape(3), shapes.getShape(5), shapes.getShape(0), shapes.getShape(1), shapes.getShape(0), shapes.getShape(6), shapes.getShape(0), shapes.getShape(5), shapes.getShape(4), shapes.getShape(3), shapes.getShape(4), shapes.getShape(3), shapes.getShape(4));
break;
default:
this.shapeQueue.unshift(utils.deepClone(shapes.randomShape()));
return;
@ -533,6 +537,12 @@ var openerGenerator = {
var hintDataList = [3,17,1,6,18,0,5,17,2,1,18,0];
this.createHintQueue(hintDataList);
break;
case 13:
this.hintQueue = new Array(shapes.getShape(4), shapes.getShape(6), shapes.getShape(1), shapes.getShape(2), shapes.getShape(3), shapes.getShape(5), shapes.getShape(0), shapes.getShape(1), shapes.getShape(0), shapes.getShape(6), shapes.getShape(0), shapes.getShape(5), shapes.getShape(4), shapes.getShape(3), shapes.getShape(4), shapes.getShape(3), shapes.getShape(4));
var hintDataList = [0,18,0,3,18,0,-1,17,0,7,18,0,3,17,0,8,16,3,0,15,2,-2,14,0,3,15,2,3,14,0,1,13,3,8,14,3,7,12,2,5,16,2,3,14,3,6,17,3,5,18,0];
this.createHintQueue(hintDataList);
break;
default:
this.hintQueue.unshift(utils.deepClone(shapes.randomShape()));
return;

View File

@ -209,38 +209,7 @@ function ShapeO() {
}
function ShapeI() {
/* // North
var state1 = [
[1, 0, 0, 0],
[1, 0, 0, 0],
[1, 0, 0, 0],
[1, 0, 0, 0]
];
// East
var state2 = [
[0, 0, 0, 0],
[0, 0, 0, 0],
[1, 1, 1, 1],
[0, 0, 0, 0]
];
// South
var state3 = [
[0, 0, 1, 0],
[0, 0, 1, 0],
[0, 0, 1, 0],
[0, 0, 1, 0]
];
// West
var state4 = [
[0, 0, 0, 0],
[1, 1, 1, 1],
[0, 0, 0, 0],
[0, 0, 0, 0]
];
*/
// North
var state1 = [
[0, 0, 0, 0],
@ -954,8 +923,6 @@ function randomShape() {
}
function getShape(shapei) {
var result = shapei
var shape;