<commit_before><commit_msg>minified<commit_after>Boxie={};Boxie.Game=function(){this.world=[];this.canvas=false;this.ctx=false;this.canvasnoise=false;this.ctxnoise=false;this.settings={width:40,screen:[0,0],pwr:""};this.svars={};this.objects=[];this.can_rotate=0;this.can_rotate_to=0;this.callbacks={}};Boxie.Game.prototype={buildWorld:function(e,t,n){this.world=[[]];for(var r=0;r<e[0];r++){this.world[r]=[];for(var i=0;i<e[1];i++){this.world[r][i]=new Boxie.Solid(Math.round(Math.random()*.6))}}var s=e[0]*e[1],o=0,u=0;for(var a in this.objects){if(!this.objects[a])continue;if(this.objects[a].settings.type==2&&this.objects[a].pos[0]>e[0]&&this.objects[a].pos[1]>e[1]){delete this.objects[a]}}while(o<s*n&&u<s){u++;var r=Math.floor(Math.random()*e[0]),i=Math.floor(Math.random()*e[1]);if(this.isEmpty([r,i])===true){o++;var f=new Boxie.Point(false);f.pos=[r,i];this.addObject(f)}}this.canvas.width=this.settings.width*e[0];this.canvas.height=this.settings.width*e[1];this.canvasnoise.width=this.settings.width*e[0];this.canvasnoise.height=this.settings.width*e[1]},draw:function(){var e=[0,0];if(this.can_rotate<this.can_rotate_to){this.can_rotate+=Math.PI/100}if(this.can_rotate>this.can_rotate_to){this.can_rotate=this.can_rotate_to=0}if(typeof player!="undefined"){e[0]=-player.pos[0]*this.settings.width+this.settings.screen[0]/2;e[1]=-player.pos[1]*this.settings.width+this.settings.screen[1]/2}this.ctxnoise.clearRect(0,0,this.canvasnoise.width,this.canvasnoise.height);var t=(new Date).getTime()/1e3;var n=[~~(256*(Math.sin(t/3)/2+.5)),~~(256*(Math.sin(t/3+2*Math.PI/3)/2+.5)),~~(256*(Math.sin(t/3+4*Math.PI/3)/2+.5))];var r=[n[1],n[2],n[0]];var i=n;for(var s=0;s<this.canvasnoise.width;s+=this.settings.width/4){for(var o=0;o<this.canvasnoise.height;o+=this.settings.width/4){var u=Math.floor((s-e[0])/this.settings.width);if(typeof this.world[u]!="undefined"&&typeof this.world[u][Math.floor((o-e[1])/this.settings.width)]!="undefined")i=n;else i=r;this.ctxnoise.fillStyle="rgba("+i[0]+", "+i[1]+", "+i[2]+", "+~~(Math.random()*10)/40+")";this.ctxnoise.fillRect(s,o,this.settings.width/4,this.settings.width/4)}}this.ctx.save();this.ctxnoise.save();this.ctx.translate(this.settings.screen[0]/2,this.settings.screen[1]/2);this.ctxnoise.translate(this.settings.screen[0]/2,this.settings.screen[1]/2);this.ctx.rotate(this.can_rotate);this.ctxnoise.rotate(this.can_rotate);this.ctx.translate(-this.settings.screen[0]/2,-this.settings.screen[1]/2);this.ctxnoise.translate(-this.settings.screen[0]/2,-this.settings.screen[1]/2);this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);this.ctx.fillStyle="#fff";this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height);this.ctx.translate(e[0],e[1]);this.ctxnoise.translate(e[0],e[1]);this.ctx.fillStyle="#000";for(var s=0;s<this.world.length;s++){for(var o=0;o<this.world[s].length;o++){if(this.world[s][o].type==1){this.ctx.fillRect(s*this.settings.width,o*this.settings.width,this.settings.width,this.settings.width)}}}for(var a in this.objects){if(!this.objects[a])continue;this.objects[a].draw(this.ctx,this.ctxnoise)}this.ctx.restore();this.ctxnoise.restore();this.ctx.drawImage(this.canvasnoise,0,0)},tick:function(){for(var e in this.objects){if(!this.objects[e])continue;if(this.objects[e].settings.dead==1){delete this.objects[e];this.objects[e]=false;continue}this.objects[e].tick()}},addObject:function(e){if(typeof e=="undefined"){console.log("NO OBJECT!!!");return false}if(e.id===false){e.id=this.objects.length;console.log("New id:",e.id)}this.objects[e.id]=e;e.boxie=this},isEmpty:function(e){if(typeof this.world[e[0]]=="undefined"||typeof this.world[e[0]][e[1]]=="undefined"){return null}if(this.world[e[0]][e[1]].type==1){return false}for(var t in this.objects){if(!this.objects[t])continue;if(this.objects[t].pos[0]==e[0]&&this.objects[t].pos[1]==e[1]){if(this.objects[t].settings.type==1){return false}if(this.objects[t].settings.type==2){return this.objects[t]}}}return true},setCanvas:function(e,t){this.canvas=e;this.canvasnoise=t;this.ctx=this.canvas.getContext("2d");this.ctxnoise=this.canvasnoise.getContext("2d")},move:function(e,t){var n=this.world[e[0]][e[1]];this.world[e[0]][e[1]]=this.world[t[0]][t[1]];this.world[t[0]][t[1]]=n},removeObject:function(e){delete this.objects[e]},getWorldObjectAt:function(e){if(typeof this.world[e[0]]!="undefined"&&typeof this.world[e[0]][e[1]]!="undefined"){return this.world[e[0]][e[1]]}else{return false}},getObjectAt:function(e){for(var t in this.objects){if(!this.objects[t])continue;if(this.objects[t].pos[0]==e[0]&&this.objects[t].pos[1]==e[1]){return this.objects[t]}}return false},countFreePoints:function(){var e=0;for(var t in this.objects){if(!this.objects[t]||this.objects[t].settings.dead)continue;if(this.objects[t].settings.type==2){e+=this.objects[t].settings.value}}return e},listen:function(e,t){if(typeof this.callbacks[e]=="undefined"){this.callbacks[e]=[]}this.callbacks[e].push(t)},_listen:function(e,t){if(typeof this.callbacks[e]=="undefined"){return false}for(var n in this.callbacks[e]){if(typeof this.callbacks[e][n]=="function"){this.callbacks[e][n].call(this,t)}}},hash:function(){var e=0;for(var t=0;t<this.world.length;t++){for(var n=0;n<this.world[t].length;n++){if(this.world[t][n].type==1){e+=t*n;e%=999}}}return e}};Boxie.Solid=function(e,t,n){this.type=e;this.settings={};for(var r in t){this.settings[r]=t[r]}};Boxie.Man=function(e,t){this.settings=t||{points:0};this.settings.dead=0;this.settings.type=1;this.settings.movespeed=100;this.id=e;this.pos=[0,0];this.boxie=false;this.lastmove=0;this.callbacks={}};Boxie.Man.prototype={tick:function(){},draw:function(e,t){var n=this.boxie.settings.width;e.beginPath();if(this.settings.dead)e.fillStyle="rgb(0,0,0)";else e.fillStyle="rgb("+this.settings.color[0]+","+this.settings.color[1]+","+this.settings.color[2]+")";e.arc(this.pos[0]*n+n/2,this.pos[1]*n+n/2,n/2,0,2*Math.PI);e.fill();e.stroke();t.save();t.globalCompositeOperation="destination-out";t.strokeStyle="rgba(0,0,0,0)";t.beginPath();var r=this.pos[0]*n+n/2,i=this.pos[1]*n+n/2,s=n/2*(this.settings.points/4+1);var o=t.createRadialGradient(r,i,0,r,i,s);o.addColorStop(0,"rgba(255,255,255,1)");o.addColorStop(.5,"rgba(255,255,255,0.65)");o.addColorStop(1,"rgba(255,255,255,0)");t.fillStyle=o;t.arc(r,i,s,0,2*Math.PI);t.fill();t.stroke();t.restore()},move:function(e,t){if(this.settings.dead)return false;var n=(new Date).getTime();if(this.lastmove+this.settings.movespeed>n)return false;if(typeof t=="undefined"){var t=true}var r=[this.pos[0]+e[0],this.pos[1]+e[1]];var i=this.boxie.isEmpty(r);if(i){if(typeof i=="object"){console.log("touch",i.id);i.touch({player:this.id});this._listen("touched",{player:this.id})}var s=[this.pos[0],this.pos[1]];this.pos=r;this.lastmove=(new Date).getTime();if(t==2){var o=[s[0]+e[0]*-1,s[1]+e[1]*-1];if(this.boxie.isEmpty(o)==false){this._listen("drag",{a:o,b:s});this.boxie.move(o,s)}}this._listen("move",{pos:e,push:t})}else if(t===true){var o=[this.pos[0]+e[0]*2,this.pos[1]+e[1]*2];var u=this.boxie.getObjectAt(o);if(this.boxie.isEmpty(o)||u){if(u){u.die({player:this.id})}this.boxie.move(r,o);this._listen("push",{a:r,b:o});this.pos=r;this.lastmove=(new Date).getTime();this._listen("move",{pos:e,push:t})}}},die:function(e){var t=new Boxie.Point(false,{value:this.settings.points});t.pos=[this.pos[0],this.pos[1]];this.boxie.addObject(t);this.settings.dead=1;this.settings.points=0;this._listen("die",e)},touch:function(e){this._listen("touch",e)},listen:function(e,t){if(typeof this.callbacks[e]=="undefined"){this.callbacks[e]=[]}this.callbacks[e].push(t)},_listen:function(e,t){if(typeof this.callbacks[e]=="undefined"){return false}for(var n in this.callbacks[e]){if(typeof this.callbacks[e][n]=="function"){this.callbacks[e][n].call(this,t)}}}};Boxie.Point=function(e,t){this.settings=t||{value:1};this.settings.type=2;this.settings.dead=0;this.settings.color=[255,255,255];this.id=e;this.pos=[0,0];this.boxie=false;this.callbacks={}};Boxie.Point.prototype={tick:function(){},draw:function(e,t){var n=this.boxie.settings.width;t.beginPath();if(this.settings.dead)return false;else t.fillStyle="rgb("+this.settings.color[0]+","+this.settings.color[1]+","+this.settings.color[2]+")";t.arc(this.pos[0]*n+n/2,this.pos[1]*n+n/2,n/3,0,2*Math.PI);t.fill();t.stroke()},die:function(e){},touch:function(e){if(this.settings.dead)return false;this.boxie.objects[e.player].settings.points+=this.settings.value;this.settings.dead=1;this.boxie._listen("ptouch",{p:this.id,t:this.boxie.objects[e.player].id,value:this.boxie.objects[e.player].settings.points});this._listen("touch",e)},listen:function(e,t){if(typeof this.callbacks[e]=="undefined"){this.callbacks[e]=[]}this.callbacks[e].push(t)},_listen:function(e,t){if(typeof this.callbacks[e]=="undefined"){return false}for(var n in this.callbacks[e]){if(typeof this.callbacks[e][n]=="function"){this.callbacks[e][n].call(this,t)}}}};if(typeof module!=="undefined"){module.exports=Boxie}
{'fraction_non_alphanumeric': 0.269028724712194, 'fraction_numerical': 0.030848329048843187, 'mean_word_length': 12.937694704049845, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6018014', 'n_tokens_mistral': 3733, 'n_tokens_neox': 3639, 'n_words': 122}