Commit eec3df8d authored by Niklas Fix's avatar Niklas Fix 🎓

change to new level function

parent a9a67ac1
......@@ -7,7 +7,9 @@ import de.akamu.tudarmstadt.App
import de.akamu.tudarmstadt.R
import de.akamu.tudarmstadt.model.Pool
import de.akamu.tudarmstadt.model.User
import java.lang.Math.pow
import kotlin.math.floor
import kotlin.math.pow
import kotlin.math.sqrt
class AppUserUtil {
......@@ -36,11 +38,13 @@ class AppUserUtil {
* @return the number that sets the level status in the progressbar of the user profile
*/
fun getUserProgress(user: User): Int {
// Akamu Level function lvl = floor(sqrt(user.experience) / 3) + 1
// Akamu Level function lvl = floor(pow(user.experience / 3.4, 1/3) + 1
val exp = user.experience
val x = sqrt(exp.toDouble())/3
val x = (exp.toDouble()/3.4).pow((1/3).toDouble())
val xint = floor(x)
// get remainder of the number -> delivers percentage of progress
val frac = x - xint
// Progressbar goes from 0 to 100)
return (frac * 100).toInt()
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment