-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from Naaate/master
Emjional Abuse
- Loading branch information
Showing
1 changed file
with
100 additions
and
0 deletions.
There are no files selected for viewing
100 changes: 100 additions & 0 deletions
100
src/main/kotlin/com.fractalwrench.iokk/n01/n01HelloWorld_Naaate.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
package com.fractalwrench.iokk.n01 | ||
|
||
//Do a little pre obfuscation | ||
typealias `๐ง ` = Any | ||
typealias `๐คฃ` = Int | ||
typealias `๐ค` = IntRange | ||
typealias `๐` = String | ||
typealias `๐คฏ` = Unit | ||
typealias `โ ` = () -> `๐` | ||
|
||
/** | ||
* Abuse of infix functions, type aliases, and emoji lead to this awesomeness | ||
*/ | ||
fun ch1Solution_Naaate() { | ||
`๐`().`๐`() | ||
} | ||
|
||
|
||
class `๐`(){ | ||
val `๐` = 32..114 `๐คฎ` { it - 32 } | ||
|
||
fun `๐`() = | ||
((40 `๐` 69).`๐`(76,2) `๐` 79 `๐` 12 `๐` 0 `๐` 55 `๐` 79 `๐` 82 `๐` 76 `๐` 68 `๐` 1).`๐` `๐ฏ` ::`๐จ๏ธ` | ||
|
||
/** | ||
* takes an `๐คฃ` and returns a `โ ` that looks up the value for each `๐คฃ`, converts them to chars and returns them as | ||
* `๐` | ||
* | ||
* Once again, | ||
* | ||
* takes an Int and returns a () -> String that looks up the value for each Int, converts them to chars and returns | ||
* them as String | ||
*/ | ||
private infix fun `๐คฃ`.`๐`( `๐`: `๐คฃ`): `โ ` = { | ||
(::`๐ ` `๐ฉ` `๐`[this]!!) + | ||
(::`๐ ` `๐ฉ` `๐`[`๐`]!!) | ||
} | ||
|
||
/** | ||
* returns `โ ` that calls receiving `โ ` before looking up, converting to char, and appending`๐` | ||
* | ||
* returns () -> String that calls receiving () -> String before looking up, converting to char, and appending the | ||
* Int parameter | ||
*/ | ||
private infix fun `โ `.`๐`( `๐`: `๐คฃ`): `โ ` = { | ||
this.`๐` + (::`๐ ` `๐ฉ` `๐`[`๐`]!!) | ||
} | ||
|
||
/** | ||
* calls ๐ that one `๐` number of times | ||
*/ | ||
private fun `โ `.`๐`( `๐`: `๐คฃ`, `๐`: `๐คฃ`): `โ ` { | ||
var `๐` = this | ||
var `๐` = `๐` | ||
while(`๐` > 0){ | ||
`๐` -- | ||
`๐` = `๐` `๐` `๐` | ||
} | ||
|
||
return`๐` | ||
} | ||
|
||
/** | ||
* Int.toChar().toString() | ||
*/ | ||
private infix fun `๐ `(`๐`: `๐คฃ`) = `๐`::toChar.`๐`::toString.`๐` | ||
|
||
/** | ||
* IntRange.associateBy | ||
*/ | ||
private infix fun `๐ค`.`๐คฎ`(`๐ง`: (`๐คฃ`) -> `๐คฃ`) = associateBy(`๐ง`) | ||
|
||
/** | ||
* String.let | ||
*/ | ||
private infix fun `๐`.`๐ฏ`(`๐ง`: (`๐`) -> `๐คฏ`) = let(`๐ง`) | ||
|
||
/** | ||
* println | ||
*/ | ||
private infix fun `๐จ๏ธ` (`๐ง`: `๐`): `๐คฏ` = println(`๐ง`) | ||
|
||
/** | ||
* infix fun <T: Any, U: Any > ((T) -> u).`๐ฉ`(param: T) = this(param) | ||
* | ||
* because who directly calls things these days? | ||
*/ | ||
private infix fun <`๐`: `๐ง `, `๐ฝ`: `๐ง ` > ((`๐`) -> `๐ฝ`).`๐ฉ`(`๐ค`: `๐`) = this(`๐ค`) | ||
|
||
/** | ||
* val <T: Any> (() -> T).`๐` : T | ||
* | ||
* makes functions with no parameters callable by accessing .`๐` | ||
* | ||
* because empty brackets are boring | ||
*/ | ||
val <`๐`: `๐ง `> (() -> `๐`).`๐` : `๐` | ||
get() = this() | ||
|
||
} |