This site requires JavaScript, please enable it in your browser!
Greenfoot back

MatheMagician's Comments

Back to MatheMagician's profile

Also, I think the only reason it takes so long to calculate pi is because you are only making one calculation per act cycle. I tried it out using a for loop to calculate 100 times per act frame and the laptop I'm using handled it like pi (pun intended).
Oops, for some reason I am having trouble liking your scenario. :< anyway, I'll try again: you deserve it.
@SPower the way you calculate the arctan function is this arc(x) = x - x^3/3 + x^5/5 - x^7/7 Its just that pi/4 = arctan(1) or 1-1/3+1/5-1/7. So i think Zamoht's method is faster. @Zamoht, I am impressed by your use of BigDecimals. I tried doing so but I had trouble with it. I will use some your code in my series formula scenario (I will give you credit and like your scenario).
Figured it out! :>
Okay, thank you very much for the suggestion (I want to improve my games).
Thanks, Builderboy, the Bresenham's line algorithm looks good. Though I do not understand why we need to know how to draw a line in java, since java.awt.graphics makes this easy.
That is what I thought. Not only is that slow, it hammers Greenfoot's network. Anyway, you could fix the problem by only setting the highscore after you die. That should work. (Essentially what SPower)
Oops, I thought I knew what the problem was, but now it appears I don't :< I suppose you might have to wait a little bit while I figure that one out.