Could some one help me to understand what this section of code is doing please? I understand basicly that the game is set up so you gain experience and then based on a certain "amount" of experience it sets you to a certain level. But what I am wanting to do is recode this part of the game so that at a certain amount of exp it would set a 'row' in the 'users' table called "level" to whatever that level should be according to the "amount" of experience the user has.
CODE
function experience($L) {
$a=0;
$end=0;
for($x=1; $x<$L; $x++) {
$a += floor($x+1500*pow(4, ($x/7)));
}
return floor($a/4);
}
function Get_The_Level($exp) {
$a=0;
$end =0;
for($x=1; ($end==0 && $x<100); $x++) {
$a += floor($x+1500*pow(4, ($x/7)));
if ($exp >= floor($a/4)){
} else {
return $x;
$end=1;
}
}
}
function Get_Max_Exp($L){
$end=0;
if ($exp == 0){
return 457;
$end =1;
}
for($L=1;($L<100 && $end==0);$L++) {
$exp = experience($L);
//echo $exp;
if ($exp >= $user_class->exp){
return $exp;
$end=1;
}
}
}