Created
September 14, 2024 00:29
-
-
Save windymelt/1f243c6ca9fa7d679c28cf1895d6a11d to your computer and use it in GitHub Desktop.
粛聖!! ロリ神レクイエム☆
This file contains 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
// DSL | |
trait 監獄[Repr]: | |
def 入獄(罪人たち: Seq[(Int, 罪人[String])]): Unit | |
def 点呼(): Repr | |
trait 罪人[Repr]: | |
def 触る(): Repr | |
def 逮捕()(using 監獄[Repr]): Repr | |
def ごめんなさい(): Repr | |
class おまいら用監獄 extends 監獄[String]: | |
var 独房: Seq[(Int, 罪人[String])] = Seq() | |
def 入獄(罪人たち: Seq[(Int, 罪人[String])]) = | |
print("触ったら逮捕!") | |
独房 = 罪人たち | |
def 点呼(): String = | |
println("極 chu de 点呼!(Uh!)") | |
独房.map(p => p._1).mkString(" ") | |
object おまいら extends 罪人[String]: | |
def 触る() = "触った" | |
def 逮捕()(using 監獄[String]) = | |
summon[監獄[String]].入獄((1 to 4).map(n => (n, おまいら))) | |
"(Ah!)" | |
def ごめんなさい() = "(ごめんなさーい)" | |
def ごめんなさいが聞こえないけど() = "(え〜)" | |
def 触ったか: String => Boolean = _ == "触った" | |
def 聞こえないか(声: String) = | |
println(声) | |
true | |
def 粛聖ロリ神レクイエム(): Unit = println("粛聖! ロリ神レクイエム") | |
// execution | |
if (触ったか(おまいら.触る())) { | |
given 獄中: おまいら用監獄 = おまいら用監獄() | |
println(おまいら.逮捕()) | |
print(獄中.点呼()) | |
if 聞こえないか(おまいら.ごめんなさい()) then | |
print("ハァ?ごめんなさいが聞こえなーい") | |
println(おまいら.ごめんなさいが聞こえないけど()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment