{"id":23950,"date":"2014-10-09T22:14:59","date_gmt":"2014-10-09T13:14:59","guid":{"rendered":"http:\/\/www.softantenna.com\/wp\/?p=23950"},"modified":"2014-10-09T22:14:59","modified_gmt":"2014-10-09T13:14:59","slug":"javascript-buttle","status":"publish","type":"post","link":"https:\/\/softantenna.com\/blog\/javascript-buttle\/","title":{"rendered":"JavaScript\u306eAI\u3092\u935b\u3048\u3066\u6226\u3046\u30b2\u30fc\u30e0\u300cJavascriptBattle\u300d"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2014\/10\/blogJavascript-Battle.jpg\" alt=\"Javascript Battle\" title=\"Javascript Battle.jpg\" border=\"0\" width=\"546\" height=\"363\" \/><\/p>\n<p>\u300c<a href=\"http:\/\/www.javascriptbattle.com\/\">JavascriptBattle<\/a>\u300d\u306fJavaScript\u3067\u8a18\u8ff0\u3067\u304d\u308bAI\u3092\u935b\u3048\u3066\u30aa\u30f3\u30e9\u30a4\u30f3\u3067\u30d0\u30c8\u30eb\u3059\u308b\u30b2\u30fc\u30e0\u3067\u3059\u3002<\/p>\n<p>AI\u3068\u3044\u3046\u3068\u30cf\u30fc\u30c9\u30eb\u304c\u9ad8\u3044\u30a4\u30e1\u30fc\u30b8\u304c\u3042\u308a\u307e\u3059\u304c\u3001\u5b9f\u969b\u306b\u81ea\u5206\u304c\u8003\u3048\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u306e\u306fmove\u3068\u3044\u3046\u79fb\u52d5\u95a2\u6570\u3060\u3051\u306a\u306e\u3067\u3001\u305d\u308c\u307b\u3069\u8eab\u69cb\u3048\u308b\u5fc5\u8981\u306f\u306a\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002\u3059\u3050\u306b\u4f7f\u3048\u308b\u30b5\u30f3\u30d7\u30eb\u95a2\u6570\u3082\u4f55\u7a2e\u985e\u304b\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u5c11\u3057\u305a\u3064\u7406\u89e3\u3057\u3066\u3044\u3051\u3070\u826f\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2014\/10\/blogJavascript-Battle-2.jpg\" alt=\"Javascript Battle 2\" title=\"Javascript Battle-2.jpg\" border=\"0\" width=\"546\" height=\"397\" \/><\/p>\n<p>\u30b2\u30fc\u30e0\u306b\u53c2\u52a0\u3059\u308b\u3068\u3001\u767b\u9332\u3057\u305f\u81ea\u5206\u306e\u30d2\u30fc\u30ed\u30fc\u304c\u81ea\u52d5\u7684\u306b\u547c\u3073\u51fa\u3055\u308c\u30c1\u30fc\u30e0\u30d0\u30c8\u30eb\u3092\u7e70\u308a\u5e83\u3052\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u30b2\u30fc\u30e0\u306b\u53c2\u52a0\u3057\u3066\u3044\u308b\u3046\u3061\u306bJavaScript\u306e\u77e5\u8b58\u3084\u3001GitHub\u306e\u4f7f\u3044\u65b9\u307e\u3067\u899a\u3048\u3066\u3057\u307e\u3048\u308b\u304b\u3082\u3002\u3068\u3044\u3046\u3053\u3068\u3067\u7d39\u4ecb\u3057\u3066\u307f\u305f\u3044\u3068\u4e3b\u307e\u3059\u3002<\/p>\n<p><!--more--><\/p>\n<h3>\u53c2\u52a0\u65b9\u6cd5<\/h3>\n<p><a href=\"http:\/\/www.javascriptbattle.com\/\">\u516c\u5f0f\u30b5\u30a4\u30c8\u306e<\/a>\u4e00\u756a\u4e0b\u306b\u53c2\u52a0\u65b9\u6cd5\u304c\u66f8\u3044\u3066\u3042\u308a\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2014\/10\/blogJavascript-Battle-1.jpg\" alt=\"Javascript Battle 1\" title=\"Javascript Battle-1.jpg\" border=\"0\" width=\"546\" height=\"324\" \/><\/p>\n<p>GitHub\u306e\u30a2\u30ab\u30a6\u30f3\u30c8\u304c\u5fc5\u8981\u3067\u3001<a href=\"https:\/\/github.com\/JavascriptBattle\/hero-starter\">hero-starter<\/a>\u3068\u3044\u3046\u30ea\u30dd\u30b8\u30c8\u30ea\u3092fork\u3057\u3001\u30b5\u30a4\u30c8\u4e0a\u306e\u300cLogin with GitHub\u300d\u30dc\u30bf\u30f3\u3092\u62bc\u305b\u3070\u53c2\u52a0\u5b8c\u4e86\u3067\u3059\u3002<\/p>\n<h3>\u30d2\u30fc\u30ed\u30fc\u6539\u826f\u65b9\u6cd5<\/h3>\n<p>fork\u3057\u305f\u81ea\u5206\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u306e\u4e2d\u306bhero.js\u3068\u3044\u3046\u30d5\u30a1\u30a4\u30eb\u304c\u542b\u307e\u308c\u3066\u3044\u3066\u3001\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u7de8\u96c6\u3059\u308b\u3053\u3068\u3067\u81ea\u5206\u306e\u30d2\u30fc\u30ed\u30fc\u3092\u5f37\u5316\u3057\u3066\u3044\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u5177\u4f53\u7684\u306b\u306f\u307e\u305a\u30ea\u30dd\u30b8\u30c8\u30ea\u3092clone\u3057(forrestbthomas\u306e\u3068\u3053\u308d\u306f\u81ea\u5206\u306eGitHub\u30a2\u30ab\u30a6\u30f3\u30c8\u540d\u306b\u7f6e\u304d\u63db\u3048\u3066\u304f\u3060\u3055\u3044)\u3002<\/p>\n<pre>\ngit clone https:\/\/github.com\/forrestbthomas\/hero-starter.git\n<\/pre>\n<p>hero.js\u3092\u7de8\u96c6\u3057\u307e\u3059(\u5f8c\u8ff0)\u3002\u305d\u306e\u5f8c\u4ee5\u4e0b\u306e\u624b\u9806\u3067GitHub\u306b\u53cd\u6620\u3057\u307e\u3059\u3002<\/p>\n<pre>\ngit add hero.js\ngit commit\ngit push origin mast\n<\/pre>\n<p>\u307e\u3068\u3081\u3066\u66f8\u3044\u3066\u3044\u307e\u3059\u304cadd \/ commit \/ push\u306f\u305d\u308c\u305e\u308c\u9069\u5207\u306a\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u5b9f\u884c\u3057\u305f\u65b9\u304c\u826f\u3044\u3067\u3059\u3002\u3053\u306e\u8fba\u306f\u901a\u5e38\u306eGitHub\u3092\u7528\u3044\u305f\u958b\u767a\u3068\u540c\u3058\u3067\u3059\u3002<\/p>\n<h3>hero.js\u3063\u3066\u306a\u306b\uff1f<\/h3>\n<p>hero.js\u304c\u30d2\u30fc\u30ed\u30fc\u306eAI\u3092\u5b9a\u7fa9\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u3067\u3001move\u3068\u3044\u3046\u95a2\u6570\u3092\u5b9a\u7fa9\u3057\u307e\u3059\u3002<\/p>\n<p>\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\"Safe Diamond Miner\"\u3068\u3044\u3046\u540d\u524d\u306eAI\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u3066\u3001\u3053\u306e\u5b9a\u7fa9\u306f\u6b21\u306e\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre><code class=\"javascript\">\/\/ \/\/ The \"Safe Diamond Miner\"\nvar move = function(gameData, helpers) {\n  var myHero = gameData.activeHero;\n\n  \/\/Get stats on the nearest health well\n  var healthWellStats = helpers.findNearestObjectDirectionAndDistance(gameData.board, myHero, funct\\\nion(boardTile) {\n    if (boardTile.type === 'HealthWell') {\n      return true;\n    }\n  });\n  var distanceToHealthWell = healthWellStats.distance;\n  var directionToHealthWell = healthWellStats.direction;\n\n\n  if (myHero.health < 40) {\n    \/\/Heal no matter what if low health\n    return directionToHealthWell;\n  } else if (myHero.health < 100 && distanceToHealthWell === 1) {\n    \/\/Heal if you aren't full health and are close to a health well already\n    return directionToHealthWell;\n  } else {\n    \/\/If healthy, go capture a diamond mine!\n    return helpers.findNearestNonTeamDiamondMine(gameData);\n\u3000}\n};\n\n<\/code><\/pre>\n<p>\u3044\u304d\u306a\u308a\u3053\u308c\u3060\u3068\u5206\u304b\u308a\u3065\u3089\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002\u305d\u306e\u5834\u5408\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3055\u308c\u3066\u3044\u308b\u4ed6\u306emove\u30b5\u30f3\u30d7\u30eb\u3092\u53c2\u7167\u3057\u3066\u307f\u308b\u3068\u826f\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u4f8b\u3048\u3070\"Northerner\"\u3068\u3044\u3046AI\u306f\u3001\u540d\u524d\u306e\u901a\u308a\u5e38\u306b\u5317\u306b\u5411\u304b\u3063\u3066\u52d5\u304f\u3053\u306e\u4e0a\u306a\u304f\u5358\u7d14\u306aAI\u3067\u3059\u3002\u79fb\u52d5\u3059\u308b\u65b9\u89d2\u3092\u6587\u5b57\u5217\u3067\u8fd4\u305b\u3070\u3088\u3044\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n<pre><code class=\"javascript\">\/\/ \/\/ The \"Northerner\"\n\/\/ \/\/ This hero will walk North.  Always.\n\/\/ var move = function(gameData, helpers) {\n\/\/   var myHero = gameData.activeHero;\n\/\/   return 'North';\n\/\/ };\n\n<\/code><\/pre>\n<p>\u3082\u3046\u3061\u3087\u3063\u3068\u96e3\u3057\u3044\u3082\u306e\u3060\u3068\u4f8b\u3048\u3070\"unwise Assasin\"\u3068\u3044\u3046\u306e\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre><code class=\"javascript\">\/\/ \/\/ The \"Unwise Assassin\"\n\/\/ \/\/ This hero will attempt to kill the closest enemy hero. No matter what.\n\/\/ var move = function(gameData, helpers) {\n\/\/   var myHero = gameData.activeHero;\n\/\/   if (myHero.health < 30) {\n\/\/     return helpers.findNearestHealthWell(gameData);\n\/\/   } else {\n\/\/     return helpers.findNearestEnemy(gameData);\n\/\/   }\n\/\/ };\n<\/code><\/pre>\n<p>\u30d2\u30fc\u30ed\u30fc\u306e\u30d8\u30eb\u30b9\u304c30\u3088\u308a\u5c0f\u3055\u3044\u5834\u5408\u3001\u8fd1\u304f\u306e\u56de\u5fa9\u5834\u6240\u3092\u63a2\u3057\u3001\u305d\u308c\u4ee5\u5916\u306e\u5834\u5408\u8fd1\u304f\u306e\u6575\u3092\u63a2\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h3>\u30eb\u30fc\u30eb\u306e\u628a\u63e1<\/h3>\n<p>\u4eca\u307e\u3067\u95c7\u96f2\u306bhero.js\u306e\u30b3\u30fc\u30c9\u3092\u8997\u3044\u3066\u304d\u307e\u3057\u305f\u304c\u3001\u3053\u308c\u3060\u3051\u3060\u3068\u3001\u3069\u306e\u3088\u3046\u306a\u65b9\u91dd\u3067\u6539\u826f\u3059\u308c\u3070\u3088\u3044\u306e\u304b\u3088\u304f\u308f\u304b\u308a\u307e\u305b\u3093\u3088\u306d\u3002\u5b9f\u306f\u5f53\u7136\u306a\u304c\u3089\u8a73\u7d30\u306a\u30eb\u30fc\u30eb\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u3053\u308c\u3092\u6291\u3048\u3066\u304a\u304b\u306a\u3044\u3068\u3044\u3051\u307e\u305b\u3093(<a href=\"https:\/\/github.com\/JavascriptBattle\/hero-starter\/blob\/master\/RULES.md\">Rules<\/a>\u3001<a href=\"http:\/\/qiita.com\/jgs\/items\/2e36781a444b0a3b0285\">\u65e5\u672c\u8a9e\u8a33<\/a>)\u3002<\/p>\n<p>\u7c21\u5358\u306b\u8aac\u660e\u3059\u308b\u3068\u3001\u30b2\u30fc\u30e0\u306f\u30c1\u30fc\u30e0\u3067\u4e89\u308f\u308c\u3001\u5168\u3066\u306e\u6575\u3092\u6bba\u3059\u304b\u30011250\u30bf\u30fc\u30f3\u7d4c\u904e\u5f8c\u591a\u304f\u306e\u30c0\u30a4\u30e4\u30e2\u30f3\u30c9\u3092\u53ce\u96c6\u3057\u305f\u30c1\u30fc\u30e0\u304c\u52dd\u5229\u3068\u306a\u308a\u307e\u3059\u3002\u30bf\u30fc\u30f3\u3054\u3068\u306b\u5404\u30d2\u30fc\u30ed\u30fc\u306f\u30c0\u30a4\u30e4\u30e2\u30f3\u30c9\u3092\u63a2\u3057\u305f\u308a\u3001\u6575\u3092\u6bba\u3057\u305f\u308a\u3001\u5473\u65b9\u3092\u56de\u5fa9\u3057\u305f\u308a\u3068\u3044\u3063\u305f\u884c\u52d5\u3092\u884c\u3044\u30c1\u30fc\u30e0\u306e\u52dd\u5229\u3092\u76ee\u6307\u3057\u307e\u3059\u3002<\/p>\n<p>\u30d2\u30fc\u30ed\u30fc\u306f\u30c0\u30a4\u30e4\u30e2\u30f3\u30c9\u304c\u3042\u308c\u3070\u63a1\u6398\u3092\u3001\u6575\u304c\u3044\u308c\u3070\u653b\u6483\u3092\u3001\u5473\u65b9\u304c\u3044\u308c\u3070\u56de\u5fa9\u3092\u884c\u3046\u306e\u3067\u3001\u30d9\u30b9\u30c8\u306a\u884c\u52d5\u3092\u3068\u308b\u3088\u3046\u306bmove\u95a2\u6570\u3092\u6539\u826f\u3057\u3066\u3044\u304f\u3068\u3044\u3046\u308f\u3051\u3067\u3059\u3002<\/p>\n<h3>\u307e\u3068\u3081<\/h3>\n<p>\u306a\u304b\u306a\u304b\u81ea\u5206\u304c\u5f37\u304f\u306a\u3063\u3066\u3044\u308b\u306e\u304b\u3069\u3046\u306a\u306e\u304b\u628a\u63e1\u3057\u3065\u3089\u3044\u3068\u3053\u308d\u304c\u96e3\u70b9\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<a href=\"http:\/\/codetester.javascriptbattle.com\/\">JS BATTLE CODE TESTER<\/a>\u3068\u3044\u3046\u30c6\u30b9\u30c8\u30fb\u30c4\u30fc\u30eb\u306a\u3093\u304b\u3082\u3042\u308b\u306e\u3067\u3046\u307e\u304f\u6d3b\u7528\u3057\u3066\u30b9\u30b3\u30a2\u4e0a\u4f4d\u3092\u76ee\u6307\u3057\u305f\u3044\u3067\u3059\u306d\u3002<\/p>\n<p>\u306f\u307e\u308c\u3070JavaScript\u306e\u77e5\u8b58\u3084GitHub\u306e\u4f7f\u3044\u65b9\u306a\u3069\u3044\u308d\u3093\u306a\u5468\u8fba\u77e5\u8b58\u3082\u8eab\u306b\u3064\u304f\u304b\u3082\u3002\u8208\u5473\u306e\u3042\u308b\u65b9\u306f\u30c1\u30e3\u30ec\u30f3\u30b8\u3057\u3066\u307f\u3066\u306f\u3044\u304b\u304c\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u300cJavascriptBattle\u300d\u306fJavaScript\u3067\u8a18\u8ff0\u3067\u304d\u308bAI\u3092\u935b\u3048\u3066\u30aa\u30f3\u30e9\u30a4\u30f3\u3067\u30d0\u30c8\u30eb\u3059\u308b\u30b2\u30fc\u30e0\u3067\u3059\u3002 AI\u3068\u3044\u3046\u3068\u30cf\u30fc\u30c9\u30eb\u304c\u9ad8\u3044\u30a4\u30e1\u30fc\u30b8\u304c\u3042\u308a\u307e\u3059\u304c\u3001\u5b9f\u969b\u306b\u81ea\u5206\u304c\u8003\u3048\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u306e\u306fmove\u3068\u3044\u3046\u79fb\u52d5\u95a2 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":23947,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[66,75],"tags":[580,655],"class_list":["post-23950","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-webservice","category-software","tag-ai","tag-javascript"],"_links":{"self":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/23950","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/comments?post=23950"}],"version-history":[{"count":0,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/23950\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media\/23947"}],"wp:attachment":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media?parent=23950"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/categories?post=23950"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/tags?post=23950"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}