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

fix new level function

parent d6375194
package de.akamu.tudarmstadt.util
import android.content.Context
import com.google.android.gms.tasks.Tasks
import com.google.firebase.iid.FirebaseInstanceId
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 {
......@@ -40,7 +36,7 @@ class AppUserUtil {
fun getUserProgress(user: User): Int {
// Akamu Level function lvl = floor(pow(user.experience / 3.4, 1/3) + 1
val exp = user.experience
val x = (exp.toDouble()/3.4).pow((1/3).toDouble())
val x = (exp.toDouble()/3.4).pow(1.0/3.0)
val xint = floor(x)
// get remainder of the number -> delivers percentage of progress
val frac = x - xint
......
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