July 2018
Intermediate to advanced
400 pages
12h 14m
English
Before you start this challenge or the next one, close NyetHack and create a copy of it using your file explorer. You will be making changes to your program that you will not want to keep for future chapters. Name your copy NyetHack_ConditionalsChallenges or whatever you would like. You will want to do this before starting the challenges in future chapters as well.
Currently, if an aura is displayed, it is always green. For this challenge, have the color of the player’s aura reflect their current karma.
Karma has a numeric value from 0 to 20. To determine the player’s karma, use the following formula:
val karma = (Math.pow(Math.random(), (110 - healthPoints) / 100.0) * 20 ).toInt()
Have the displayed ...
Read now
Unlock full access