Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
odtheking committed Nov 12, 2024
1 parent ff7900b commit b18e2b8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ object QuizSolver {
}
if (msg.contains("answered Question #")) triviaOptions.forEach { it.isCorrect = false }
}

if (msg.trim().startsWithOneOf("", "", "", ignoreCase = true) && triviaAnswers?.any { msg.endsWith(it) } == true) {
when (msg.trim()[0]) {
'' -> triviaOptions[0].isCorrect = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,11 @@ object CorrectPanes : TermSimGui(

override fun create() {
this.inventorySlots.inventorySlots.subList(0, 45).forEachIndexed { index, it ->
if (floor(index / 9.0) in 1.0..3.0 && index % 9 in 2..6) it.putStack(getPane())
if (floor(index / 9.0) in 1.0..3.0 && index % 9 in 2..6) it.putStack(if (Math.random() > 0.75) greenPane else redPane)
else it.putStack(blackPane)
}
}

private fun getPane(): ItemStack {
val a = Math.random()
return if (a > 0.75) greenPane else redPane
}

override fun slotClick(slot: Slot, button: Int) {
if (slot.stack?.metadata == 14) slot.putStack(greenPane) else slot.putStack(redPane)
if (!TerminalSounds.enabled || !clickSounds) mc.thePlayer.playSound("random.orb", 1f, 1f)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,16 @@ object Rubix : TermSimGui(
}
if (!TerminalSounds.enabled || !clickSounds) mc.thePlayer?.playSound("random.orb", 1f, 1f)
GuiEvent.GuiLoadedEvent(name, inventorySlots as ContainerChest).postAndCatch()
if (grid.all { it?.stack?.metadata == grid.firstOrNull()?.stack?.metadata }) solved(this.name, 1)
if (grid.all { it.stack?.metadata == grid.firstOrNull()?.stack?.metadata }) solved(this.name, 1)
}

private fun getPane(): ItemStack {
val a = Math.random()
return when {
a < .2 -> genStack(order[0])
a < .4 -> genStack(order[1])
a < .6 -> genStack(order[2])
a < .8 -> genStack(order[3])
else -> genStack(order[4])
return when (Math.random()) {
in 0.0..0.2 -> genStack(order[0])
in 0.2..0.4 -> genStack(order[1])
in 0.4..0.6 -> genStack(order[2])
in 0.6..0.8 -> genStack(order[3])
else -> genStack(order[4])
}
}

Expand Down

0 comments on commit b18e2b8

Please sign in to comment.