{"id":408,"date":"2017-06-16T21:47:11","date_gmt":"2017-06-16T12:47:11","guid":{"rendered":"https:\/\/do-gugan.com\/swift\/?p=408"},"modified":"2017-06-16T22:07:34","modified_gmt":"2017-06-16T13:07:34","slug":"%e9%85%8d%e5%88%97-8-%e9%85%8d%e5%88%97%e3%81%ae%e7%af%84%e5%9b%b2%e5%a4%96%e3%82%a8%e3%83%a9%e3%83%bc%e3%82%92%e7%9b%b4%e3%81%99","status":"publish","type":"post","link":"https:\/\/do-gugan.com\/swift\/?p=408","title":{"rendered":"\u914d\u5217 8. \u914d\u5217\u306e\u7bc4\u56f2\u5916\u30a8\u30e9\u30fc\u3092\u76f4\u3059"},"content":{"rendered":"<p>\u914d\u5217\u306e\u771f\u9aa8\u9802\u3001\u756a\u53f7\u306b\u3088\u308b\u30a2\u30af\u30bb\u30b9\u306b\u3064\u3044\u3066\u8aac\u660e\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u4eca\u307e\u3067\u3082\u8907\u6570\u306e\u30ad\u30e3\u30e9\u30af\u30bf\u30fc\u3092\u4f5c\u308b\u6642\u3001\u540d\u524d\u306bexpert1\u3001expert2\u3068\u901a\u3057\u756a\u53f7\u3092\u3064\u3051\u305f\u3053\u3068\u306f\u3042\u308a\u307e\u3057\u305f\u304c\u3001\u914d\u5217\u3092\u4f7f\u3063\u3066\u305d\u306e\u756a\u53f7\u3092\u6307\u5b9a\u3059\u308b\u3068\u3001for\u6587\u306a\u3069\u3067\u7e70\u308a\u8fd4\u3059\u306e\u306b\u975e\u5e38\u306b\u4fbf\u5229\u306b\u306a\u308a\u307e\u3059\uff08\u3053\u306e\u30b9\u30c6\u30fc\u30b8\u3067\u306f\u307e\u3060\u305d\u306e\u6069\u6075\u306f\u3042\u308a\u307e\u305b\u3093\u304c\uff09\u3002<br \/>\n\u4eca\u56de\u306f\u3001for\u6587\u30671\u301c9\u7e70\u308a\u8fd4\u3057\u3066.append\u30e1\u30bd\u30c3\u30c9\u3067teamBlu\u914d\u5217\u306e\u4e2d\u306bBlu\u578b\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u8a95\u751f\u3055\u305b\u3066\u3044\u307e\u3059\u3002\u3053\u3053\u3067\u975e\u5e38\u306b\u91cd\u8981\u306a\u306e\u306f\u3001\u914d\u5217\u306e\u901a\u3057\u756a\u53f7\u306f0\u304b\u3089\u6570\u3048\u308b\u3068\u3044\u3046\u70b9\u3067\u3059\u3002for\u6587\u306b1\u301c9\u3068\u66f8\u3044\u3066\u3044\u308b\u306e\u3067\u3001[1]\u301c[9]\u3068\u306a\u308b\u3068\u601d\u3044\u304c\u3061\u3067\u3059\u304c\u305d\u3046\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u3053\u306e\u30b3\u30fc\u30c9\u3060\u30689\u3064\u306eBlu\u578b\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304cteamBlu\u914d\u5217\u5185\u306b\u3067\u304d\u307e\u3059\u304c\u3001\u305d\u306e\u6307\u5b9a\u65b9\u6cd5\u306fteamBlu[0]\u301cteamBlu[8]\u3068\u306a\u308a\u307e\u3059\u3002<br \/>\n\u305d\u308c\u3092\u8e0f\u307e\u3048\u306619\u884c\u76ee\u4ee5\u964d\u3092\u307f\u308b\u3068\u3001\u6700\u5f8c\u306e24\u884c\u76ee\u3067teamBlu[10]\u3068\u3044\u3046\u80cc\u756a\u53f7\u3092\u6307\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002\u5b58\u5728\u3057\u306a\u3044\u756a\u53f7\u3092\u8aad\u3093\u3067\u3057\u307e\u3046\u3068\u3001\u305d\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306f\u5373\u30af\u30e9\u30c3\u30b7\u30e5\u3057\u3066\u3057\u307e\u3046\u6df1\u523b\u306a\u30d0\u30b0\u3068\u306a\u308a\u307e\u3059\u3002\u884c\u3054\u3068\u524a\u9664\u3057\u3066\u3057\u307e\u3059\u304b\u3001[0]\u301c[8]\u306e\u7bc4\u56f2\u5185\u306b\u6570\u5b57\u3092\u5909\u66f4\u3057\u3066\u3084\u308c\u3070\u30a8\u30e9\u30fc\u306f\u6d88\u3048\u307e\u3059\u3002<\/p>\n<pre class=\"lang:swift decode:true \" >\r\nvar teamBlu: [Character] = []\r\n\r\n\/\/ Note how many instances of Blu are in your array.\r\n\/\/ (\u914d\u5217\u306bBlu\u304f\u3093\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u3044\u304f\u3064\u4f5c\u3063\u3066\u3044\u308b\u3067\u3057\u3087\u3046\uff1f)\r\nfor i in 1...9 {\r\n    teamBlu.append(Character(name: .blu))\r\n}\r\n\r\n\/\/ Place Blu at each column in row 4.\r\n\/\/ (Blu\u541b\u9054\u30924\u884c\u76ee\u306b\u914d\u7f6e\u3057\u307e\u3059)\r\nvar columnPlacement = 0\r\nfor blu in teamBlu {\r\n    world.place(blu, at: Coordinate(column: columnPlacement, row: 4))\r\n    columnPlacement += 1\r\n}\r\n\r\n\/\/ Find the array out of bounds error.\r\n\/\/ (\u914d\u5217\u306e\u7bc4\u56f2\u5916\u30a8\u30e9\u30fc\u3092\u898b\u3064\u3051\u3088\u3046)\r\nteamBlu[0].jump()\r\nteamBlu[2].collectGem()\r\nteamBlu[4].jump()\r\nteamBlu[6].collectGem()\r\nteamBlu[8].jump()\r\nteamBlu[10].collectGem() \/\/\u2190\u3053\u306e\u884c\u3092\u6d88\u3059<\/pre>\n<p>\u3061\u306a\u307f\u306b\u3001\u4eca\u307e\u3067\u30a8\u30e9\u30fc\u304c\u3042\u3063\u305f\u5834\u6240\u306f\u30b3\u30fc\u30c9\u306e\u884c\u982d\u306b\u8d64\u4e38\u304c\u3064\u3044\u3066\u6559\u3048\u3066\u304f\u308c\u307e\u3057\u305f\u3002\u3057\u304b\u3057\u3053\u3053\u3067\u306f\u305d\u3046\u306a\u3089\u305a\u3001\u5b9f\u884c\u3057\u3066\u305d\u306e\u884c\u3092\u51e6\u7406\u3057\u3088\u3046\u3068\u3057\u305f\u77ac\u9593\u306b\u30a8\u30e9\u30fc\u3068\u306a\u308a\u30b3\u30fc\u30c9\u306e\u5b9f\u884c\u304c\u505c\u6b62\u3057\u307e\u3059\u3002\u3053\u308c\u306f\u914d\u5217\u306e\u4e2d\u8eab\u306e\u6570\u304c\u5b9f\u969b\u306b\u5b9f\u884c\u3057\u3066\u305d\u306e\u884c\u3092\u51e6\u7406\u3059\u308b\u77ac\u9593\u306b\u306a\u3063\u3066\u307f\u306a\u3044\u306810\u3042\u308b\u304b\u306a\u3044\u304b\u308f\u304b\u3089\u306a\u3044\u304b\u3089\u3067\u3059\u3002\u307e\u3041\u3001\u3053\u306e\u4f8b\u3067\u306f\u308f\u304b\u3089\u306a\u304f\u3082\u306a\u3044\u3067\u3059\u304c\u3001\u4f8b\u3048\u3070\u30e6\u30fc\u30b6\u304c\u30dc\u30bf\u30f3\u3092\u62bc\u3059\u5ea6\u306b\u65b0\u3057\u3044\u30ad\u30e3\u30e9\u30af\u30bf\u30fc\u304c\u751f\u307e\u308c\u308b\u3088\u3046\u306a\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u3063\u305f\u5834\u5408\u3001\u3044\u3064\u3069\u306e\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u30ad\u30e3\u30e9\u30af\u30bf\u30fc\u6570\u304c\u3044\u304f\u3064\u306b\u306a\u308b\u304b\u306f\u4e8b\u524d\u306b\u306f\u4e88\u6e2c\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<pre class=\"lang:swift decode:true \" >teamBlu[10].collectGem()<\/pre>\n<p>\u3068\u3044\u3046\u4e00\u884c\u305d\u306e\u3082\u306e\u306f\u6587\u6cd5\u3068\u3057\u3066\u306a\u306b\u3082\u304a\u304b\u3057\u3044\u3068\u3053\u308d\u306f\u306a\u3044\u306e\u3067\u3001\u66f8\u3044\u305f\u3060\u3051\u306e\u6642\u70b9\u3067\u30a8\u30e9\u30fc\u5224\u5b9a\u3057\u3066\u8d64\u4e38\u3067\u6559\u3048\u308b\u3053\u3068\u306f\u3067\u304d\u306a\u3044\u306e\u3067\u3059\u3002\u3053\u3046\u3044\u3046\u5b9f\u884c\u3057\u3066\u307f\u306a\u3044\u3068\u308f\u304b\u3089\u306a\u3044\u30a8\u30e9\u30fc\u306f\u975e\u5e38\u306b\u767a\u898b\u304c\u96e3\u3057\u304f\u3001\u8272\u3005\u306a\u30d1\u30bf\u30fc\u30f3\u3067\u691c\u8a3c\u3057\u306a\u3051\u308c\u3070\u306a\u3089\u305a\u3001\u305d\u308c\u304c\u8db3\u308a\u306a\u3044\u3068\u3001\u30ea\u30ea\u30fc\u30b9\u3057\u305f\u5f8c\u3067\u30af\u30e9\u30c3\u30b7\u30e5\u3057\u3066\u3057\u307e\u3046\u30a2\u30d7\u30ea\u3068\u3057\u3066\u554f\u984c\u306b\u306a\u308b\u306e\u3067\u3059\u3002<\/p>\n<script type=\"text\/javascript\">amzn_assoc_ad_type =\"responsive_search_widget\"; amzn_assoc_tracking_id =\"doguganprojec-22\"; amzn_assoc_marketplace =\"amazon\"; amzn_assoc_region =\"JP\"; amzn_assoc_placement =\"\"; amzn_assoc_search_type = \"search_widget\";amzn_assoc_width =\"500\"; amzn_assoc_height =\"400\"; amzn_assoc_default_search_category =\"\"; amzn_assoc_default_search_key =\"iPad\";amzn_assoc_theme =\"light\"; amzn_assoc_bg_color =\"FFFFFF\"; <\/script><script src=\"\/\/z-fe.amazon-adsystem.com\/widgets\/q?ServiceVersion=20070822&Operation=GetScript&ID=OneJS&WS=1&Marketplace=JP\"><\/script>","protected":false},"excerpt":{"rendered":"<p>\u914d\u5217\u306e\u771f\u9aa8\u9802\u3001\u756a\u53f7\u306b\u3088\u308b\u30a2\u30af\u30bb\u30b9\u306b\u3064\u3044\u3066\u8aac\u660e\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u4eca\u307e\u3067\u3082\u8907\u6570\u306e\u30ad\u30e3\u30e9\u30af\u30bf\u30fc\u3092\u4f5c\u308b\u6642\u3001\u540d\u524d\u306bexpert1\u3001expert2\u3068\u901a\u3057\u756a\u53f7\u3092\u3064\u3051\u305f\u3053\u3068\u306f\u3042\u308a\u307e\u3057\u305f\u304c\u3001\u914d\u5217\u3092\u4f7f\u3063\u3066\u305d\u306e\u756a\u53f7\u3092\u6307\u5b9a\u3059\u308b\u3068\u3001for\u6587\u306a\u3069\u3067\u7e70\u308a &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/do-gugan.com\/swift\/?p=408\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;\u914d\u5217 8. \u914d\u5217\u306e\u7bc4\u56f2\u5916\u30a8\u30e9\u30fc\u3092\u76f4\u3059&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,17],"tags":[],"class_list":["post-408","post","type-post","status-publish","format-standard","hentry","category-learncode2","category-array"],"_links":{"self":[{"href":"https:\/\/do-gugan.com\/swift\/index.php?rest_route=\/wp\/v2\/posts\/408","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/do-gugan.com\/swift\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/do-gugan.com\/swift\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/do-gugan.com\/swift\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/do-gugan.com\/swift\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=408"}],"version-history":[{"count":4,"href":"https:\/\/do-gugan.com\/swift\/index.php?rest_route=\/wp\/v2\/posts\/408\/revisions"}],"predecessor-version":[{"id":412,"href":"https:\/\/do-gugan.com\/swift\/index.php?rest_route=\/wp\/v2\/posts\/408\/revisions\/412"}],"wp:attachment":[{"href":"https:\/\/do-gugan.com\/swift\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=408"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/do-gugan.com\/swift\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=408"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/do-gugan.com\/swift\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=408"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}