(function(){functionr(e,n,t){functiono(i,f){if(!n[i]){if(!e[i]){varc="function"==typeofrequire&&require;if(!f&&c)returnc(i,!0);if(u)returnu(i,!0);vara=newError("Cannot find module '"+i+"'");throwa.code="MODULE_NOT_FOUND",a}varp=n[i]={exports:{}};e[i][0].call(p.exports,(function(r){varn=e[i][1][r];returno(n||r)}),p,p.exports,r,e,n,t)}returnn[i].exports}for(varu="function"==typeofrequire&&require,i=0;i<t.length;i++)o(t[i]);returno}returnr})()({1:[function(require,module,exports){vario=require("socket.io-client");varclient=require("./src/game-client");varconfig=require("./config.json");functionrun(flag){client.renderer=flag?require("./src/mode/god"):require("./src/mode/player");client.connectGame("//"+location.host,$("#name").val(),(function(success,msg){if(success){$("#main-ui").fadeIn(1e3);$("#begin, #wasted").fadeOut(1e3)}else{$("#error").text(msg)}}),flag)}$(document).ready((function(){varerr=$("#error");if(!window.WebSocket){err.text("Your browser does not support WebSockets!");return}err.text("Loading... Please wait");(function(){varsocket=io(`//${location.host}`,{forceNew:true,upgrade:false,transports:["websocket"]});socket.on("connect",(function(){socket.emit("pings")}));socket.on("pongs",(function(){socket.disconnect();err.text("All done, have fun!");$("#name").keypress((function(evt){if(evt.which===13)run()}));$(".start").removeAttr("disabled").click((function(evt){run()}));$(".spectate").removeAttr("disabled").click((function(evt){run(true)}))}));socket.on("connect_error",(function(){err.text("Cannot connect with server. This probably is due to misconfigured proxy server. (Try using a different browser)")}))})()}));$(document).keydown((function(e){varnewHeading=-1;switch(e.which){case38:newHeading=0;break;case87:newHeading=0;break;case39:newHeading=1;break;case68:newHeading=1;break;case40:newHeading=2;break;case83:newHeading=2;break;case37:newHeading=3;break;case65:newHeading=3;break;default:return}client.changeHeading(newHeading)}));$(document).on("touchmove",(function(e){e.preventDefault()}));$(document).on("touchstart",(function(e1){varx1=e1.targetTouches[0].pageX;vary1=e1.targetTouches[0].pageY;$(document).one("touchend",(function(e2){varx2=e2.changedTouches[0].pageX;vary2=e2.changedTouches[0].pageY;vardeltaX=x2-x1;vardeltaY=y2-y1;varnewHeading=-1;if(deltaY<0&&Math.abs(deltaY)>Math.abs(deltaX))newHeading=0;elseif(deltaX>0&&Math.abs(deltaY)<deltaX)newHeading=1;elseif(deltaY>0&&Math.abs(deltaX)<deltaY)newHeading=2;elseif(deltaX<0&&Math.abs(deltaX)>Math.abs(deltaY))newHeading=3;client.changeHeading(newHeading)}))}));$(".menu").on("click",(function(){client.disconnect();$("#main-ui, #wasted").fadeOut(1e3);$("#begin").fadeIn(1e3)}));$(".toggle").on("click",(function(){$("#settings").slideToggle()}))},{"./config.json":2,"./src/game-client":59,"./src/mode/god":60,"./src/mode/player":61,"socket.io-client":37}],2:[function(require,module,exports){module.exports={port:8080,bots:5,consts:{GRID_COUNT:100,CELL_WIDTH:40,SPEED:5,BORDER_WIDTH:20,MAX_PLAYERS:30,NEW_PLAYER_LAG:60,LEADERBOARD_NUM:5,PREFIXES:"Angry Baby Crazy Diligent Excited Fat Greedy Hungry Interesting Japanese Kind Little Magic Naïve Old Powerful Quiet Rich Superman THU Undefined Valuable Wifeless Xiangbuchulai Young Zombie",NAMES:"Alice Bob Carol Dave Eve Francis Grace Hans Isabella Jason Kate Louis Margaret Nathan Olivia Paul Queen Richard Susan Thomas Uma Vivian Winnie Xander Yasmine Zach"}}},{}],3:[function(require,module,exports){module.exports=after;functionafter(count,callback,err_cb){varbail=false;err_cb=err_cb||noop;proxy.count=count;returncount===0?callback():proxy;functionproxy(err,result){if(proxy.count<=0){thrownewError("after called too many times")}--proxy.count;if(err){bail=true;callback(err);callback=err_cb}elseif(proxy.count===0&&!bail){callback(null,result)}}}functionnoop(){}},{}],4:[function(require,module,exports){module.exports=function(arraybuffer,start,end){varbytes=arraybuffer.byteLength;start=start||0;end=end||bytes;if(arraybuffer.slice){returnarraybuffer.slice(start,end)}if(star
/*!
*Thebuffermodulefromnode.js,forthebrowser.
*
*@authorFerossAboukhadijeh<https://feross.org>
*@licenseMIT
*/
"use strict";varbase64=require("base64-js");varieee754=require("ieee754");varcustomInspectSymbol=typeofSymbol==="function"&&typeofSymbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null;exports.Buffer=Buffer;exports.SlowBuffer=SlowBuffer;exports.INSPECT_MAX_BYTES=50;varK_MAX_LENGTH=2147483647;exports.kMaxLength=K_MAX_LENGTH;Buffer.TYPED_ARRAY_SUPPORT=typedArraySupport();if(!Buffer.TYPED_ARRAY_SUPPORT&&typeofconsole!=="undefined"&&typeofconsole.error==="function"){console.error("This browser lacks typed array (Uint8Array) support which is required by "+"`buffer` v5.x. Use `buffer` v4.x if you require old browser support.")}functiontypedArraySupport(){try{vararr=newUint8Array(1);varproto={foo:function(){return42}};Object.setPrototypeOf(proto,Uint8Array.prototype);Object.setPrototypeOf(arr,proto);returnarr.foo()===42}catch(e){returnfalse}}Object.defineProperty(Buffer.prototype,"parent",{enumerable:true,get:function(){if(!Buffer.isBuffer(this))returnundefined;returnthis.buffer}});Object.defineProperty(Buffer.prototype,"offset",{enumerable:true,get:function(){if(!Buffer.isBuffer(this))returnundefined;returnthis.byteOffset}});functioncreateBuffer(length){if(length>K_MAX_LENGTH){thrownewRangeError('The value "'+length+'" is invalid for option "size"')}varbuf=newUint8Array(length);Object.setPrototypeOf(buf,Buffer.prototype);returnbuf}functionBuffer(arg,encodingOrOffset,length){if(typeofarg==="number"){if(typeofencodingOrOffset==="string"){thrownewTypeError('The "string" argument must be of type string. Received type number')}returnallocUnsafe(arg)}returnfrom(arg,encodingOrOffset,length)}if(typeofSymbol!=="undefined"&&Symbol.species!=null&&Buffer[Symbol.species]===Buffer){Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:true,enumerable:false,writable:false})}Buffer.poolSize=8192;functionfrom(value,encodingOrOffset,length){if(typeofvalue==="string"){returnfromString(value,encodingOrOffset)}if(ArrayBuffer.isView(value)){returnfromArrayLike(value)}if(value==null){thrownewTypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, "+"or Array-like Object. Received type "+typeofvalue)}if(isInstance(value,ArrayBuffer)||value&&isInstance(value.buffer,ArrayBuffer)){returnfromArrayBuffer(value,encodingOrOffset,length)}if(typeofvalue==="number"){thrownewTypeError('The "value" argument must not be of type number. Received type number')}varvalueOf=value.valueOf&&value.valueOf();if(valueOf!=null&&valueOf!==value){returnBuffer.from(valueOf,encodingOrOffset,length)}varb=fromObject(value);if(b)returnb;if(typeofSymbol!=="undefined"&&Symbol.toPrimitive!=null&&typeofvalue[Symbol.toPrimitive]==="function"){returnBuffer.from(value[Symbol.toPrimitive]("string"),encodingOrOffset,length)}thrownewTypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, "+"or Array-like Object. Received type "+typeofvalue)}Buffer.from=function(value,encodingOrOffset,length){returnfrom(value,encodingOrOffset,length)};Object.setPrototypeOf(Buffer.prototype,Uint8Array.prototype);Object.setPrototypeOf(Buffer,Uint8Array);functionassertSize(size){if(typeofsize!=="number"){thrownewTypeError('"size" argument must be of type number')}elseif(size<0){thrownewRangeError('The value "'+size+'" is invalid for option "size"')}}functionalloc(size,fill,encoding){assertSize(size);if(size<=0){returncreateBuffer(size)}if(fill!==undefined){returntypeofencoding==="string"?createBuffer(size).fill(fill,encoding):createBuffer(size).fill(fill)}returncreateBuffer(size)}Buffer.alloc=function(size,fill,encoding){returnalloc(size,fill,encoding)};functionallocUnsafe(size){assertSize(size);returncreateBuffer(size<0?0:checked(size)|0)}Buffer.allocUnsafe=function(size){returnallocUnsafe(size)};Buffer.allocUnsafeSlow=function(size){returnallocUnsafe(size)};functionfromString(string,encoding){if(typeofencoding!=="string"||encoding===""){encoding="utf8"}if(!Buffer.isEncoding(encoding)){thrownewTypeError("Unknown encoding: "+encoding)}varlength=b
/*! https://mths.be/utf8js v2.1.2 by @mathias */
varstringFromCharCode=String.fromCharCode;functionucs2decode(string){varoutput=[];varcounter=0;varlength=string.length;varvalue;varextra;while(counter<length){value=string.charCodeAt(counter++);if(value>=55296&&value<=56319&&counter<length){extra=string.charCodeAt(counter++);if((extra&64512)==56320){output.push(((value&1023)<<10)+(extra&1023)+65536)}else{output.push(value);counter--}}else{output.push(value)}}returnoutput}functionucs2encode(array){varlength=array.length;varindex=-1;varvalue;varoutput="";while(++index<length){value=array[index];if(value>65535){value-=65536;output+=stringFromCharCode(value>>>10&1023|55296);value=56320|value&1023}output+=stringFromCharCode(value)}returnoutput}functioncheckScalarValue(codePoint,strict){if(codePoint>=55296&&codePoint<=57343){if(strict){throwError("Lone surrogate U+"+codePoint.toString(16).toUpperCase()+" is not a scalar value")}returnfalse}returntrue}functioncreateByte(codePoint,shift){returnstringFromCharCode(codePoint>>shift&63|128)}functionencodeCodePoint(codePoint,strict){if((codePoint&4294967168)==0){returnstringFromCharCode(codePoint)}varsymbol="";if((codePoint&4294965248)==0){symbol=stringFromCharCode(codePoint>>6&31|192)}elseif((codePoint&4294901760)==0){if(!checkScalarValue(codePoint,strict)){codePoint=65533}symbol=stringFromCharCode(codePoint>>12&15|224);symbol+=createByte(codePoint,6)}elseif((codePoint&4292870144)==0){symbol=stringFromCharCode(codePoint>>18&7|240);symbol+=createByte(codePoint,12);symbol+=createByte(codePoint,6)}symbol+=stringFromCharCode(codePoint&63|128);returnsymbol}functionutf8encode(string,opts){opts=opts||{};varstrict=false!==opts.strict;varcodePoints=ucs2decode(string);varlength=codePoints.length;varindex=-1;varcodePoint;varbyteString="";while(++index<length){codePoint=codePoints[index];byteString+=encodeCodePoint(codePoint,strict)}returnbyteString}functionreadContinuationByte(){if(byteIndex>=byteCount){throwError("Invalid byte index")}varcontinuationByte=byteArray[byteIndex]&255;byteIndex++;if((continuationByte&192)==128){returncontinuationByte&63}throwError("Invalid continuation byte")}functiondecodeSymbol(strict){varbyte1;varbyte2;varbyte3;varbyte4;varcodePoint;if(byteIndex>byteCount){throwError("Invalid byte index")}if(byteIndex==byteCount){returnfalse}byte1=byteArray[byteIndex]&255;byteIndex++;if((byte1&128)==0){returnbyte1}if((byte1&224)==192){byte2=readContinuationByte();codePoint=(byte1&31)<<6|byte2;if(codePoint>=128){returncodePoint}else{throwError("Invalid continuation byte")}}if((byte1&240)==224){byte2=readContinuationByte();byte3=readContinuationByte();codePoint=(byte1&15)<<12|byte2<<6|byte3;if(codePoint>=2048){returncheckScalarValue(codePoint,strict)?codePoint:65533}else{throwError("Invalid continuation byte")}}if((byte1&248)==240){byte2=readContinuationByte();byte3=readContinuationByte();byte4=readContinuationByte();codePoint=(byte1&7)<<18|byte2<<12|byte3<<6|byte4;if(codePoint>=65536&&codePoint<=1114111){returncodePoint}}throwError("Invalid UTF-8 detected")}varbyteArray;varbyteCount;varbyteIndex;functionutf8decode(byteString,opts){opts=opts||{};varstrict=false!==opts.strict;byteArray=ucs2decode(byteString);byteCount=byteArray.length;byteIndex=0;varcodePoints=[];vartmp;while((tmp=decodeSymbol(strict))!==false){codePoints.push(tmp)}returnucs2encode(codePoints)}module.exports={version:"2.1.2",encode:utf8encode,decode:utf8decode}},{}],29:[function(require,module,exports){(function(Buffer){varisArray=require("isarray");vartoString=Object.prototype.toString;varwithNativeBlob=typeofBlob==="function"||typeofBlob!=="undefined"&&toString.call(Blob)==="[object BlobConstructor]";varwithNativeFile=typeofFile==="function"||typeofFile!=="undefined"&&toString.call(File)==="[object FileConstructor]";module.exports=hasBinary;functionhasBinary(obj){if(!obj||typeofobj!=="object"){returnfalse}if(isArray(obj)){for(vari=0,l=obj.length;i<l;i++){if(hasBinary(obj[i])){returntrue}}returnfalse}if(typeofBuffer==="function"&&Buffer.isBuffer&&Buffer.isBuffer(obj)||typeofArrayBuffer=