Challenge: Solutions

Challenge: Single Expression Functions

private fun auraColor(isBlessed: Boolean, healthPoints: Int, isInmortal: Boolean) =
         if (isBlessed && healthPoints > 50 || isInmortal) "GREEN" else "NONE"

Challenge : Inebriation Level and Inebriation Status

 private fun castFireBall( numFireBalls: Int = 2 ) =
    println("A glass of fireball spring into existance (x$numFireBalls) " +
            " ${if (numFireBalls in 1..50) "inebration level: ${(1..50).random()}" else "50"} " +
            "(Inebration Status:)" +
             " ${when (numFireBalls) {
                 in 1..10 -> "tipsy"
                 in 11..20 -> "sloshed"
                 in 21..30 -> "soused"
                 in 31..40 -> "stewed"
                 in 41..50 -> "toSt3d"
                 else -> "nope"
             } } "
            )

My solution is here: TheBigNerdRanchGuide/src/TheBigNerdRanchGuide at main · AlexeyYuditsky/TheBigNerdRanchGuide · GitHub