{"id":278,"date":"2024-09-20T09:02:36","date_gmt":"2024-09-20T09:02:36","guid":{"rendered":"https:\/\/xcode15.shimayugu.jp\/?p=278"},"modified":"2024-12-29T06:52:10","modified_gmt":"2024-12-28T21:52:10","slug":"%e6%96%b0swift%e3%81%a7%e8%a1%8c%e3%81%93%e3%81%86-%e7%ac%ac%ef%bc%92%ef%bc%97%e5%9b%9e%e3%80%8c%e3%83%9d%e3%83%bc%e3%82%ab%e3%83%bc%ef%bc%91%ef%bc%92%e3%80%8d%e3%80%80%e7%94%b0%e9%83%a8%e4%ba%95","status":"publish","type":"post","link":"https:\/\/xcode15.shimayugu.jp\/?p=278","title":{"rendered":"\u65b0Swift\u3067\u884c\u3053\u3046&#8230;\u7b2c\uff12\uff17\u56de\u300c\u30dd\u30fc\u30ab\u30fc\uff11\uff12\u300d\u3000\u7530\u90e8\u4e95\u4fdd"},"content":{"rendered":"\n<p><a href=\"https:\/\/shimayugu.sakura.ne.jp\/?p=2298\"><\/a><a href=\"https:\/\/shimayugu.sakura.ne.jp\/?p=2473\">\u76ee\u6b21<\/a>\u3000<a href=\"https:\/\/xcode15.shimayugu.jp\/?p=759\">\u89e3\u8aac\u7de8<\/a><\/p>\n\n\n\n<p>\u3000\u3055\u3066\u3001\u30b2\u30fc\u30e0\u30aa\u30fc\u30d0\u30fc\u306e\u8868\u793a\u3067\u3059\u304c\u3001\u50d5\u306f\u6700\u521d\u3001\u5358\u7d14\u306bflush\u95a2\u6570\u306e\u6700\u5f8c\u306b\u5165\u308c\u307e\u3057\u305f\u3002\u3059\u308b\u3068\u30b2\u30fc\u30e0\u30aa\u30fc\u30d0\u30fc\u3068\u51fa\u305f\u5f8c\u306b\u30d6\u30bf\u3068\u51fa\u3066\u3057\u307e\u3044\u307e\u3059\u3002\u305d\u3053\u3067display\u95a2\u6570\u306b\u3044\u308c\u3088\u3046\u3068\u601d\u3044\u5165\u308c\u3066\u307f\u308b\u3068\u3001\u70b9\u3092\u8ced\u3051\u3066\u3044\u308b\u6642\u306b\u5143\u306e\u70b9\u304c0\u306b\u306a\u308b\u3068\u30b2\u30fc\u30e0\u30aa\u30fc\u30d0\u30fc\u306e\u8868\u793a\u304c\u51fa\u3066\u3057\u307e\u3044\u307e\u3059\u3002\u8003\u3048\u3066\u307f\u308c\u3070\u5f53\u305f\u308a\u524d\u3067\u3059\u306d\u3002\u99ac\u9e7f\u306a\u4e8b\u3092\u3057\u307e\u3057\u305f\u3002\u305d\u3053\u3067flush\u95a2\u6570\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u8868\u793a\u90e8\u5206\u3001\u30da\u30a2\u3068\u30da\u30a2\u4ee5\u5916\u3067\u5206\u304b\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u3053\u308c\u3092\u4e00\u3064\u306b\u3057\u3066\u3001\u3053\u3053\u3067\u30b2\u30fc\u30e0\u30aa\u30fc\u30d0\u30fc\u3082\u8868\u793a\u3059\u308b\u3088\u3046\u306b\u3059\u308b\u4e8b\u306b\u3057\u307e\u3057\u305f\u3002\u3053\u306e\u6539\u9020\u3092\u3084\u3063\u3066\u307f\u308b\u3068\u3001\u7d50\u69cb\u3059\u3063\u304d\u308a\u3057\u307e\u3057\u305f\u3002\u305d\u3082\u305d\u3082\u30e1\u30c3\u30bb\u30fc\u30b8\u8868\u793a\u90e8\u5206\u304c\u4e8c\u3064\u306b\u5206\u304b\u308c\u3066\u3044\u305f\u306e\u304c\u554f\u984c\u3067\u3057\u305f\u3002\u3053\u308c\u306f\u9806\u756a\u306b\u307e\u305a\u30d5\u30e9\u30c3\u30b7\u30e5\u3092\u5165\u308c\u3066\u3001\u30da\u30a2\u3092\u5165\u308c\u3066\u3068\u3084\u3063\u305f\u306e\u30672\u3064\u306b\u5206\u304b\u308c\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u4ee5\u4e0bflush\u95a2\u6570\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3067\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-swift\" data-lang=\"Swift\" data-line=\"10-11,14,15,35-39,78,102-106,107,112-116,117-121\" data-show-lang=\"1\"><code>    func flush() {\n        var ck = 0\n        for i in 0 ..&lt; 5 {\n            for j in i + 1 ..&lt; 5 {\n                if eachCard[i].tag % 13 == eachCard[j].tag % 13 {\n                    ck += 1\n                }\n            }\n        }\n        var title: String\n        var msg: String = &quot;&quot;\n        var mul = 0\n        if ck &gt; 0 {\n            \/\/var msg: String\n            title = &quot;\u30da\u30a2&quot;\n            switch ck {\n            case 1:\n                msg = &quot;\u30ef\u30f3\u30da\u30a2&quot;\n                mul = 1\n            case 2:\n                msg = &quot;\u30c4\u30fc\u30da\u30a2&quot;\n                mul = 2\n            case 3:\n                msg = &quot;\u30b9\u30ea\u30fc\u30ab\u30fc\u30c9&quot;\n                mul = 3\n            case 4:\n                msg = &quot;\u30d5\u30eb\u30cf\u30a6\u30b9&quot;\n                mul = 6\n            case 6:\n                msg = &quot;\u30d5\u30a9\u30fc\u30ab\u30fc\u30c9&quot;\n                mul = 8\n            default:\n                msg = &quot;&quot;\n            }\n            \/\/let alert = UIAlertController()\n            \/\/alert.title = &quot;\u30da\u30a2&quot;\n            \/\/alert.message = msg + &quot;\u3067\u3059&quot;\n            \/\/alert.addAction(UIAlertAction(title: &quot;OK&quot;, style: .default))\n            \/\/present(alert, animated: true, completion: nil)\n        } else {\n            var chk = true\n            let mark: Int = eachCard[0].tag \/ 13\n            for i in 1 ..&lt; 5 {\n                if mark != eachCard[i].tag \/ 13 {\n                    chk = false\n                    break\n                }\n            }\n            var min = 0\n            var max = 0\n            min = eachCard[0].tag % 13\n            max = eachCard[0].tag % 13\n            var isAce = false\n            var isKing = false\n            for i in 0 ..&lt; 5 {\n                if eachCard[i].tag % 13 == 0 {\n                    isAce = true\n                }\n                if eachCard[i].tag % 13 == 12 {\n                    isKing = true\n                }\n            }\n            let up = isAce && isKing\n            for i in 1 ..&lt; 5 {\n                var val = eachCard[i].tag % 13\n                if up {\n                    if val &lt; 4 {\n                        val = val + 13\n                    }\n                }\n                if val &lt; min {\n                    min = val\n                }\n                if max &lt; val {\n                    max = val\n                }\n            }\n            \/\/var msg: String = &quot;&quot;\n            if max - min == 4 && max == 13 {\n                msg = &quot;\u30ed\u30a4\u30e4\u30eb&quot;\n            }\n            if max - min == 4 {\n                msg += &quot;\u30b9\u30c8\u30ec\u30fc\u30c8&quot;\n            }\n            if chk {\n                msg += &quot;\u30d5\u30e9\u30c3\u30b7\u30e5&quot;\n            }\n            if msg == &quot;\u30b9\u30c8\u30ec\u30fc\u30c8&quot; {\n                mul = 4\n            } else if msg == &quot;\u30d5\u30e9\u30c3\u30b7\u30e5&quot; {\n                mul = 5\n            } else if msg == &quot;\u30b9\u30c8\u30ec\u30fc\u30c8\u30d5\u30e9\u30c3\u30b7\u30e5&quot; {\n                mul = 7\n            } else if msg == &quot;\u30ed\u30a4\u30e4\u30eb\u30b9\u30c8\u30ec\u30fc\u30c8&quot; {\n                mul = 9\n            } else if msg == &quot;\u30ed\u30a4\u30e4\u30eb\u30b9\u30c8\u30ec\u30fc\u30c8\u30d5\u30e9\u30c3\u30b7\u30e5&quot; {\n                mul = 10\n            } else {\n                msg = &quot;\u30d6\u30bf&quot;\n                mul = 0\n            }\n            \/\/let alert = UIAlertController()\n            \/\/alert.title = msg\n            \/\/alert.message = msg + &quot;\u3067\u3059&quot;\n            \/\/alert.addAction(UIAlertAction(title: &quot;OK&quot;, style: .default))\n            \/\/present(alert, animated: true, completion: nil)\n            title = msg\n        }\n        point = point + betPoint * mul\n        betPoint = 0\n\n        if point == 0 {\n            title = &quot;\u30b2\u30fc\u30e0\u30aa\u30fc\u30d0\u30fc &quot;\n            msg = &quot;\u30b2\u30fc\u30e0\u30aa\u30fc\u30d0\u30fc &quot;\n            point = 10\n        }\n        let alert = UIAlertController()\n        alert.title = title\n        alert.message = msg + &quot;\u3067\u3059&quot;\n        alert.addAction(UIAlertAction(title: &quot;OK&quot;, style: .default))\n        present(alert, animated: true, completion: nil)\n        display()\n    }\n<\/code><\/pre><\/div>\n\n\n\n<p>\u3000\u3055\u3066\u3001\u3053\u308c\u3067\u30b2\u30fc\u30e0\u3092\u3084\u3063\u3066\u307f\u308b\u3068\u5224\u308b\u306e\u3067\u3059\u304c\u3001\u914d\u3089\u308c\u305f\u6642\u306b\u65e2\u306b\u30ef\u30f3\u30da\u30a2\u304c\u51fa\u6765\u3066\u3044\u305f\u5834\u5408\u3001\u30ef\u30f3\u30da\u30a2\u306e\u6240\u3092\u6b8b\u305b\u3070\u3001\u8ced\u3051\u70b9\u3092\u5168\u90e8\u8ced\u3051\u3066\u3082\u5fc5\u305a\u9084\u3063\u3066\u304f\u308b\u306e\u3067\u7d76\u5bfe\u306b\u640d\u306f\u3057\u307e\u305b\u3093\u3002\u3082\u3063\u3068\u5927\u304d\u306a\u5f79\u304c\u51fa\u6765\u3066\u3044\u305f\u3089\u5fc5\u305a\u5f97\u3092\u3057\u307e\u3059\u3002\u305d\u3053\u3067\u3001\u6700\u521d\u914d\u3089\u308c\u305f\u30ab\u30fc\u30c9\u3067\u51fa\u6765\u3066\u3044\u305f\u5f79\u30920\u500d\u3068\u3057\u3066\u3001\u305d\u308c\u3088\u308a\u4e0a\u306e\u5f79\u304c\u51fa\u6765\u305f\u3089\u305d\u306e\u500d\u6570\u304b\u3089\u3001\u914d\u3089\u308c\u305f\u30ab\u30fc\u30c9\u3067\u51fa\u6765\u3066\u3044\u305f\u5f79\u306e\u500d\u6570\u3092\u5f15\u3044\u3066\u5f97\u70b9\u3068\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002\u5206\u304b\u308a\u306b\u304f\u3044\u306e\u3067\u4f8b\u3092\u793a\u3059\u3068\u3001\u6700\u521d\u30c4\u30fc\u30da\u30a2\u304c\u51fa\u6765\u3066\u3044\u3066\u30011\u679a\u66ff\u3048\u3066\u30d5\u30eb\u30cf\u30a6\u30b9\u306b\u306a\u3063\u305f\u3068\u3057\u307e\u3059\u3002\u30c4\u30fc\u30da\u30a2\u306e\u500d\u6570\u306f2\u3001\u30d5\u30eb\u30cf\u30a6\u30b9\u306e\u500d\u6570\u306f6\u306a\u306e\u3067\u30016\u304b\u30892\u3092\u5f15\u3044\u30664\u500d\u3068\u306a\u308a\u307e\u3059\u3002\u3053\u306e\u6539\u9020\u3092\u3084\u3063\u3066\u307f\u3066\u4e0b\u3055\u3044\u3002<\/p>\n\n\n\n<p>\u3000\u30d0\u30b0\u304c\u3042\u308a\u307e\u3057\u305f\u3002<a href=\"https:\/\/xcode15.shimayugu.jp\/?p=238\">\u7b2c\uff12\uff13\u56de\u300c\u30dd\u30fc\u30ab\u30fc\uff18\u300d<\/a>\u306e\u6700\u5f8c\u306e\u65b9\u3092\u53c2\u7167\u3057\u3066\u4e0b\u3055\u3044\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/shimayugu.sakura.ne.jp\/?p=2298\"><\/a><a href=\"https:\/\/shimayugu.sakura.ne.jp\/?p=2473\">\u76ee\u6b21<\/a>\u3000<a href=\"https:\/\/xcode15.shimayugu.jp\/?p=759\">\u89e3\u8aac\u7de8<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u6b21\u3000\u89e3\u8aac\u7de8 \u3000\u3055\u3066\u3001\u30b2\u30fc\u30e0\u30aa\u30fc\u30d0\u30fc\u306e\u8868\u793a\u3067\u3059\u304c\u3001\u50d5\u306f\u6700\u521d\u3001\u5358\u7d14\u306bflush\u95a2\u6570\u306e\u6700\u5f8c\u306b\u5165\u308c\u307e\u3057\u305f\u3002\u3059\u308b\u3068\u30b2\u30fc\u30e0\u30aa\u30fc\u30d0\u30fc\u3068\u51fa\u305f\u5f8c\u306b\u30d6\u30bf\u3068\u51fa\u3066\u3057\u307e\u3044\u307e\u3059\u3002\u305d\u3053\u3067display\u95a2\u6570\u306b\u3044\u308c\u3088\u3046\u3068\u601d\u3044\u5165\u308c\u3066\u307f\u308b\u3068\u3001\u70b9\u3092\u8ced\u3051\u3066\u3044\u308b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-278","post","type-post","status-publish","format-standard","hentry","category-swift"],"_links":{"self":[{"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=\/wp\/v2\/posts\/278","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=278"}],"version-history":[{"count":17,"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=\/wp\/v2\/posts\/278\/revisions"}],"predecessor-version":[{"id":1021,"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=\/wp\/v2\/posts\/278\/revisions\/1021"}],"wp:attachment":[{"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=278"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=278"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=278"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}