-
-
Save el-hoshino/6cbc640c20c6645ade13b4918a298d58 to your computer and use it in GitHub Desktop.
ポプテピピックが完成したら竹書房を破壊するSwiftコード #CodePiece
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum PopTeamEpic: String { | |
case po = "ポ" | |
case p = "プ" | |
case teame = "テピ" | |
case pic = "ピック" | |
} | |
struct 蒼井翔太: Sequence, IteratorProtocol { | |
mutating func next() -> PopTeamEpic? { | |
switch arc4random_uniform(4) { | |
case 0: return .po | |
case 1: return .p | |
case 2: return .teame | |
case 3: return .pic | |
case _: fatalError() | |
} | |
} | |
} | |
class 竹書房 { | |
private var 並行励起: [PopTeamEpic] = [] | |
struct 破壊: Error { | |
let 断末魔: String | |
var localizedDescription: String { return 断末魔 } | |
} | |
func receive(_ 🖕: PopTeamEpic) throws { | |
並行励起.append(🖕) | |
if 並行励起.suffix(4) == [.po, .p, .teame, .pic] { | |
throw 破壊(断末魔: 並行励起.map { $0.rawValue }.reduce("", +)) | |
} | |
} | |
} | |
var 🕺 = 蒼井翔太() | |
let 🏢 = 竹書房() | |
for 🖕 in 🕺 { | |
try! 🏢.receive(🖕) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment