{"id":406,"date":"2017-06-16T21:45:32","date_gmt":"2017-06-16T12:45:32","guid":{"rendered":"https:\/\/do-gugan.com\/swift\/?p=406"},"modified":"2017-06-17T21:22:40","modified_gmt":"2017-06-17T12:22:40","slug":"%e9%85%8d%e5%88%97-7-%e5%8f%96%e3%82%8a%e9%99%a4%e3%81%84%e3%81%9f%e5%80%a4%e3%82%92%e8%bf%bd%e5%8a%a0%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/do-gugan.com\/swift\/?p=406","title":{"rendered":"\u914d\u5217 7. \u53d6\u308a\u9664\u3044\u305f\u5024\u3092\u8ffd\u52a0\u3059\u308b"},"content":{"rendered":"<p>world.allPossibleCoordinates\uff08\u30b9\u30c6\u30fc\u30b8\u306e\u5168\u3066\u306e\u30de\u30b9\u306e\u5ea7\u6a19\uff09\u306e\u4ee3\u308f\u308a\u306b\u3001\u6307\u5b9a\u3057\u305f\u884c\u306e\u5168\u30de\u30b9\u3092\u53d6\u5f97\u3059\u308b\u30e1\u30bd\u30c3\u30c9\u304c\u7d39\u4ecb\u3055\u308c\u307e\u3059\u3002\u305d\u308c\u304c3\u884c\u76ee\u3067\u3059\u3002inRows:\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u3067\u6574\u6570\u3092\u6307\u5b9a\u3059\u308b\u3068\u305d\u306e\u884c\u306e\u5168\u30de\u30b9\u306e\u5ea7\u6a19\u304c\u8fd4\u308b\u306e\u3067\u3001\u305d\u308c\u3092\u914d\u5217\u306b\u5165\u308c\u3066\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<p>\u51fa\u984c\u6587\u306b\u306f\u624b\u9806\u3057\u304b\u66f8\u304b\u308c\u3066\u304a\u3089\u305a\u3001\u7d50\u5c40\u30b9\u30c6\u30fc\u30b8\u304c\u3069\u3046\u306a\u308c\u3070\u30af\u30ea\u30a2\u306a\u306e\u304b\u304c\u308f\u304b\u3089\u306a\u3044\u307e\u307e\u3067\u3059\u304c\u3001\u3068\u308a\u3042\u3048\u305a\/\/\u3067\u59cb\u307e\u308b\u30b3\u30e1\u30f3\u30c8\u6587\u306b\u6307\u793a\u3057\u3066\u3042\u308b\u5185\u5bb9\u3092\u57cb\u3081\u3066\u3044\u304f\u3068\u3053\u3093\u306a\u98a8\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"lang:swift decode:true\">\/\/ Create an array of all coordinates in row 2.\r\n\/\/ (2\u884c\u76ee\u306e\u5168\u3066\u306e\u5ea7\u6a19\u306e\u914d\u5217\u3092\u4f5c\u308a\u306a\u3055\u3044)\r\nvar allCoordinates = world.coordinates(inRows: [2])\r\n\/\/ Create an empty array of coordinates.\r\n\/\/ (\u5ea7\u6a19\u306e\u7a7a\u306e\u914d\u5217\u3092\u4f5c\u308a\u306a\u3055\u3044\uff09\r\nvar cdns:[Coordinate] = []\r\n\r\nfor i in 1...12 {\r\n    for tmpcdn in allCoordinates {\r\n        world.place(Block(), at: tmpcdn)\r\n    }\r\n    \/\/ Remove a coordinate and append it to your empty array.\r\n    \/\/ (\u5ea7\u6a19\u3092\u524a\u9664\u3057\u3001\u7a7a\u914d\u5217\u306e\u65b9\u306b\u8ffd\u52a0\u3057\u306a\u3055\u3044)\r\n    cdns.append(allCoordinates.removeFirst())\r\n}\r\n\r\n\/\/ Place a character for each coordinate added to your empty array.\r\n\/\/ (\u7a7a\u914d\u5217\u306b\u8ffd\u52a0\u3057\u305f\u5404\u5ea7\u6a19\u306b\u30ad\u30e3\u30e9\u30af\u30bf\u30fc\u3092\u914d\u7f6e\u3057\u306a\u3055\u3044)\r\nfor tmpcdn in cdns {\r\n    world.place(Character(), at: tmpcdn)\r\n}\r\n<\/pre>\n<p>\u5148\u306b\u5b9f\u884c\u7d50\u679c\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002\u30b7\u30e5\u30fc\u30eb\u306a\u5149\u666f\u3067\u3059\u306d(\u7b11)\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-455 size-full\" src=\"https:\/\/do-gugan.com\/swift\/wp-content\/uploads\/2017\/06\/IMG_0025.jpg\" alt=\"\" width=\"1018\" height=\"913\" srcset=\"https:\/\/do-gugan.com\/swift\/wp-content\/uploads\/2017\/06\/IMG_0025.jpg 1018w, https:\/\/do-gugan.com\/swift\/wp-content\/uploads\/2017\/06\/IMG_0025-300x269.jpg 300w, https:\/\/do-gugan.com\/swift\/wp-content\/uploads\/2017\/06\/IMG_0025-768x689.jpg 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>\u307e\u305a9\u884c\u76ee\u306efor\u301cin\u6587\u3067\u306f\u30012\u5217\u76ee\u306e\u5168\u3066\u306e\u30de\u30b9\u306e\u5ea7\u6a19\u304c\u914d\u5217\u306b\u5165\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u305d\u308c\u3092tmpcdn\u3068\u3044\u3046\u540d\u524d\u30671\u3064\u305a\u3064\u53d6\u308a\u51fa\u3057\u3066\u30eb\u30fc\u30d7\u5185\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002\u3061\u306a\u307f\u306btmp\u3068\u3044\u3046\u306e\u306f\u300c\u4e00\u6642\u7684\u306a\u300d\u3068\u3044\u3046\u610f\u5473\u306etemporary\u3092\u7565\u3057\u305f\u3082\u306e\u3001cdn\u306fcoodinate\u3092\u7565\u3057\u305f\u3082\u306e\u3067\u3001\u3042\u308f\u305b\u3066tmpcdn\u3067\u3059\u3002\u6df1\u3044\u610f\u5473\u306f\u3042\u308a\u307e\u305b\u3093\u306e\u3067\u3001\u81ea\u5206\u3067\u61b6\u3048\u3084\u3059\u3044\u540d\u524d\u306b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u3067\u3001\u305d\u308c\u3089\u306e\u5168\u30de\u30b9\u306bword.place()\u30e1\u30bd\u30c3\u30c9\u304c\u5b9f\u884c\u3055\u308c\u308b\u306e\u3067\u3001\u7aef\u304b\u3089\u7aef\u307e\u3067\u30d6\u30ed\u30c3\u30af\u304c1\u6bb5\u7a4d\u307f\u4e0a\u304c\u308a\u307e\u3059\u3002<\/p>\n<p>\u6b21\u306b14\u884c\u76ee\u306e <\/p>\n<pre class=\"lang:swift decode:true \" >cdns.append(allCoordinates.removeFirst())<\/pre>\n<p>\u3067\u3059\u304c\u3001\u307e\u305a()\u5185\u306eallCoordinates.removeFirst()\u3067\u3001\u5168\u3066\u306e2\u5217\u76ee\u306e\u5ea7\u6a19\u306e\u914d\u5217\u304b\u3089\u3001\u6700\u521d\u306e1\u3064\u3092\u524a\u9664\u3057\u307e\u3059\u3002\u3064\u307e\u308a(0,2)\u301c(19,2\uff09\u306e20\u500b\u306e\u914d\u5217\u304b\u3089\u5148\u982d\u306e(0,2\uff09\u304c\u629c\u304b\u308c\u3001(1,2\uff09\u301c(19,2)\u306e19\u500b\u304c\u6b8b\u308a\u307e\u3059\u3002\u914d\u5217\u5185\u3067\u306e\u80cc\u756a\u53f7\u306f\u8a70\u3081\u3089\u308c\u3066\u3044\u304d\u307e\u3059\u304c\u3001\u5b9f\u969b\u306e\u5ea7\u6a19\u81ea\u4f53\u304c\u8a70\u307e\u308b\u308f\u3051\u3067\u306f\u306a\u3044\u306e\u3067\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002allCoordinates[0]\u304c(0,2)\u304b\u3089(1,2)\u306b\u306a\u308a\u307e\u3059\u3002\u629c\u3044\u305f(0,2)\u306e\u5ea7\u6a19\u304c()\u306e\u5916\u5074\u306b\u3042\u308bcdns\uff08\u6700\u521d\u306b\u7528\u610f\u3057\u3066\u304a\u3044\u305f\u7a7a\u306e\u914d\u5217\uff09\u306b.append(\u8ffd\u52a0)\u3055\u308c\u307e\u3059\u3002\u3061\u3087\u3063\u3068\u7279\u6b8a\u306a\u66f8\u304d\u65b9\u3067\u3059\u304c\u3001removeFirst()\u306a\u3069\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3046\u3068\u3001\u305d\u3053\u306b\u524a\u9664\u3057\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u305d\u306e\u884c\u306e\u4e2d\u306b\u4e00\u6642\u7684\u306b\u6b8b\u308b\u3068\u8003\u3048\u3066\u304f\u3060\u3055\u3044\u3002\u306a\u306e\u3067\u3001.append()\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3068\u3057\u3066\u5f15\u304d\u7d99\u304c\u308c\u307e\u3059\u3002<br \/>\n\u3053\u308c\u304c8\u884c\u76ee\u306efor i in 1&#8230;12\u306b\u3088\u3063\u306612\u56de\u7e70\u308a\u8fd4\u3055\u308c\u308b\u308f\u3051\u3067\u3059\u304c\u30012\u56de\u76ee\u306fallCordinates\u306e\u4e2d\u304c(1,2\uff09\u301c(19,2)\u306b\u306a\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u3072\u3068\u3064\u5965\u306e(1,2)\u304b\u3089(19,2)\u306e19\u5ea7\u6a19\u306b\u5bfe\u3057\u3066world.place()\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002\u7d50\u679c\u3068\u3057\u3066\u3055\u3063\u304d\u3088\u308a\u30821\u5217\u77ed\u3044\u5f62\u30672\u6bb5\u76ee\u304c\u5f62\u6210\u3055\u308c\u307e\u3059\u3002\u305d\u306e\u3042\u3068\u307e\u305f.remove\u3055\u308c\u308b\u306e\u3067\u30013\u5468\u76ee\u306f(2,2)\u301c(19,2)\u3068\u306a\u308a\u3001\u3001\u7d50\u679c\u3068\u3057\u30661\u6bb5\u4e0a\u304c\u308b\u3054\u3068\u306b1\u5217\u5c11\u306a\u3044\u30d6\u30ed\u30c3\u30af\u304c12\u6bb5\u7a4d\u307f\u4e0a\u304c\u3063\u3066\u3044\u304d\u307e\u3059\u3002<br \/>\n8\u301c15\u884c\u76ee\u306e\u30eb\u30fc\u30d7\u304c\u7d42\u308f\u3063\u305f\u5f8c\u306f\u300119\u884c\u76ee\u304b\u3089\u306e\u30eb\u30fc\u30d7\u3067\u3059\u3002\u3053\u308c\u306b\u306f1\u884c\u4e0a\u304c\u308b\u3054\u3068\u306b\u524a\u3089\u308c\u305f\u5de6\u7aef\u306e\u5ea7\u6a19\u304c1\u3064\u305a\u3064\u5165\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u305d\u308c\u3089\u3059\u3079\u3066\u306b\u30ad\u30e3\u30e9\u30af\u30bf\u30fc\u3092\u7f6e\u3044\u3066\u3044\u304f\u3068\u3001\u5199\u771f\u306e\u3088\u3046\u306b\u306a\u308b\u308f\u3051\u3067\u3059\u3002<br \/>\n\u3084\u3084\u3053\u3057\u3044\u3067\u3059\u304c\u9806\u3092\u8ffd\u3063\u3066\u3058\u3063\u304f\u308a\u8003\u3048\u3066\u307f\u307e\u3057\u3087\u3046\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>world.allPossibleCoordinates\uff08\u30b9\u30c6\u30fc\u30b8\u306e\u5168\u3066\u306e\u30de\u30b9\u306e\u5ea7\u6a19\uff09\u306e\u4ee3\u308f\u308a\u306b\u3001\u6307\u5b9a\u3057\u305f\u884c\u306e\u5168\u30de\u30b9\u3092\u53d6\u5f97\u3059\u308b\u30e1\u30bd\u30c3\u30c9\u304c\u7d39\u4ecb\u3055\u308c\u307e\u3059\u3002\u305d\u308c\u304c3\u884c\u76ee\u3067\u3059\u3002inRows:\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u3067\u6574\u6570\u3092\u6307\u5b9a\u3059\u308b\u3068\u305d\u306e\u884c\u306e &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/do-gugan.com\/swift\/?p=406\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;\u914d\u5217 7. \u53d6\u308a\u9664\u3044\u305f\u5024\u3092\u8ffd\u52a0\u3059\u308b&#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-406","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\/406","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=406"}],"version-history":[{"count":6,"href":"https:\/\/do-gugan.com\/swift\/index.php?rest_route=\/wp\/v2\/posts\/406\/revisions"}],"predecessor-version":[{"id":462,"href":"https:\/\/do-gugan.com\/swift\/index.php?rest_route=\/wp\/v2\/posts\/406\/revisions\/462"}],"wp:attachment":[{"href":"https:\/\/do-gugan.com\/swift\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=406"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/do-gugan.com\/swift\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=406"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/do-gugan.com\/swift\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=406"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}