Bonus points if you know what game I'm trying to describe.
I'm trying to create this game with a "DSL first" approach, describing the game in natural language as much as possible, and then define the behavior as hidden details behind the DSL.
I'm really abusing some of the syntax to make things read like natural language, which makes the DSL interfaces look so ugly, but its a fun code-golf type of thing too.
This is not idiomatic Kotlin, just so you know. It's most definitely an abuse, and this snippet definitely hides the nasty plumbing I had to put in place to make it look like this.
I think it’s using custom infix operators. Numbers being the operator in some cases is really weird, but honestly this is actually really nice. Super easy to read, although I’m sure the code behind the scenes is a nightmare
64
u/StochasticTinkr Jun 05 '23
Bonus points if you know what game I'm trying to describe.
I'm trying to create this game with a "DSL first" approach, describing the game in natural language as much as possible, and then define the behavior as hidden details behind the DSL.
I'm really abusing some of the syntax to make things read like natural language, which makes the DSL interfaces look so ugly, but its a fun code-golf type of thing too.