abs takes the absolute value of a number, so it treats -3 as 3. So this caclulation is ( (number) + abs(number) ) /2 When all numbers are positive, you end up with double the original total, which is why you have /2 at the end, to return to zero. If the number is negative, lets say -3, you end up with: -3 + abs(-3) ==> -3 + 3 = 0. So using abs in this formula stops the total from going below zero. You can grab a sheet a paper, and test it with numbers you set yourself, like say -3 for spirit and 7 for armour, and see what happens, and again for -7 and 3. Remember that abs() removes the negative sign.