ç§ã®çŸåšã®è·æ¥ã§ã¯ãç§ã¯Webéçºè ã§ããããããã£ãŠãã²ãŒã ã§ã¯HTMLãJavaScriptãCSSã®ã¿ã䜿çšããããšèããŠããŸããã ãã©ãã·ã¥ããã£ã³ãã¹ããããŸããã çéå ¥ãã®ããã«èãããŸãããå®éã«ã¯ãHTML + CSS3ã¯éåžžã«åŒ·åã§æè»ãªèŠèŠåããŒã«ã§ãããJavaScriptã§ã²ãŒã ã³ãŒããæžãã®ã¯æ¥œããããšã§ãã ããã«ãã²ãŒã ããããã¯ãŒã¯ãã«ããã¬ã€ã€ãŒã§ãããããã«ã€ã³ã¿ã©ã¯ãã£ãã§ããããšãæãã§ããŸããããã©ãããã«ãŒãã²ãŒã ãã¿ãŒã³ããŒã¹ã®æŠç¥ã¯ãããŸããããã¹ãŠãã¢ã¯ã·ã§ã³ãšåãã«ããã¹ãã§ãã
çµæã¯æ¬¡ã®ãšããã§ãã
èšäºã§ã¯ãããã¡ãã®ãããã¿ã€ããäœæãããšãã«çããäžé£ã®ã¡ã¢ãæ®ããŸããããã¯ããããç°¡åã§è¿ éãªæ¹æ³ãã¢ãããŒããããéèŠãããã®ã§ãã ãã®ãšããµã€ãã£ã³ã°ãªããžãã¹ã®åå¿è ã«ãšã£ãŠãããçš®ã®ãã«ããšããŠãã®èšäºã圹ç«ã€ãšæããŸãã
ã²ãŒã ãã¬ã€
ã²ãŒã ã®ç®çã¯ããã°ã®ã³ãããŒãæé·ããããã¹ãŠã®æµãŠããããç Žå£ããããšã§ãã ã«ããã ã·ã¯ç«¶æå Žãã©ã³ãã ã«èµ°ãåãããã¬ã€ã€ãŒã®ä»äºã¯ãããŸããŸãªé£ã¹ç©ã®åœ¢ã§ããŒãã¹ãèŠã€ããæ»æããããŠããããå©ããããšã§ãã
ã²ãŒã ã®ããŒãã¹ïŒ
cupcake -15xpãšå ¥åãããš5xpãäžããç²è«ãå¢æ®ãã
apple -50hpãå埩ããŸããç²è«ãå®å šã«å¥åº·ãªå Žåã15hpäœåã«è¿œå ãããŸã
ã³ã·ã§ãŠ -æ»æåã5dmå¢å
ã©ããã -2xpãäžããæãè¿ãæµã«æããããããããš3åã®ãã¡ãŒãžãäžããŸã
ãããã³ã°ã¿ã± -1xpãäžãããããã1/2ã®ãã¡ãŒãžãäžããç ç²è ãé ããããšãæ¯ã®ããã·ã§ãããçæãã
2人ãã4人ãŸã§ãã¬ã€ã§ããŸãã ãŸããç°ãªããã©ãŠã¶ã¿ããããµãŒããŒã«æ¥ç¶ããŠãåçããããšãã§ããŸãã
ããã§ãã¬ã€ããŠã¿ãŠãã ãã ã
githubã®ãœãŒã¹ã
ã²ãŒã ã§ã¢ãŒã«ã€ãããŸãã
ã°ã©ãã£ãã¯ã¹
HTMLãšCSSã¯ãã€ã³ã¿ã©ã¯ãã£ãã²ãŒã ã«å¿ èŠãªã°ã©ãã£ãã¯ã¹ã®ã¬ã³ããªã³ã°ã«é¢ããŠã¯ãããã©ãŒãã³ã¹ã®ç¹ã§ã¯ç¢ºãã«ããã»ã©é«éã§ã¯ãããŸããã ããããããã¡ãã®ãããã¿ã€ããäœæããããšãç®æšã§ããã°ããã®ãªãã·ã§ã³ã¯æ©èœããŸãã æçµçã«ãã²ãŒã ã®ã¡ã€ã³ã·ãŒã³ãã¬ã³ããªã³ã°ãããšãã圢ã®ãçãç¬éãã¯ããã°ãããã°ãããã£ã³ãã¹ã«è»¢éã§ããŸãã
2Dã²ãŒã ã§ã°ã©ãã£ãã¯ãæäœããã«ã¯ãã¹ãã©ã€ãã®ç§»åãå転ãã¹ã±ãŒãªã³ã°ã®æäœãå¿ èŠã§ãã
äœçœ®ãèšå®ããŠã¹ãã©ã€ãã移åããŸãã絶察ããã³å·Šãšäžãå€æŽããŸã
ã¹ãã©ã€ããå転ããã«ã¯ã transformïŒrotateã䜿çšããŸãã ãŸãã transformïŒoriginã䜿çšãããšãå転軞ãæå®ã§ããŸãïŒããã©ã«ãã§ã¯ãã¹ãã©ã€ãã®äžå¿ã«ãããŸãïŒã
ã¹ã±ãŒãªã³ã°ããã«ã¯ãé©åãªå€ãbackground-sizeã«èšå®ããåã«ãwidthããããã£ãšheightããããã£ã䜿çšããŠã¹ãã©ã€ãã®ãµã€ãºãå€æŽããŸãã
ããŒããŠã§ã¢ã¢ã¯ã»ã©ã¬ãŒã·ã§ã³
ããã©ãŒãã³ã¹ãæ¹åããã¢ãã¡ãŒã·ã§ã³ãã¹ã ãŒãºã«ããããã«ããã©ãŠã¶ã«GPUã䜿çšããŠã¢ãã¡ãŒã·ã§ã³ãã¬ã³ããªã³ã°ãããããšãã§ããŸãã ãããè¡ãã«ã¯ã3次å ãªããžã§ã¯ããšåæ§ã«ã¹ãã©ã€ãã䜿çšããŸãã 次ã«ãtranslate3dãrotate3dãscale3dã䜿çšããŠã移åãå転ãã¹ã±ãŒãªã³ã°ã®æäœãè¡ããŸãã
ãããã®æäœã¯ãã¹ãŠãããã€ã³ããã§æç»ãããããã€ãã®ã¹ãã©ã€ãããã²ãŒã å ã®ã°ã©ãã£ãã¯ãåéããã®ã«ååã§ããã
ç©çåŠ
ã²ãŒã ãªããžã§ã¯ãã®ã¬ã³ããªã³ã°ã«å ããŠãçžäºã®çžäºäœçšã確ç«ããå¿ èŠããããŸãã
bugsarenaã§ã¯ãã€ã³ã¿ã©ã¯ã·ã§ã³å šäœãã¹ãã©ã€ãã®è¡çªãåŠçããŠããŸãã
ãã¹ãŠãå¯èœãªéãç°¡åã«ããããšãèšç»ãããŠããã®ã§ãç§ãã¡ã¯åŠæ ¡ã®æ°åŠã«éå®ããŸãã
ããããã²ãŒã ã§æãé »ç¹ã«è¡ãããæ°åŠçæäœã®1ã€ã¯ã2ç¹éã®è·é¢ãèŠã€ããããšã§ãã æ¬è³ªçã«ãã¿ã¹ã¯ã¯äžè§åœ¢ã®æ蟺ãèŠã€ããããšã«èŠçŽãããŸãã
次ã®åŒãååŸããŸãã
ããã§ããã®åçŽãªåŒã®ãããã§ããªããžã§ã¯ããŸã§ã®è·é¢ã®æ€çŽ¢ãæãè¿ããŠæãé¢ãããªããžã§ã¯ãã®æ€çŽ¢ãç¹å®ã®ååŸå ã®ãªããžã§ã¯ãã®æ€çŽ¢ãåã®åœ¢ã®ãªããžã§ã¯ãã®è¡çªã®æ€åºãªã©ãå€ãã®æäœãå®è¡ã§ããŸãã
ã²ãŒã ã®ãã¹ãŠã®ãªããžã§ã¯ãã¯ããµã€ãºã20x20ã®ããªãå°ããªã¹ãã©ã€ãã«æç»ãããŸãã圢ç¶ãç¡èŠããŠãçŽåŸ20ã®åã«å æ¥ãããã®ããã«è¡çªãèšç®ã§ããŸãã
ããã«ããã€ãã®æ³šæäºé ïŒ
- è§åºŠå€ãæå®ããã«ã¯ã床ã§ã¯ãªãã©ãžã¢ã³ã䜿çšããŸãã Mathããã®ãã¹ãŠã®è§åºŠå€ããããã«è¿ãããŸãã å®å šãªé©åœã¯2 * PIã©ãžã¢ã³ã«çããããšãæãåºãããŠãã ãã
- ãã¯ãã«ã®æŠå¿µã䜿çšããŠãæ¹åãæã€æ°éãæå®ããŸãã ã¹ãã©ã€ãã®äœçœ®ã§ããããã¯ãã«ã§èšè¿°ã§ããŸãã ç¬èªã®ãã¯ã¿ãŒã¯ã©ã¹ãäœæãããããã®èšäºããã®ä»ã®èšäºã§èª¬æãããŠããã¯ã©ã¹ã䜿çšã§ããŸãã
ããšãã°ããã¯ãã«ã¯å€§ãããšæ¹åãæã£ãŠããããããªããžã§ã¯ãã®é床ãèšå®ããŸãã ãã®å Žåãé床ã2åã«ããã«ã¯ããã¯ãã«ã«2ãæããã ãã§ãå察æ¹åã«é床ãå€ããã«ã¯ããã¯ãã«ãå転ããŸãïŒ-1ãæããŸãïŒã
- ã²ãŒã ã«è€éãªç©çåŠãå¿ èŠãªå Žåã¯ã box2d-jsã«ç®ãåããããšãã§ããŸãã ãã®ã©ã€ãã©ãªã䜿çšãããšãããŸããŸãªåœ¢ç¶ãéåã質éãæ £æ§ãæ©æŠãããã³ãã¥ãŒãã³ç©çåŠã®ãã®ä»ã®å©ç¹ã®ãªããžã§ã¯ãã§ã²ãŒã ã¯ãŒã«ããäœæã§ããŸãã
ãã¯ãã«ã¯ã©ã¹ã®äŸ
// function Vec (x_, y_) { if (typeof x_ == 'object') { this.setV(x_); return; } this.x= typeof x_ == 'number' ? x_ : 0; this.y= typeof y_ == 'number' ? y_ : 0; } Vec.prototype = { // 0 setZero: function() { this.x = 0.0; this.y = 0.0; }, // x y set: function(x_, y_) {this.x=x_; this.y=y_;}, // setV: function(v) { this.x=vx; this.y=vy; }, // negative: function(){ return new Vec(-this.x, -this.y); }, // copy: function(){ return new Vec(this.x,this.y); }, // add: function(v) { this.x += vx; this.y += vy; return this; }, // mubtract: function(v) { this.x -= vx; this.y -= vy; return this; }, // multiply: function(a) { this.x *= a; this.y *= a; return this; }, // div: function(a) { this.x /= a; this.y /= a; return this; }, // length: function() { return Math.sqrt(this.x * this.x + this.y * this.y); }, // ( = 1) normalize: function() { var length = this.length(); if (length < Number.MIN_VALUE) { return 0.0; } var invLength = 1.0 / length; this.x *= invLength; this.y *= invLength; return length; }, // angle: function () { var x = this.x; var y = this.y; if (x == 0) { return (y > 0) ? (3 * Math.PI) / 2 : Math.PI / 2; } var result = Math.atan(y/x); result += Math.PI/2; if (x < 0) result = result - Math.PI; return result; }, // ( ) distanceTo: function (v) { return Math.sqrt((vx - this.x) * (vx - this.x) + (vy - this.y) * (vy - this.y)); }, // x,y x,y vectorTo: function (v) { return new Vec(vx - this.x, vy - this.y); }, // rotate: function (angle) { var length = this.length(); this.x = Math.sin(angle) * length; this.y = Math.cos(angle) * (-length); return this; } };
䜿çšãããéçºãã¿ãŒã³
ç°¡åã«èšããšãã²ãŒã ããžãã¯ã¯æ¬¡ã®ããã«èª¬æã§ããŸãããªããžã§ã¯ãã®é åãæã€ã²ãŒã ã¯ãŒã«ããèšè¿°ãããã²ãŒã ãã¯ã©ã¹ã®ãªããžã§ã¯ãããããŸããããã¯ãã²ãŒã ãªããžã§ã¯ããã¯ã©ã¹ã®äžä»£ã§ãããããã¯ãã¹ãŠã²ãŒã ã¯ãŒã«ãã®ãªããžã§ã¯ãã§ãã ã²ãŒã ã®åã²ãŒã ãã¬ãŒã ã¯ããã¹ãŠã®ã²ãŒã ãªããžã§ã¯ããééããåã¡ãœããã¹ããããåŒã³åºããŸãã åãªããžã§ã¯ãã®stepã¡ãœããã¯ããã®ãã¬ãŒã ã«å¯ŸããŠäœããã¹ãããèšè¿°ããŸãïŒç§»åãè¡çªã®åŠçãç Žæ£ãªã©ïŒãOOPãå®è£ ããããã«ãã²ãŒã ã¯ãããã¯ã¹ã€ã³ãšéçããããã£ããµããŒãããããã«ä¿®æ£ãããJohn Resigã®Simple JavaScript Inheritanceã® Classãªããžã§ã¯ãã䜿çšããŸãã
ãããããã²ãŒã ã§æ°ãããªããžã§ã¯ããäœæããããã®æãæåãããã¿ãŒã³ã®1ã€ã¯ã ãã¡ã¯ããªã¡ãœããã®äœ¿çšã§ãã äžçªäžã®è¡ã¯ãnewãžã®åŒã³åºããä»ããŠãªããžã§ã¯ããçŽæ¥äœæããã®ã§ã¯ãªãããããè¡ãã¡ãœããã䜿çšãããšããããšã§ãã ãã¡ã¯ããªã¡ãœããã䜿çšãããšãæ°ãããªããžã§ã¯ããã²ãŒã ã¯ãŒã«ãã«æ¥ç¶ããæéãçããŸãã
ããšãã°ãBlockã¯ã©ã¹ã®ãªããžã§ã¯ããäœæããã²ãŒã ã¯ãŒã«ãã«å«ããŠãæå®ã®å Žæã«é 眮ããŸãã
game.create('Block', {x: 100, y: 150});
ã¡ãœããã³ãŒããäœæããŸãã
create: function (objectName, params) { // Game.classes // Game.classes var object = new Game.classes[objectName](params); // object.id = ++this.idx; // object.game = this; // this.objects[object.id] = object; // // if (object.isColliding) this.collidingObjects[object.id] = object; // // birth, object.birth(); // return object; },
ã²ãŒã ã«ãŒãã®äœæ
ãã®ãããã²ãŒã ããã§ã«äœæãããŠããå Žåãè€æ°ã®ã²ãŒã ã«ãŒãã§ã²ãŒã ãå€æ§åããããšèããŠããŸãã ã³ãŒãã䜿çšããŠãã¹ãŠã®ã²ãŒã ãªããžã§ã¯ããäœæããïŒã¡ãœããã®åŸã«ã¡ãœãããåŒã³åºãïŒããšã¯éåžžã«éªšãæããæãããŠããŸãã ç¬èªã®ããããšãã£ã¿ãŒãäœæããã«ã¯ãå€ãã®æéãããããŸãã ãã ããç°¡åãªæ¹æ³ããããŸããããã¹ããšãã£ã¿ãŸãã¯IDEã䜿çšããŠã次ã®ã¢ãããŒããèŠèŠçã«äœæã§ããŸãã
!function () { var WIDTH = 20; var HEIGHT = 12; var B = 'Block'; var P = 'Bonus'; var MAP = [ , , , , , , , , , , , , , , , , , , , , , B, , B, , B, B, B, , B, , , , B, , , , B, B, B, , B, , B, , B, , , , B, , , , B, , , , B, , B, , B, B, B, , B, B, B, , B, , , , B, , , , B, , B, , B, , B, , B, , , , B, , , , B, , , , B, , B, , B, , B, , B, B, B, , B, B, B, , B, B, B, , B, B, B, , , , , , , , , , , , , , , , , , , , , , B, , B, , B, B, B, , B, B, B, , B, B, B, , , , , , B, , B, , B, , B, , B, , B, , B, , B, , , , , , B, B, B, , B, B, B, , B, B, , , B, B, , , , , , , B, , B, , B, , B, , B, , B, , B, , B, , , , , , B, , B, , B, , B, , B, B, B, , B, , B, , P, , , ]; Game.maps['Hello'] = Game.Map.extend({ build: function () { var blockSize = 20; for (var i = 0; i < HEIGHT; i++) { for (var j = 0; j < WIDTH; j++) { var index = WIDTH * i + j; if (MAP[index]) this.game.create(MAP[index], {x: blockSize * j, y: blockSize * i}); } } } }) }();
çµæïŒ
ãããã¯ãŒã¯ã³ãŒã
ãããã¯ãŒã¯ã³ãŒãã¯socket.ioã©ã€ãã©ãªã䜿çšããWebãœã±ããã䜿çšããŠèšè¿°ãããã²ãŒã ãµãŒããŒã¯nodejsã§èšè¿°ãããŸãã
察話åãããã¯ãŒã¯ã²ãŒã ã®ç°¡åãªå®è£ ãäœæããTCPãããã³ã«ã®ã¿ã䜿çšã§ãããšããæ¡ä»¶ã§ãããã¯äŸç¶ãšããŠã¿ã¹ã¯ã§ãã
çŸåšã圌ãã¯ãã®ãããªã²ãŒã ã«é«éUDPãããã³ã«ã䜿çšããŠããŸãããæ®å¿µãªããsocket.ioããã¯å©çšã§ããŸãããã匷ãèŠæãããã°WebRTCã®æ¹åãèŠãããšãã§ããŸãã ã²ãŒã ããããããããã«ã¹ã ãŒãºã«å®è¡ããããã¹ãŠã®ã¯ã©ã€ã¢ã³ãã§åæãããããšãéèŠã§ãã ãµãŒããŒã¯ã·ã³ãã«ã§ãã¯ã©ã€ã¢ã³ãã¡ãã»ãŒãžã®éä¿¡ã®ã¿ãåŠçããŸããããã¯ããµãŒããŒã®ã¢ã¯ã·ã§ã³ã®ã¿ãã²ãŒã ã®é²è¡ã«åœ±é¿ããããã§ãã 圌ã¯ã²ãŒã ãªããžã§ã¯ãã®ç¶æ ã®è»¢éãåŠçãããã²ãŒã ã®ç¶æ ãé€ããã²ãŒã ã®äžçã«ã€ããŠã¯äœãç¥ããŸãã-ãã¬ã€ã€ãŒã¯åŸ æ©ããŠããŸã/ã²ãŒã ã¯é²è¡äžã§ã
ã²ãŒã ã®äžæããŒãå šäœããã¬ãŒã ã«åå²ã§ããŸãã ã¯ã©ã€ã¢ã³ãã¯èªåã®ã¢ã¯ã·ã§ã³ã«é¢ããã¡ãã»ãŒãžããµãŒããŒã«éä¿¡ãããµãŒããŒã¯ãããã®ã¡ãã»ãŒãžãèç©ããäžå®æ°ã®ãã¬ãŒã ãèç©ãããåŸã«é¡§å®¢ã«éä¿¡ããŸãã ããã¯ãéåžžã«é«éåãããã¿ãŒã³ããŒã¹ã®æŠç¥ã®äžçš®ã®ããªãšãŒã·ã§ã³ã®ãããªãã®ã§ãããã¹ãŠã®ãã¬ã€ã€ãŒã«ã¯ã移åããããã«æ°ãã¬ãŒã ããäžããããŸããïŒãµãŒããŒã«ã¡ãã»ãŒãžãéä¿¡ïŒã ãããã®ãã¬ãŒã ã®æå¹æéãåãããšããµãŒããŒã¯ã¯ã©ã€ã¢ã³ãã«åã®ç§»åã®ãã¹ãŠã®ã¢ã¯ã·ã§ã³ãéä¿¡ããããã«ãã¬ã€ãéå§ããŸãã åæã«ããã¬ã€ã€ãŒã¯æ°ããåããããããšãã§ããŸãã
ãã®ã¢ãããŒãã¯åçŽã§ãããã¯ã©ã€ã¢ã³ãã¯ãµãŒããŒããã®ã¢ã¯ã·ã§ã³ãããªã¬ãŒãããã¢ã«ãŠã³ããåžžã«èªèãããã®ãã¬ãŒã ãçºçãããŸã§ã²ãŒã ãå®å šã«ç¶è¡ã§ãããšããç¹ã§åªããŠããŸãã ãµãŒããŒã¯ãã¯ã©ã€ã¢ã³ããã¢ã€ãã«ç¶æ ã«ãªããªãããã«ããã®ããŒãã¬ãŒã ã®éå§åã«ã¯ã©ã€ã¢ã³ãã®ã¢ã¯ã·ã§ã³ãéä¿¡ããå¿ èŠããããŸãã ãã®ã¢ãããŒãã®æ¬ ç¹ã¯ããã¬ã€ã€ãŒã®ã¢ã¯ã·ã§ã³ã«å¯Ÿããéåžžã«è¿ éãªåå¿ã§ã¯ãªããäžéšã®ã¢ã¯ãã£ããªå°æã¯ãã¬ã€ããã®ãé£ããã§ãããã
çåã«æããããããŸãã-顧客ã®ã¢ã¯ã·ã§ã³ã®ã¿ãéä¿¡ããå Žåãã©ã³ãã æ§ã«åºã¥ããŠãªããžã§ã¯ãã®åäœãåæããæ¹æ³ã¯ïŒ å®éãããŸããŸãªããŒãã¹ã¯å®å šã«ã©ã³ãã ãªå Žæã«è¡šç€ºãããŸããããã¹ãŠã®é¡§å®¢ã«ãšã£ãŠã¯åãå Žæã§ããå¿ èŠããããŸãã ã«ããã ã·ã¯éåžžã«ã©ã³ãã ã«èµ°ããèµ°ãæ¹åã絶ããå€åãããŸããããã«ããã®ãã«ãªã¹ãã¯ãã¹ãŠåãã§ãªããã°ãªããããã¹ãŠåãã·ããªãªã«åŸãå¿ èŠããããŸãã ãã®åäœã®åæã«é¢ããåé¡ã¯ãã©ã³ãã å€æ°ãã©ãã§äœ¿çšãããŠããMath.randomã䜿çšããã®ã§ã¯ãªããç¬èªã®ç䌌乱æ°ãžã§ãã¬ãŒã¿ãŒïŒPRNGïŒã䜿çšããããšã§è§£æ±ºã§ããŸãã èŠç¹ã¯-ã²ãŒã ãéå§ããåã«ããµãŒããŒã¯ä¹±æ°ãçæããåå ããåã¯ã©ã€ã¢ã³ãã«ãããæž¡ããŸãã ãã®çªå·ã䜿çšããŠããŠã§ããžã¯PRNGãåæåããŸããPRNGã¯ããã¹ãŠã®ã¯ã©ã€ã¢ã³ãã§åãæ¬äŒŒä¹±æ°ã®ã·ãŒã±ã³ã¹ãçæããŸãã ãã®ãããªPRNGã®æãåçŽãªå®è£ ã¯ãMiller Park Generatorã§ãã
Jsã®å®è£ ïŒ
var ParkMillerGenerator = function (initializer) { this.a = 16807; this.m = 2147483647; this.val = initializer || Math.round(2147483647 / 3); } ParkMillerGenerator.prototype = { next: function () { this.val = (this.a * this.val) % this.m; return (this.val / 1000000) % 1; } }
䜿çšæ³ïŒ
var initializer = 333; // , var gen = new ParkMillerGenerator(initializer); // gen.next(); // 0.5967310000000001 gen.next(); // 0.46109599999999773 gen.next(); // 0.07891199999994569;
nodejsã¢ããªã±ãŒã·ã§ã³ãããµãŒãã¹ãäœæããŸã
å°ãå€ããŠãããããããŸãããã圹ã«ç«ã€ã¡ã¢ããããŸãã ãµãŒããŒãäœæãããããç¶ç¶çãªéçšã®ããã®ãµãŒãã¹ãšããŠæŠéãã·ã³ã§å®è¡ãããšããã§ãããã UbuntuãäŸãšããŠãããã©ã®ããã«è¡ããã説æããŸãã
/etc/init.dã«ç§»åããããã«ãµãŒãã¹ã®ååã§ã·ã§ã«ã¹ã¯ãªãããäœæããŸãããã°ãµã¬ãããããŸãã ãBEGIN INIT INFOãã§å§ãŸããããã¯ã¯åãªãã³ã¡ã³ãã§ã¯ãããŸãããããµãŒãã¹ã®èšå®ãåé€ããªãã§ãã ããã
#!/bin/sh ### BEGIN INIT INFO # Provides: bugsarena # Required-Start: $local_fs $remote_fs $network $syslog # Required-Stop: $local_fs $remote_fs $network $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: starts the bugsarena servers # Description: starts the bugsarena servers ### END INIT INFO # ( ) NODE=/usr/bin/node DAEMON_SERVER=/home/me/projects/bugs-arena/server/server.js SERVER_PARAMS="name=Arena-Dogfight map=Dogfight port=8090" NAME=bugsarena DESC="bugsarena servers" # 3 - start, stop restart. # start() { # nodejs pid start-stop-daemon --start --make-pidfile --background --pidfile /var/run/$NAME-server.pid \ --exec $NODE -- $DAEMON_SERVER $SERVER_PARAMS } stop() { # nodejs echo -n "Stopping $DESC: " start-stop-daemon --stop --quiet --pidfile /var/run/$NAME-server.pid } case "$1" in start) start ;; stop) stop ;; restart) stop sleep 1 start ;; *) echo "Usage: $NAME {start|stop|restart}" >&2 exit 1 ;; esac exit 0
ãã¡ã€ã«ãå®è¡å¯èœã«ããŸãã
sudo chmod +x bugsarena
ããã§ã³ãã³ãã䜿çšã§ããŸã
ãµãŒãã¹ãã°ãµã¬ãã¹ã¿ãŒããããŠ
ãµãŒãã¹ãã°ãµã¬ãã¹ããããµãŒãã¹ãéå§ããã³åæ¢ããŸãã
ã·ã¹ãã ã®èµ·åæã«ã²ãŒã ãµãŒããŒãèµ·åãããããšãã§ããŸã
update-rc.d bugsarenaã®ããã©ã«ã
XSSãå¿ããªãã§ãã ããïŒ
æåŸã«ããã©ãŠã¶ã²ãŒã ã«å žåçãªéåžžã«åçŽãªæ»æãæãåºãå¿ èŠããããŸãã divã«ãã¬ã€ã€ãŒã®ãªã¹ãããããšæ³åããŠãã ããã ãããŠãã<script> alertïŒ 'Vasyaãã²ãŒã ã«åå ããŸãïŒ'ïŒ</ script>ããšããååã®ãã¬ã€ã€ãŒãã²ãŒã ã«ç»å ŽããŸãã 圌ã®ååããã¬ãŒã€ãŒã®ãªã¹ããšãšãã«divã«è¿œå ããããã¹ãŠã®ã¯ã©ã€ã¢ã³ããè¿·æãªã¢ã©ãŒãã¡ãã»ãŒãžãåãåããŸãã ãããŠããããã¯ãŸã è±ã§ãã XSSã®è匱æ§ã«ãããä»»æã®ãµã€ãããä»»æã®ã¹ã¯ãªãããå®å šã«ããŒãã§ããŸãã ã¯ã©ã€ã¢ã³ãããéä¿¡ãããããŒã¿ã®ã¹ã¯ãªãŒãã³ã°ãå¿ããªãã§ãã ããã