<commit_before><commit_msg>add minified javascript file of source code<commit_after>var Utilities={random:function(a,b){return Math.floor(Math.random()*(b-a+1))+a}},Config={canvasWidth:0,canvasHeight:0,lineWidth:3,frameRate:100,threshold:100,colorSaturation:0.99,colorValue:0.99},Player=function(){this.y=this.x=200;this.speed=1;this.angle=0;this.color=this.name="";this.ID=null;this.distance=0;this.isAlive=this.isPlaying=false};Player.prototype.navigate=function(a){this.angle+=2*a;this.angle%=360;if(this.angle<0)this.angle+=360};
var ColorManager=function(a,b){this.hue=Math.random();this.saturation=a;this.value=b};ColorManager.prototype.getColor=function(){this.hue+=0.618033988749895;this.hue%=1;return this.convertHSVToRGB(Math.floor(this.hue*360),this.saturation,this.value)};ColorManager.prototype.reset=function(){this.hue=Math.random()};
ColorManager.prototype.convertRGBToHex=function(a){var b,c;b=a[0].toString(16);c=a[1].toString(16);a=a[2].toString(16);if(b.length<2)b="0"+b;if(c.length<2)c="0"+c;if(a.length<2)a="0"+a;return"#"+b+c+a};
ColorManager.prototype.convertHSVToRGB=function(a,b,c){var d,f,g,e=[];if(b===0){e[0]=c;e[1]=c;e[2]=c}d=a/60;a=Math.floor(d);f=d-a;d=c*(1-b);g=c*(1-b*f);b=c*(1-b*(1-f));if(a===0)e=[c,b,d];else if(a==1)e=[g,c,d];else if(a==2)e=[d,c,b];else if(a==3)e=[d,g,c];else if(a==4)e=[b,d,c];else if(a==5)e=[c,d,g];return[Math.floor(e[0]*255),Math.floor(e[1]*255),Math.floor(e[2]*255)]};var PlayerManager=function(){this.players=[];this.colorManager=new ColorManager(Config.colorSaturation,Config.colorValue)};
PlayerManager.prototype.addPlayer=function(a){var b=new Player;b.name=a;b.color=this.getColor();b.ID=this.players.length;this.players.push(b);return b.ID};PlayerManager.prototype.initializePlayers=function(){for(var a=0;a<this.players.length;a++){var b=this.players[a];b.x=Utilities.random(Config.width/4,3*Config.width/4);b.y=Utilities.random(Config.height/4,3*Config.height/4);b.angle=Math.random()*360;b.isPlaying=true;b.isAlive=true}};PlayerManager.prototype.getColor=function(){return this.colorManager.convertRGBToHex(this.colorManager.getColor())};
PlayerManager.prototype.navigatePlayer=function(a,b){this.getPlayerByID(a).navigate(b)};PlayerManager.prototype.numberOfPlayersAlive=function(){for(var a=0,b=0;b<this.players.length;b++)this.players[b].isAlive&&a++;return a};PlayerManager.prototype.getPlayerByID=function(a){return this.players[a]};PlayerManager.prototype.getPlayerName=function(a){return this.players[a].name};PlayerManager.prototype.getPlayerDistance=function(a){return this.players[a].distance};
PlayerManager.prototype.getPlayerColor=function(a){return this.players[a].color};var Engine=function(a,b){this.intervalID=0;this.drawingContext=a;this.players=b;this.lastHit=this.onCollision=null};Engine.prototype.start=function(){var a=this;if(this.intervalID===0)this.intervalID=setInterval(function(){a.draw()},1E3/Config.frameRate)};Engine.prototype.stop=function(){clearInterval(this.intervalID);this.intervalID=0};
Engine.prototype.draw=function(){for(var a,b,c,d=false,f=0;f<this.players.length;f++){a=this.players[f];if(a.isPlaying&&a.isAlive){b=Math.cos(a.angle*Math.PI/180)*a.speed;c=Math.sin(a.angle*Math.PI/180)*a.speed;if(this.hitTest({x:a.x+b,y:a.y+c})){a.isAlive=false;d=true;for(var g=0,e=0;e<this.players.length;e++)this.players[e].isAlive&&g++;this.checkForCallback(a.ID);if(g<2)return}this.drawingContext.strokeStyle=a.color;this.drawingContext.fillStyle=a.color;this.drawingContext.beginPath();this.drawingContext.lineWidth=
Config.lineWidth;this.drawingContext.moveTo(a.x,a.y);this.drawingContext.lineTo(a.x+b,a.y+c);this.drawingContext.stroke();a.x+=b;a.y+=c;a.distance+=Math.sqrt(Math.pow(b,2)+Math.pow(c,2))}}if(!d)this.lastHit=null};Engine.prototype.hitTest=function(a){if(this.drawingContext.getImageData(a.x,a.y,1,1).data[3]>Config.threshold)return true;return false};Engine.prototype.checkForCallback=function(a){if(this.onCollision){if(this.lastHit===null||this.lastHit!=a)this.onCollision(a);this.lastHit=a}};
Engine.prototype.setCollisionCallback=function(a){this.onCollision=a};
var Game=function(a,b,c,d){if(d)this.useFullscreen=d;Config.width=b;Config.height=c;this.canvasElement=document.getElementById(a);if(this.useFullscreen){Config.width=window.innerWidth;Config.height=window.innerHeight}this.canvasElement.width=Config.width;this.canvasElement.height=Config.height;if(this.canvasElement.getContext)this.drawingContext=this.canvasElement.getContext("2d");else throw"No canvas support";this.playerManager=new PlayerManager;this.engine=new Engine(this.drawingContext,this.playerManager.players)};
Game.prototype.start=function(){this.drawFrame();this.playerManager.initializePlayers();this.engine.start()};Game.prototype.restart=function(){this.engine.stop();this.drawingContext.clearRect(0,0,Config.width,Config.height);this.start()};Game.prototype.stop=function(){this.engine.stop()};Game.prototype.addPlayer=function(a){return this.playerManager.addPlayer(a)};Game.prototype.handleControl=function(a,b){this.playerManager.navigatePlayer(a,b)};Game.prototype.setCollisionCallback=function(a){this.engine.setCollisionCallback(a)};
Game.prototype.drawFrame=function(){this.drawingContext.lineWidth=10;this.drawingContext.strokeStyle="#E3D42E";this.drawingContext.strokeRect(0,0,Config.width-0,Config.height-0)};
{'fraction_non_alphanumeric': 0.20838030815482902, 'fraction_numerical': 0.025742202179631718, 'mean_word_length': 14.564327485380117, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 4, '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': '3682934', 'n_tokens_mistral': 2046, 'n_tokens_neox': 1996, 'n_words': 57}