纯js实现俄罗斯方块[效率待优化]
2009-12-28 09:28
561 查看
var mapObject=null;
var baseShapObject=null;
var timeInterval=null;
$(document).ready(function()
{
mapObject=new MapClass();
mapObject.createMap();
createTable(mapObject);
baseShapObject=new BaseShapClass();
baseShapObject.createShap();
timeInterval=window.setInterval("doingClass()",150);
$(document).bind("keydown",function(event)
{
if(event.keyCode==38) //up
{
baseShapObject.changeShap();
}
else if(event.keyCode==37) //left
{
baseShapObject.moveLeft(mapObject);
}
else if(event.keyCode==39) //right
{
baseShapObject.moveRight(mapObject);
}
else if(event.keyCode==32) //space
{
baseShapObject.moveAtOnceDown(mapObject);
}
});
});
function doingClass()
{
if(baseShapObject.isFail(mapObject))
{
window.clearInterval(timeInterval);
timeInterval=null;
alert("失败了!");
}
if(baseShapObject.isMoveToNextLine(mapObject))
{
baseShapObject.moveDown();
}
else
{
mapObject.addShapToMap(baseShapObject);
mapObject.cleanLine();
baseShapObject.createShap();
}
mapObject.displayShapInMap(baseShapObject);
}
function BaseShapClass()
{
this.top=0;
this.left=3;
this.width=4;
this.height=4;
this.positionArray=new Array();
this.baseOneShap=null;
this.getTop=function ()
{
return this.top;
}
this.getLeft=function ()
{
return this.left;
}
this.getWidth=function ()
{
return this.width;
}
this.getHeight=function ()
{
return this.height;
}
this.createShap=function ()
{
var shapType=Math.floor(Math.random()*5)+1;
switch(shapType)
{
case 1:
this.baseOneShap=new ShapOne();
case 2:
this.baseOneShap=new ShapTwo();
case 3:
this.baseOneShap=new ShapThree();
case 4:
this.baseOneShap=new ShapFour();
case 5:
this.baseOneShap=new ShapFive();
}
this.positionArray=this.baseOneShap.getShap();
this.top=0;
this.left=3;
}
this.changeShap=function ()
{
this.positionArray=this.baseOneShap.getNextPositionShap();
}
this.moveLeft=function (map)
{
if(this.left<=0)
{
var k=0;
for(var i=0;i<this.getHeight();i++)
{
if(this.getPosition(i,0-this.left)==1)
{
break;
}
else
{
k++;
}
}
if(k==this.getHeight())
{
this.left --;
}
}
else
{
this.left --;
}
}
this.moveRight=function (map)
{
if((this.left+this.width)>=map.getWidth())
{
var k=0;
for(var i=0;i<this.getHeight();i++)
{
if(this.getPosition(i,map.getWidth()-this.left-1)==1)
{
break;
}
else
{
k++;
}
}
if(k==this.getHeight())
{
this.left ++;
}
}
else
{
this.left ++;
}
}
this.moveDown=function ()
{
this.top ++;
}
this.moveAtOnceDown=function (map)
{
for(var i=0;i<map.getHeight();i++)
{
if(this.isMoveToNextLine(map))
{
this.top ++;
}
else
{
break;
}
}
}
this.isMoveToNextLine=function (map)
{
if(this.getTop()+1>map.getHeight())
{
return false;
}
for(var i=0;i<this.getWidth();i++)
{
if(this.getPosition(this.getHeight()-1,i)==1 && map.getAPosition(this.getTop(),this.getLeft()+i)==1)
{
return false;
}
}
return true;
}
this.isFail=function (map)
{
for(var i=0;i<map.getWidth();i++)
{
if(map.getAPosition(0,i)==1)
{
return true;
}
}
return false;
}
this.showShap=function ()
{
var returnStr="";
for(var i=0;i<this.height;i++)
{
for(var j=0;j<this.width;j++)
{
returnStr +=this.positionArray[i][j]+",";
}
returnStr +="/n";
}
return returnStr;
}
this.getPosition=function (x,y)
{
return this.positionArray[x][y];
}
}
function MapClass()
{
this.mapArray=new Array();
this.height=30;
this.width=15;
this.score=0;
this.scorePreLine=100;
this.getAPosition=function (x,y)
{
return this.mapArray[x][y];
}
this.createMap=function()
{
for(var i=0;i<this.height;i++)
{
var tempArray=new Array();
for(var j=0;j<this.width;j++)
{
tempArray.push(0);
}
this.mapArray.push(tempArray);
}
}
this.showMap=function ()
{
var returnStr="";
for(var i=0;i<this.height;i++)
{
for(var j=0;j<this.width;j++)
{
returnStr +=this.mapArray[i][j]+",";
}
returnStr +="/n";
}
return returnStr;
}
this.cleanLine=function ()
{
for(var i=this.height-1;i>=0;i--)
{
var fullSum=0;
for(var j=0;j<this.width;j++)
{
if(this.mapArray[i][j]==0)
{
break;
}
else
{
fullSum ++;
}
}
if(fullSum==this.width)
{
for(var m=i;m>=0;m--)
{
if(m==0)
{
for(var n=0;n<this.width;n++)
{
this.mapArray[m]
=0;
}
}
else
{
for(var n=0;n<this.width;n++)
{
this.mapArray[i][j]=this.mapArray[i-1][j];
}
}
}
this.score +=this.scorePreLine;
}
}
}
this.addShapToMap=function (shap)
{
var shapLeft=shap.getLeft();
var shapTop=shap.getTop();
for(var i=0;i<shap.getHeight();i++)
{
for(var j=0;j<shap.getWidth();j++)
{
if(shap.getPosition(i,j)==1)
{
this.mapArray[shapTop-shap.getHeight()+i][shapLeft+j]=1;
}
}
}
}
this.displayShapInMap=function (shap)
{
var tempArray=new Array();
for(var i=0;i<this.mapArray.length;i++)
{
var innerArray=new Array();
for(var j=0;j<this.mapArray[i].length;j++)
{
innerArray.push(this.mapArray[i][j]);
}
tempArray.push(innerArray);
}
var shapLeft=shap.getLeft();
var shapTop=shap.getTop();
for(var i=0;i<shap.getHeight();i++)
{
for(var j=0;j<shap.getWidth();j++)
{
if(shap.getPosition(i,j)==1)
{
var x=shapTop-shap.getHeight()+i;
var y=shapLeft+j;
if(x>=0 && y>=0)
{
tempArray[x][y]=1;
}
}
}
}
for(var i=0;i<tempArray.length;i++)
{
for(var j=0;j<tempArray[i].length;j++)
{
if(tempArray[i][j]==1)
{
$("#map"+(i*100+j)).attr("src","down.gif");
}
else
{
$("#map"+(i*100+j)).attr("src","up.gif");
}
}
}
$("#score").html(this.score);
tempArray=null;
}
this.getHeight=function ()
{
return this.height;
}
this.getWidth=function ()
{
return this.width;
}
}
function createTable(map)
{
var width=map.getWidth();
var height=map.getHeight();
var writeStr='<table style="border:solid 1px black;">';
writeStr +='<th><td colspan="'+map.getWidth()+'">得分:<span id="score" style="color:red">--</span></td></th>';
for(var i=0;i<height;i++)
{
writeStr +='<tr>';
for(var j=0;j<width;j++)
{
writeStr +='<td>';
writeStr +='<img src="up.gif" id="map'+(i*100+j)+'">';
writeStr +='</td>';
}
writeStr +='</tr>';
}
writeStr +='</table>';
$("body").append($(writeStr));
}
function ShapOne()
{
this.pisitionArrayArray=new Array(
new Array(
new Array(0,0,0,0),
new Array(0,0,0,0),
new Array(0,1,0,0),
new Array(1,1,1,0)
),
new Array(
new Array(0,0,0,0),
new Array(0,1,0,0),
new Array(0,1,1,0),
new Array(0,1,0,0)
),
new Array(
new Array(0,0,0,0),
new Array(0,0,0,0),
new Array(1,1,1,0),
new Array(0,1,0,0)
),
new Array(
new Array(0,0,0,0),
new Array(0,1,0,0),
new Array(1,1,0,0),
new Array(0,1,0,0)
)
);
this.step=0;
this.getShap=function ()
{
this.step=Math.floor(Math.random()*5);
return this.pisitionArrayArray[this.step];
}
this.getNextPositionShap=function ()
{
this.step ++;
if(this.step >=4)
{
this.step=0;
}
return this.pisitionArrayArray[this.step];
}
this.getStep=function ()
{
return this.step;
}
}
function ShapTwo()
{
this.pisitionArrayArray=new Array(
new Array(
new Array(0,0,0,0),
new Array(0,0,0,0),
new Array(0,0,0,0),
new Array(1,1,1,1)
),
new Array(
new Array(0,1,0,0),
new Array(0,1,0,0),
new Array(0,1,0,0),
new Array(0,1,0,0)
),
new Array(
new Array(0,0,0,0),
new Array(0,0,0,0),
new Array(0,0,0,0),
new Array(1,1,1,1)
),
new Array(
new Array(0,1,0,0),
new Array(0,1,0,0),
new Array(0,1,0,0),
new Array(0,1,0,0)
)
);
this.step=0;
this.getShap=function ()
{
this.step=Math.floor(Math.random()*5);
return this.pisitionArrayArray[this.step];
}
this.getNextPositionShap=function ()
{
this.step ++;
if(this.step >=4)
{
this.step=0;
}
return this.pisitionArrayArray[this.step];
}
this.getStep=function ()
{
return this.step;
}
}
function ShapThree()
{
this.pisitionArrayArray=new Array(
new Array(
new Array(0,0,0,0),
new Array(0,0,0,0),
new Array(0,1,1,0),
new Array(0,1,1,0)
),
new Array(
new Array(0,0,0,0),
new Array(0,0,0,0),
new Array(0,1,1,0),
new Array(0,1,1,0)
),
new Array(
new Array(0,0,0,0),
new Array(0,0,0,0),
new Array(0,1,1,0),
new Array(0,1,1,0)
),
new Array(
new Array(0,0,0,0),
new Array(0,0,0,0),
new Array(0,1,1,0),
new Array(0,1,1,0)
)
);
this.step=0;
this.getShap=function ()
{
this.step=Math.floor(Math.random()*5);
return this.pisitionArrayArray[this.step];
}
this.getNextPositionShap=function ()
{
this.step ++;
if(this.step >=4)
{
this.step=0;
}
return this.pisitionArrayArray[this.step];
}
this.getStep=function ()
{
return this.step;
}
}
function ShapFour()
{
this.pisitionArrayArray=new Array(
new Array(
new Array(0,0,0,0),
new Array(0,1,0,0),
new Array(0,1,0,0),
new Array(0,1,1,0)
),
new Array(
new Array(0,0,0,0),
new Array(0,0,0,0),
new Array(0,1,1,1),
new Array(0,1,0,0)
),
new Array(
new Array(0,0,0,0),
new Array(0,1,1,0),
new Array(0,0,1,0),
new Array(0,0,1,0)
),
new Array(
new Array(0,0,0,0),
new Array(0,0,0,0),
new Array(0,0,1,0),
new Array(1,1,1,0)
)
);
this.step=0;
this.getShap=function ()
{
this.step=Math.floor(Math.random()*5);
return this.pisitionArrayArray[this.step];
}
this.getNextPositionShap=function ()
{
this.step ++;
if(this.step >=4)
{
this.step=0;
}
return this.pisitionArrayArray[this.step];
}
this.getStep=function ()
{
return this.step;
}
}
function ShapFive()
{
this.pisitionArrayArray=new Array(
new Array(
new Array(0,0,0,0),
new Array(0,1,0,0),
new Array(0,1,0,0),
new Array(1,1,0,0)
),
new Array(
new Array(0,0,0,0),
new Array(0,0,0,0),
new Array(0,1,0,0),
new Array(0,1,1,1)
),
new Array(
new Array(0,0,0,0),
new Array(0,1,1,0),
new Array(0,1,0,0),
new Array(0,1,0,0)
),
new Array(
new Array(0,0,0,0),
new Array(0,0,0,0),
new Array(1,1,1,0),
new Array(0,0,1,0)
)
);
this.step=0;
this.getShap=function ()
{
this.step=Math.floor(Math.random()*5);
return this.pisitionArrayArray[this.step];
}
this.getNextPositionShap=function ()
{
this.step ++;
if(this.step >=4)
{
this.step=0;
}
return this.pisitionArrayArray[this.step];
}
this.getStep=function ()
{
return this.step;
}
}
var baseShapObject=null;
var timeInterval=null;
$(document).ready(function()
{
mapObject=new MapClass();
mapObject.createMap();
createTable(mapObject);
baseShapObject=new BaseShapClass();
baseShapObject.createShap();
timeInterval=window.setInterval("doingClass()",150);
$(document).bind("keydown",function(event)
{
if(event.keyCode==38) //up
{
baseShapObject.changeShap();
}
else if(event.keyCode==37) //left
{
baseShapObject.moveLeft(mapObject);
}
else if(event.keyCode==39) //right
{
baseShapObject.moveRight(mapObject);
}
else if(event.keyCode==32) //space
{
baseShapObject.moveAtOnceDown(mapObject);
}
});
});
function doingClass()
{
if(baseShapObject.isFail(mapObject))
{
window.clearInterval(timeInterval);
timeInterval=null;
alert("失败了!");
}
if(baseShapObject.isMoveToNextLine(mapObject))
{
baseShapObject.moveDown();
}
else
{
mapObject.addShapToMap(baseShapObject);
mapObject.cleanLine();
baseShapObject.createShap();
}
mapObject.displayShapInMap(baseShapObject);
}
function BaseShapClass()
{
this.top=0;
this.left=3;
this.width=4;
this.height=4;
this.positionArray=new Array();
this.baseOneShap=null;
this.getTop=function ()
{
return this.top;
}
this.getLeft=function ()
{
return this.left;
}
this.getWidth=function ()
{
return this.width;
}
this.getHeight=function ()
{
return this.height;
}
this.createShap=function ()
{
var shapType=Math.floor(Math.random()*5)+1;
switch(shapType)
{
case 1:
this.baseOneShap=new ShapOne();
case 2:
this.baseOneShap=new ShapTwo();
case 3:
this.baseOneShap=new ShapThree();
case 4:
this.baseOneShap=new ShapFour();
case 5:
this.baseOneShap=new ShapFive();
}
this.positionArray=this.baseOneShap.getShap();
this.top=0;
this.left=3;
}
this.changeShap=function ()
{
this.positionArray=this.baseOneShap.getNextPositionShap();
}
this.moveLeft=function (map)
{
if(this.left<=0)
{
var k=0;
for(var i=0;i<this.getHeight();i++)
{
if(this.getPosition(i,0-this.left)==1)
{
break;
}
else
{
k++;
}
}
if(k==this.getHeight())
{
this.left --;
}
}
else
{
this.left --;
}
}
this.moveRight=function (map)
{
if((this.left+this.width)>=map.getWidth())
{
var k=0;
for(var i=0;i<this.getHeight();i++)
{
if(this.getPosition(i,map.getWidth()-this.left-1)==1)
{
break;
}
else
{
k++;
}
}
if(k==this.getHeight())
{
this.left ++;
}
}
else
{
this.left ++;
}
}
this.moveDown=function ()
{
this.top ++;
}
this.moveAtOnceDown=function (map)
{
for(var i=0;i<map.getHeight();i++)
{
if(this.isMoveToNextLine(map))
{
this.top ++;
}
else
{
break;
}
}
}
this.isMoveToNextLine=function (map)
{
if(this.getTop()+1>map.getHeight())
{
return false;
}
for(var i=0;i<this.getWidth();i++)
{
if(this.getPosition(this.getHeight()-1,i)==1 && map.getAPosition(this.getTop(),this.getLeft()+i)==1)
{
return false;
}
}
return true;
}
this.isFail=function (map)
{
for(var i=0;i<map.getWidth();i++)
{
if(map.getAPosition(0,i)==1)
{
return true;
}
}
return false;
}
this.showShap=function ()
{
var returnStr="";
for(var i=0;i<this.height;i++)
{
for(var j=0;j<this.width;j++)
{
returnStr +=this.positionArray[i][j]+",";
}
returnStr +="/n";
}
return returnStr;
}
this.getPosition=function (x,y)
{
return this.positionArray[x][y];
}
}
function MapClass()
{
this.mapArray=new Array();
this.height=30;
this.width=15;
this.score=0;
this.scorePreLine=100;
this.getAPosition=function (x,y)
{
return this.mapArray[x][y];
}
this.createMap=function()
{
for(var i=0;i<this.height;i++)
{
var tempArray=new Array();
for(var j=0;j<this.width;j++)
{
tempArray.push(0);
}
this.mapArray.push(tempArray);
}
}
this.showMap=function ()
{
var returnStr="";
for(var i=0;i<this.height;i++)
{
for(var j=0;j<this.width;j++)
{
returnStr +=this.mapArray[i][j]+",";
}
returnStr +="/n";
}
return returnStr;
}
this.cleanLine=function ()
{
for(var i=this.height-1;i>=0;i--)
{
var fullSum=0;
for(var j=0;j<this.width;j++)
{
if(this.mapArray[i][j]==0)
{
break;
}
else
{
fullSum ++;
}
}
if(fullSum==this.width)
{
for(var m=i;m>=0;m--)
{
if(m==0)
{
for(var n=0;n<this.width;n++)
{
this.mapArray[m]
=0;
}
}
else
{
for(var n=0;n<this.width;n++)
{
this.mapArray[i][j]=this.mapArray[i-1][j];
}
}
}
this.score +=this.scorePreLine;
}
}
}
this.addShapToMap=function (shap)
{
var shapLeft=shap.getLeft();
var shapTop=shap.getTop();
for(var i=0;i<shap.getHeight();i++)
{
for(var j=0;j<shap.getWidth();j++)
{
if(shap.getPosition(i,j)==1)
{
this.mapArray[shapTop-shap.getHeight()+i][shapLeft+j]=1;
}
}
}
}
this.displayShapInMap=function (shap)
{
var tempArray=new Array();
for(var i=0;i<this.mapArray.length;i++)
{
var innerArray=new Array();
for(var j=0;j<this.mapArray[i].length;j++)
{
innerArray.push(this.mapArray[i][j]);
}
tempArray.push(innerArray);
}
var shapLeft=shap.getLeft();
var shapTop=shap.getTop();
for(var i=0;i<shap.getHeight();i++)
{
for(var j=0;j<shap.getWidth();j++)
{
if(shap.getPosition(i,j)==1)
{
var x=shapTop-shap.getHeight()+i;
var y=shapLeft+j;
if(x>=0 && y>=0)
{
tempArray[x][y]=1;
}
}
}
}
for(var i=0;i<tempArray.length;i++)
{
for(var j=0;j<tempArray[i].length;j++)
{
if(tempArray[i][j]==1)
{
$("#map"+(i*100+j)).attr("src","down.gif");
}
else
{
$("#map"+(i*100+j)).attr("src","up.gif");
}
}
}
$("#score").html(this.score);
tempArray=null;
}
this.getHeight=function ()
{
return this.height;
}
this.getWidth=function ()
{
return this.width;
}
}
function createTable(map)
{
var width=map.getWidth();
var height=map.getHeight();
var writeStr='<table style="border:solid 1px black;">';
writeStr +='<th><td colspan="'+map.getWidth()+'">得分:<span id="score" style="color:red">--</span></td></th>';
for(var i=0;i<height;i++)
{
writeStr +='<tr>';
for(var j=0;j<width;j++)
{
writeStr +='<td>';
writeStr +='<img src="up.gif" id="map'+(i*100+j)+'">';
writeStr +='</td>';
}
writeStr +='</tr>';
}
writeStr +='</table>';
$("body").append($(writeStr));
}
function ShapOne()
{
this.pisitionArrayArray=new Array(
new Array(
new Array(0,0,0,0),
new Array(0,0,0,0),
new Array(0,1,0,0),
new Array(1,1,1,0)
),
new Array(
new Array(0,0,0,0),
new Array(0,1,0,0),
new Array(0,1,1,0),
new Array(0,1,0,0)
),
new Array(
new Array(0,0,0,0),
new Array(0,0,0,0),
new Array(1,1,1,0),
new Array(0,1,0,0)
),
new Array(
new Array(0,0,0,0),
new Array(0,1,0,0),
new Array(1,1,0,0),
new Array(0,1,0,0)
)
);
this.step=0;
this.getShap=function ()
{
this.step=Math.floor(Math.random()*5);
return this.pisitionArrayArray[this.step];
}
this.getNextPositionShap=function ()
{
this.step ++;
if(this.step >=4)
{
this.step=0;
}
return this.pisitionArrayArray[this.step];
}
this.getStep=function ()
{
return this.step;
}
}
function ShapTwo()
{
this.pisitionArrayArray=new Array(
new Array(
new Array(0,0,0,0),
new Array(0,0,0,0),
new Array(0,0,0,0),
new Array(1,1,1,1)
),
new Array(
new Array(0,1,0,0),
new Array(0,1,0,0),
new Array(0,1,0,0),
new Array(0,1,0,0)
),
new Array(
new Array(0,0,0,0),
new Array(0,0,0,0),
new Array(0,0,0,0),
new Array(1,1,1,1)
),
new Array(
new Array(0,1,0,0),
new Array(0,1,0,0),
new Array(0,1,0,0),
new Array(0,1,0,0)
)
);
this.step=0;
this.getShap=function ()
{
this.step=Math.floor(Math.random()*5);
return this.pisitionArrayArray[this.step];
}
this.getNextPositionShap=function ()
{
this.step ++;
if(this.step >=4)
{
this.step=0;
}
return this.pisitionArrayArray[this.step];
}
this.getStep=function ()
{
return this.step;
}
}
function ShapThree()
{
this.pisitionArrayArray=new Array(
new Array(
new Array(0,0,0,0),
new Array(0,0,0,0),
new Array(0,1,1,0),
new Array(0,1,1,0)
),
new Array(
new Array(0,0,0,0),
new Array(0,0,0,0),
new Array(0,1,1,0),
new Array(0,1,1,0)
),
new Array(
new Array(0,0,0,0),
new Array(0,0,0,0),
new Array(0,1,1,0),
new Array(0,1,1,0)
),
new Array(
new Array(0,0,0,0),
new Array(0,0,0,0),
new Array(0,1,1,0),
new Array(0,1,1,0)
)
);
this.step=0;
this.getShap=function ()
{
this.step=Math.floor(Math.random()*5);
return this.pisitionArrayArray[this.step];
}
this.getNextPositionShap=function ()
{
this.step ++;
if(this.step >=4)
{
this.step=0;
}
return this.pisitionArrayArray[this.step];
}
this.getStep=function ()
{
return this.step;
}
}
function ShapFour()
{
this.pisitionArrayArray=new Array(
new Array(
new Array(0,0,0,0),
new Array(0,1,0,0),
new Array(0,1,0,0),
new Array(0,1,1,0)
),
new Array(
new Array(0,0,0,0),
new Array(0,0,0,0),
new Array(0,1,1,1),
new Array(0,1,0,0)
),
new Array(
new Array(0,0,0,0),
new Array(0,1,1,0),
new Array(0,0,1,0),
new Array(0,0,1,0)
),
new Array(
new Array(0,0,0,0),
new Array(0,0,0,0),
new Array(0,0,1,0),
new Array(1,1,1,0)
)
);
this.step=0;
this.getShap=function ()
{
this.step=Math.floor(Math.random()*5);
return this.pisitionArrayArray[this.step];
}
this.getNextPositionShap=function ()
{
this.step ++;
if(this.step >=4)
{
this.step=0;
}
return this.pisitionArrayArray[this.step];
}
this.getStep=function ()
{
return this.step;
}
}
function ShapFive()
{
this.pisitionArrayArray=new Array(
new Array(
new Array(0,0,0,0),
new Array(0,1,0,0),
new Array(0,1,0,0),
new Array(1,1,0,0)
),
new Array(
new Array(0,0,0,0),
new Array(0,0,0,0),
new Array(0,1,0,0),
new Array(0,1,1,1)
),
new Array(
new Array(0,0,0,0),
new Array(0,1,1,0),
new Array(0,1,0,0),
new Array(0,1,0,0)
),
new Array(
new Array(0,0,0,0),
new Array(0,0,0,0),
new Array(1,1,1,0),
new Array(0,0,1,0)
)
);
this.step=0;
this.getShap=function ()
{
this.step=Math.floor(Math.random()*5);
return this.pisitionArrayArray[this.step];
}
this.getNextPositionShap=function ()
{
this.step ++;
if(this.step >=4)
{
this.step=0;
}
return this.pisitionArrayArray[this.step];
}
this.getStep=function ()
{
return this.step;
}
}
相关文章推荐
- node.js开发中使用Node Supervisor实现监测文件修改并自动重启应用提高nodejs调试效率
- js实现css3的过渡,需要注意的一点(浏览器优化)
- js 实现俄罗斯方块(三)
- js:优化javascript的执行效率一些方法
- Js/es for(let i in Obj)效率分析及优化
- 【Android界面实现】对Listview控件的效率优化
- r.js压缩angular项目,Angular+requirejs+rjs实现初始化http请求数的优化
- paip.提高效率---集合的存取括号方式 uapi java python php js 的实现比较
- JS实现——俄罗斯方块
- 实现js尾递归优化的代码
- js实现俄罗斯方块
- 极简实现js去抖动,用于优化频繁操作.
- JSP页面小脚本实现日期比較,Java同理,精简过后的,可能在效率上不太好,有大大能够给优化下就更好了
- paip.提高效率---集合的存取括号方式 uapi java python php js 的实现比较
- js实现五星评价,也请大神如何优化
- JSP页面小脚本实现日期比较,Java同理,精简过后的,可能在效率上不太好,有大大可以给优化下就更好了
- RequireJs按需要加载angular模块和依赖,并且用r.js压缩打包js和css文件实现加载优化(图文)。
- 基于最新版本React Native实现JsBundle预加载,界面秒开优化
- 将List按照指定大小等分的几种实现方式和效率对比及优化
- JS和canvas实现俄罗斯方块