{"id":759,"date":"2024-10-22T17:10:15","date_gmt":"2024-10-22T08:10:15","guid":{"rendered":"https:\/\/xcode15.shimayugu.jp\/?p=759"},"modified":"2024-12-29T07:34:13","modified_gmt":"2024-12-28T22:34:13","slug":"%e6%96%b0swift%e3%81%a7%e8%a1%8c%e3%81%93%e3%81%86%e7%ac%ac%ef%bc%97%ef%bc%94%e5%9b%9e%e3%80%8c%e3%83%9d%e3%83%bc%e3%82%ab%e3%83%bc%ef%bc%91%ef%bc%92%e8%a7%a3%e8%aa%ac%e3%80%8d%e3%80%80","status":"publish","type":"post","link":"https:\/\/xcode15.shimayugu.jp\/?p=759","title":{"rendered":"\u65b0Swift\u3067\u884c\u3053\u3046\u2026\u7b2c\uff17\uff14\u56de\u300c\u30dd\u30fc\u30ab\u30fc\uff11\uff12\u89e3\u8aac\u300d\u3000\u7530\u90e8\u4e95\u4fdd"},"content":{"rendered":"\n<p><a href=\"https:\/\/shimayugu.sakura.ne.jp\/?p=2473\">\u76ee\u6b21<\/a>\u3000<a href=\"https:\/\/xcode15.shimayugu.jp\/?p=278\">\u901a\u5e38\u7248<\/a><\/p>\n\n\n\n<p>\u3000\u30b2\u30fc\u30e0\u30aa\u30fc\u30d0\u30fc\u3092\u5165\u308c\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-swift\" data-lang=\"Swift\" data-line=\"18-21,22-23,24,140-141,148-154,155-160\" data-show-lang=\"1\"><code>    \/\/\/\u5f79\u5224\u5b9a\u95a2\u6570\n    func flush() {\n        \/\/\u30c1\u30a7\u30c3\u30af\u5909\u6570\n        var ck = 0\n        \/\/\u57fa\u6e96\u30ab\u30fc\u30c9\n        for i in 0 ..&lt; 4 {\n            \/\/\u6bd4\u8f03\u30ab\u30fc\u30c9\n            for j in i + 1 ..&lt; 5 {\n                \/\/\u30ca\u30f3\u30d0\u30fc\u304c\u540c\u3058\u306a\u3089\n                if eachCard[i].tag % 13 == eachCard[j].tag % 13 {\n                    \/\/\u30c1\u30a7\u30c3\u30af\u5909\u6570\u3092\uff0b\uff11\u3059\u308b\n                    ck += 1\n                }\n            }\n        }\n        \/\/\u30ea\u30bf\u30fc\u30f3\u500d\u7387\n        var mul = 0\n        \/\/\u30bf\u30a4\u30c8\u30eb\u4fdd\u6301\u5909\u6570\n        var title: String\n        \/\/\u30e1\u30c3\u30bb\u30fc\u30b8\u4fdd\u6301\u5909\u6570\n        var msg: String = &quot;&quot;\n        \/\/\u30da\u30a2\u306a\u3089\n        if ck &gt; 0 {\n            title = &quot;\u30da\u30a2&quot;\n            \/\/\u30c1\u30a7\u30c3\u30af\u5909\u6570\u306e\u5024\u306b\u3088\u308a\u30da\u30a2\u540d\u3092\u6307\u5b9a\u3059\u308b\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        \/\/\u30da\u30a2\u4ee5\u5916\n        } else {\n            \/\/\u30d5\u30e9\u30c3\u30b7\u30e5\u5909\u6570\u3068\u308a\u3042\u3048\u305a\u30d5\u30e9\u30c3\u30b7\u30e5\n            var chk = true\n            \/\/\uff11\u756a\u76ee\uff08\uff10\u306e\u4f4d\u7f6e\uff09\u306e\u30de\u30fc\u30af\u3092\u53d6\u5f97\uff08\uff10\u301c\uff13\uff09\n            let mark: Int = eachCard[0].tag \/ 13\n            \/\/\uff12\u756a\u76ee\u304b\u3089\uff15\u756a\u76ee\u306e\u4f4d\u7f6e\u306e\u30de\u30fc\u30af\u3068\u6bd4\u8f03\n            for i in 1 ..&lt; 5 {\n                \/\/\uff11\u756a\u76ee\u306e\u30de\u30fc\u30af\u3068\uff12\u301c\uff15\u756a\u76ee\u306e\u30de\u30fc\u30af\u3092\u6bd4\u8f03\u3057\u3066\u9055\u3063\u3066\u3044\u305f\u3089\n                if mark != eachCard[i].tag \/ 13 {\n                    \/\/\u30d5\u30e9\u30c3\u30b7\u30e5\u5909\u6570\u3092false\uff08\u30d5\u30e9\u30c3\u30b7\u30e5\u3067\u306f\u306a\u3044\uff09\u306b\n                    chk = false\n                    \/\/\u30eb\u30fc\u30d7\u3092\u7d42\u4e86\n                    break\n                }\n            }\n            \/\/\u30a8\u30fc\u30b9\u304c\u3042\u308b\u304b\n            var isAce = false\n            \/\/\u30ad\u30f3\u30b0\u304c\u3042\u308b\u304b\n            var isKing = false\n            \/\/\uff15\u679a\u306e\u30ab\u30fc\u30c9\u306b\u3064\u3044\u3066\u8abf\u3079\u308b\n            for i in 0 ..&lt; 5 {\n                \/\/\u30a8\u30fc\u30b9\u304c\u3042\u3063\u305f\u3089\n                if eachCard[i].tag % 13 == 0 {\n                    isAce = true\n                }\n                \/\/\u30ad\u30f3\u30b0\u304c\u3042\u3063\u305f\u3089\n                if eachCard[i].tag % 13 == 12 {\n                    isKing = true\n                }\n            }\n            \/\/\u30a8\u30fc\u30b9\u3068\u30ad\u30f3\u30b0\u4e21\u65b9\u3042\u3063\u305f\u3089up\u5909\u6570\u3092true\u306b\n            let up = isAce && isKing\n            \/\/\u6700\u5c0f\u5024\u5909\u6570\u3092\u5ba3\u8a00\n            var min = 0\n            \/\/\u6700\u5927\u5024\u5909\u6570\u3092\u5ba3\u8a00\n            var max = 0\n            \/\/\uff11\u756a\u76ee\u304b\u3089\uff15\u756a\u76ee\u307e\u3067\u30eb\u30fc\u30d7\n            for i in 0 ..&lt; 5 {\n                \/\/\u5909\u6570\u306b\u305d\u306e\u30ab\u30fc\u30c9\u306e\u30ca\u30f3\u30d0\u30fc\u3092\u5165\u308c\u308b\n                var val = eachCard[i].tag % 13\n                \/\/\u30a8\u30fc\u30b9\u3068\u30ad\u30f3\u30b0\u4e21\u65b9\u304c\u3042\u3063\u305f\u5834\u5408\n                if up {\n                    \/\/\uff14\u4ee5\u4e0b\u306e\u30ab\u30fc\u30c9\u306b\n                    if val &lt; 4 {\n                        \/\/\uff11\uff13\u52a0\u3048\u308b\n                        val = val + 13\n                    }\n                }\n                \/\/\uff11\u756a\u76ee\u306a\u3089min,max\u306bval\u3092\u5165\u308c\u308b\n                if i == 0 {\n                    min = val\n                    max = val\n                    \/\/\uff12\u756a\u76ee\u4ee5\u964d\n                } else {\n                    \/\/\u5909\u6570\u304c\u6700\u5c0f\u5024\u3088\u308a\u5c0f\u3055\u3044\u6642\n                    if val &lt; min {\n                        \/\/\u6700\u5c0f\u5024\u3092\u5909\u6570\u306b\n                        min = val\n                    }\n                    \/\/\u5909\u6570\u304c\u6700\u5927\u5024\u3088\u308a\u5927\u304d\u3044\u6642\n                    if max &lt; val {\n                        \/\/\u6700\u5927\u5024\u3092\u5909\u6570\u306b\n                        max = val\n                    }\n                }\n            }\n            \/\/\u30ed\u30a4\u30e4\u30eb\u306a\u3089\n            if max - min == 4 && max == 13 {\n                msg = &quot;\u30ed\u30a4\u30e4\u30eb&quot;\n            }\n            \/\/\u30b9\u30c8\u30ec\u30fc\u30c8\u306a\u3089\n            if max - min == 4 {\n                \/\/\u30e1\u30c3\u30bb\u30fc\u30b8\u5909\u6570\u306b\u30b9\u30c8\u30ec\u30fc\u30c8\u3092\u8ffd\u52a0\u3059\u308b\n                msg += &quot;\u30b9\u30c8\u30ec\u30fc\u30c8&quot;\n            }\n            \/\/\u30d5\u30e9\u30c3\u30b7\u30e5\u306a\u3089\n            if chk {\n                \/\/\u30e1\u30c3\u30bb\u30fc\u30b8\u5909\u6570\u306b\u30d5\u30e9\u30c3\u30b7\u30e5\u3092\u8ffd\u52a0\u3059\u308b\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            \/\/\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u30bf\u30a4\u30c8\u30eb\u306b\u5165\u308c\u308b\n            title = msg\n        }\n        \/\/\u30dd\u30a4\u30f3\u30c8\u306b\u8ced\u3051\u70b9\u00d7\u30ea\u30bf\u30fc\u30f3\u500d\u7387\u3092\u8db3\u3059\n        point = point + betPoint * mul\n        \/\/\u8ced\u3051\u70b9\uff10\n        betPoint = 0\n\n        \/\/\u30dd\u30a4\u30f3\u30c8\u304c\uff10\u306a\u3089\u30b2\u30fc\u30e0\u30aa\u30fc\u30d0\u30fc\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            \/\/\u6700\u521d\u304b\u3089\u30b2\u30fc\u30e0\u3092\u7d9a\u3051\u3089\u308c\u308b\n            point = 10\n        }\n        \/\/\u30c0\u30a4\u30a2\u30ed\u30b0\u3092\u8868\u793a\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        \/\/\u70b9\u6570\u8868\u793a\n        display()\n    }<\/code><\/pre><\/div>\n\n\n\n<p>\u3000\u4eca\u56de\u306e\u5909\u66f4\u3067\u30b9\u30c3\u30ad\u30ea\u3057\u307e\u3057\u305f\u3002\u4eca\u307e\u3067\u30c0\u30a4\u30a2\u30ed\u30b0\u8868\u793a\u90e8\u5206\u304c\u30da\u30a2\u3068\u30b9\u30c8\u30ec\u30fc\u30c8\u30fb\u30d5\u30e9\u30c3\u30b7\u30e5\u90e8\u5206\u306b\u5206\u304b\u308c\u3066\u3044\u305f\u306e\u3092\u4e00\u3064\u306b\u3057\u307e\u3057\u305f\u3002\u3082\u3063\u3068\u65e9\u304f\u3084\u308b\u3079\u304d\u3067\u3057\u305f\u3002\u30dd\u30a4\u30f3\u30c8\u304c\uff10\u306b\u306a\u3063\u305f\u6642\u306e\u30b2\u30fc\u30e0\u30aa\u30fc\u30d0\u30fc\u3082\u30c0\u30a4\u30a2\u30ed\u30b0\u8868\u793a\u90e8\u5206\u306b\u8f09\u305b\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/shimayugu.sakura.ne.jp\/?p=2473\">\u76ee\u6b21<\/a>\u3000<a href=\"https:\/\/xcode15.shimayugu.jp\/?p=278\">\u901a\u5e38\u7248<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u6b21\u3000\u901a\u5e38\u7248 \u3000\u30b2\u30fc\u30e0\u30aa\u30fc\u30d0\u30fc\u3092\u5165\u308c\u307e\u3057\u305f\u3002 \u3000\u4eca\u56de\u306e\u5909\u66f4\u3067\u30b9\u30c3\u30ad\u30ea\u3057\u307e\u3057\u305f\u3002\u4eca\u307e\u3067\u30c0\u30a4\u30a2\u30ed\u30b0\u8868\u793a\u90e8\u5206\u304c\u30da\u30a2\u3068\u30b9\u30c8\u30ec\u30fc\u30c8\u30fb\u30d5\u30e9\u30c3\u30b7\u30e5\u90e8\u5206\u306b\u5206\u304b\u308c\u3066\u3044\u305f\u306e\u3092\u4e00\u3064\u306b\u3057\u307e\u3057\u305f\u3002\u3082\u3063\u3068\u65e9\u304f\u3084\u308b\u3079\u304d\u3067\u3057\u305f\u3002\u30dd\u30a4\u30f3\u30c8\u304c\uff10\u306b\u306a\u3063\u305f\u6642\u306e [&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-759","post","type-post","status-publish","format-standard","hentry","category-swift"],"_links":{"self":[{"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=\/wp\/v2\/posts\/759","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=759"}],"version-history":[{"count":7,"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=\/wp\/v2\/posts\/759\/revisions"}],"predecessor-version":[{"id":1071,"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=\/wp\/v2\/posts\/759\/revisions\/1071"}],"wp:attachment":[{"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=759"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=759"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=759"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}