stumpers.BadWords.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lib Show documentation
Show all versions of lib Show documentation
Question authoring library for CS 124.
package edu.illinois.cs.cs125.questioner.lib.stumpers
import edu.illinois.cs.cs125.jeed.core.getBadWords
import edu.illinois.cs.cs125.questioner.lib.Language
import edu.illinois.cs.cs125.questioner.lib.Question
import edu.illinois.cs.cs125.questioner.lib.templateSubmission
private val badWords = mutableMapOf>()
fun Question.badWords() = badWords.getOrPut(this) {
getCorrect(Language.java)!!.let {
if (getTemplate(Language.java) != null) {
"// TEMPLATE_START\n$it\n// TEMPLATE_END \n"
} else {
it
}
}.let { contents ->
templateSubmission(contents, Language.java)
}.getBadWords()
}