{"id":395,"date":"2017-06-16T00:03:55","date_gmt":"2017-06-15T15:03:55","guid":{"rendered":"https:\/\/do-gugan.com\/swift\/?p=395"},"modified":"2017-06-17T14:24:10","modified_gmt":"2017-06-17T05:24:10","slug":"%e9%85%8d%e5%88%97-3-%e3%83%96%e3%83%ad%e3%83%83%e3%82%af%e3%82%92%e7%a9%8d%e3%82%80","status":"publish","type":"post","link":"https:\/\/do-gugan.com\/swift\/?p=395","title":{"rendered":"\u914d\u5217 3. \u30d6\u30ed\u30c3\u30af\u3092\u7a4d\u3080"},"content":{"rendered":"<p>\u914d\u5217\u306e\u5404\u90e8\u5c4b\u306b\u306f<\/p>\n<pre class=\"lang:swift decode:true \" >\r\nlet columns = [0, 1, 2, 3, 4, 5]<\/pre>\n<p>\u306e\u3088\u3046\u306b\u6574\u6570\u3092\u5165\u308c\u308b\u3060\u3051\u3067\u306a\u304f\u3001\u69d8\u3005\u306a\u578b\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u5165\u308c\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u30b9\u30c6\u30fc\u30b8\u3067\u306f\u5217\u756a\u53f7\u3068\u884c\u756a\u53f7\u3092\u3072\u3068\u307e\u3068\u307e\u308a\u306b\u3057\u305fCoordinate(\u5ea7\u6a19)\u578b\u3068\u3044\u3046\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u914d\u5217\u306b\u683c\u7d0d\u3057\u307e\u3059\u3002\u3061\u3087\u3063\u3068\u5165\u308c\u5b50\u306e\u3088\u3046\u3067\u3084\u3084\u3053\u3057\u3044\u3067\u3059\u304c\u3001\u300c\u30ab\u30f3\u30de\u3067\u533a\u5207\u3089\u308c\u305f\u6570\u3060\u3051\u3001\u540c\u3058\u578b\u306e\u3082\u306e\u304c\u9806\u756a\u306b\u5165\u308c\u3089\u308c\u308b\u300d\u3068\u3044\u3046\u610f\u5473\u3067\u306f\u6574\u6570\u306e\u6642\u3068\u5168\u304f\u540c\u3058\u306a\u306e\u3067\u6c17\u3092\u697d\u306b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u307e\u305a\u306f\u6b63\u89e3\u4f8b\u306f\u3053\u3093\u306a\u611f\u3058\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"lang:swift decode:true \" >\r\n\/\/ Add the two remaining corner coordinates.\r\n\/\/ (\u6b8b\u308a2\u3064\u306e\u89d2\u306e\u5ea7\u6a19\u3092\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044)\r\nvar blockLocations = [\r\n    Coordinate(column: 0, row: 0),\r\n    Coordinate(column: 3, row: 3),\r\n    Coordinate(column: 0, row: 3),\r\n    Coordinate(column: 3, row: 0),\r\n]\r\n\/\/ Place 5 blocks at each coordinate.\r\n\/\/ (\u305d\u308c\u305e\u308c\u306e\u5ea7\u6a19\u306b5\u3064\u306e\u30d6\u30ed\u30c3\u30af\u3092\u7a4d\u307f\u4e0a\u3052\u3066\u304f\u3060\u3055\u3044\u3002)\r\nfor coordinate in blockLocations {\r\n    for i in 1 ... 5 {\r\n        world.place(Block(), at: coordinate)\r\n    }\r\n}<\/pre>\n<p>3\u884c\u76ee\u304b\u30898\u884c\u76ee\u306f\u9577\u3044\u306e\u3067\u6539\u884c\u3057\u3066\u3044\u307e\u3059\u304c\u3001[]\u3067\u3072\u3068\u307e\u3068\u307e\u308a\u3067\u30014\u3064\u306eCoodinate\u578b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092blockLocations\u3068\u3044\u3046\u540d\u524d\u306e\u914d\u5217\u306b\u5165\u308c\u3066\u3044\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3082\u3057\u30d4\u30f3\u3068\u3053\u306a\u3051\u308c\u3070\u3053\u3046\u3044\u3046\u30b3\u30fc\u30c9\u3067\u8003\u3048\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"lang:swift decode:true \" >\r\nvar coodinate1 = Coordinate(column:0, row:0)\r\nvar coodinate2 = Coordinate(column:3, row:3)\r\nvar coodinate3 = Coordinate(column:0, row:3)\r\nvar coodinate4 = Coordinate(column:3, row:0)\r\n\r\nvar BlockLocations = [coodinate1,coodinate2,coodinate3,coodinate4]\r\n<\/pre>\n<p>\u6b63\u89e3\u4f8b\u30b3\u30fc\u30c9\u306e14\u884c\u76ee\u3067\u3082\u3084\u3063\u3066\u3044\u307e\u3059\u304c\u3001\u300c\u5f8c\u3067\u540d\u524d\u3067\u53c2\u7167\u3067\u304d\u306a\u304f\u3066\u826f\u3044\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u3044\u304d\u306a\u308a\u578b\u540d\u3092\u6307\u5b9a\u3057\u3066\u3082OK\u300d\u3067\u3057\u305f\u3088\u306d\u3002\u300c\u30b9\u30c6\u30fc\u30b8\u3092\u4f5c\u308b\u300d\u7ae0\u306e\u300c<a href=\"https:\/\/do-gugan.com\/swift\/?p=358\">\u968e\u6bb5\u3092\u7f6e\u304f<\/a>\u300d\u3067\u51fa\u3066\u304d\u305f\u7701\u7565\u8a18\u6cd5\u3067\u3059\u3002\u3053\u308c\u3068\u540c\u3058\u3053\u3068\u3092\u3059\u308b\u3068\u3001\u4e0a\u306e\u30b3\u30fc\u30c9\u306f\u3001\u6b63\u89e3\u4f8b\u30b3\u30fc\u30c9\u306e3\u301c8\u884c\u76ee\u306e\u3088\u3046\u306b\u66f8\u3051\u308b\u308f\u3051\u3067\u3059\u3002<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001blockLocation\u306b\u306f4\u7b87\u6240\u306e\u5ea7\u6a19\uff08\u30b9\u30c6\u30fc\u30b8\u306e4\u9685\uff09\u3092\u793a\u30594\u3064\u306eCoordinate\u578b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u5165\u308a\u307e\u3057\u305f\u3002\u3053\u308c\u3092for\u301cin\u6587\u3092\u4f7f\u3063\u3066\u7e70\u308a\u8fd4\u3057\u307e\u3059\u3002blockLocation\u914d\u5217\u304b\u30891\u3064\u305a\u3064\u53d6\u308a\u51fa\u3055\u308c\u3066coodinate\u3068\u3044\u3046\u540d\u524d\u3067\u30eb\u30fc\u30d7\u5185\u3067\u5229\u7528\u53ef\u80fd\u306b\u306a\u308b\u306e\u3067\u300113\u884c\u76ee\u306eworld.place\u6587\u3067at:\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u306e\u4e2d\u8eab\u304c\u7f6e\u304d\u63db\u3048\u3089\u308c\u307e\u3059\u3002\u6700\u521d\u306e\u30eb\u30fc\u30d7\u3067\u306f\u3001<\/p>\n<pre class=\"lang:swift decode:true \" >world.place(Block(), at: Coordinate(column: 0, row: 0))<\/pre>\n<p>\u3068\u3057\u305f\u306e\u3068\u540c\u3058\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u30022\u30eb\u30fc\u30d7\u76ee\u306f<\/p>\n<pre class=\"lang:swift decode:true \" >world.place(Block(), at: Coordinate(column: 3, row: 3))<\/pre>\n<p>\u3067\u3059\u306d\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\u5404\u90e8\u5c4b\u306b\u306f let columns = [0, 1, 2, 3, 4, 5] \u306e\u3088\u3046\u306b\u6574\u6570\u3092\u5165\u308c\u308b\u3060\u3051\u3067\u306a\u304f\u3001\u69d8\u3005\u306a\u578b\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u5165\u308c\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002 \u3053\u306e\u30b9\u30c6\u30fc\u30b8\u3067\u306f\u5217\u756a\u53f7\u3068\u884c\u756a\u53f7\u3092\u3072\u3068\u307e\u3068\u307e\u308a\u306b\u3057\u305fCoo &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/do-gugan.com\/swift\/?p=395\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;\u914d\u5217 3. \u30d6\u30ed\u30c3\u30af\u3092\u7a4d\u3080&#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-395","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\/395","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=395"}],"version-history":[{"count":5,"href":"https:\/\/do-gugan.com\/swift\/index.php?rest_route=\/wp\/v2\/posts\/395\/revisions"}],"predecessor-version":[{"id":420,"href":"https:\/\/do-gugan.com\/swift\/index.php?rest_route=\/wp\/v2\/posts\/395\/revisions\/420"}],"wp:attachment":[{"href":"https:\/\/do-gugan.com\/swift\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=395"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/do-gugan.com\/swift\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=395"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/do-gugan.com\/swift\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=395"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}