mIRC Home    About    Download    Register    News    Help

Print Thread
Calculating.. #20302 21/04/03 11:59 AM
Joined: Dec 2002
Posts: 68
P
phrozenfire Offline OP
Babel fish
OP Offline
Babel fish
P
Joined: Dec 2002
Posts: 68
Is there anyway I could calculate this in mIRC (using a $calc for example):



If you don't understand that, here it is in JavaScript (this JavaScript loops through minlevel all the way to maxlevel and displays it):

Code:
points = 0;

outputnum = 0;
minlevel = 2;		// first level to display
maxlevel = 500;		// last level to display
for (lvl = 1; lvl <= maxlevel; outputnum = Math.floor(points / 4), lvl++) {

	diff = Math.floor(lvl + 300 * Math.pow(2, lvl / 7));
                     points += diff;
                     if (lvl >= minlevel) {

		document.writeln('Level ' + (lvl) + ' - ' + outputnum + ' xp');

	}

}

And here it is in Python:
Code:
points = 0
diff = int(level + 300 * math.pow(2, float(level)/7) )
points += diff
str = "Level %d = %d" % (level + 1, points / 4)
print str


Please help.

Re: Calculating.. #20303 21/04/03 07:27 PM
Joined: Apr 2003
Posts: 1
D
dukey Offline
Mostly harmless
Offline
Mostly harmless
D
Joined: Apr 2003
Posts: 1
yeah its perfectly possible
im not gonna write the code for u but it might help if you wrote a floor alias perhaps smile
up to u

Re: Calculating.. #20304 21/04/03 08:20 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
If I'm remembering my math correctly, doesn't $int() serve the same function as floor? At least in a coding sense. Graphically [x] and |_x_| look slightly different.

Re: Calculating.. #20305 21/04/03 08:20 PM
Joined: Dec 2002
Posts: 68
P
phrozenfire Offline OP
Babel fish
OP Offline
Babel fish
P
Joined: Dec 2002
Posts: 68
Yes, but the thing is, i dont even understand what floor is. I'm only in 7th grade. If anybody could help me with this, please do. Thanks.

I also don't understand what I do with the Sigma (I think that's Sigma)..

Re: Calculating.. #20306 21/04/03 08:45 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Umm well floor(x) returns the highest ingeter <= x. For example:

floor(1) = 1
floor(1.1) = 1
floor(1.9) = 1
floor(2.1) = 2

For example,

Sigma(x=1,3,x+2)

What that says is for all x (integers) beginning at x=1 and ending at x=3, apply the formula x+2 to each of them and return the total. ie:

x=1
1+2 = 3
total = 3
x=2
2+2 = 4
total = 7
3+2 = 5
total=12

So the summation from x=1 to x=3 of x+2 is 12. If you don't really follow that, well now you know why floor and summation are taught in advanced math classes and not in 7th grade smile

Re: Calculating.. #20307 22/04/03 02:17 PM
Joined: Feb 2003
Posts: 76
G
gerdigos Offline
Babel fish
Offline
Babel fish
G
Joined: Feb 2003
Posts: 76
phrozenfire i'm Greek and that's a Sigma smile