From: percy tiglao <prtiglao_at_gmail.com>

Date: Sat 13 May 2006 - 04:07:37 EST

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat May 13 04:11:18 2006

Date: Sat 13 May 2006 - 04:07:37 EST

Hello, I am very new to R (read the introduction a few hours ago), but
experianced in several other languages (including Scheme, C, ObjC and
C++, Java and Javascript) and I was wondering how to approach this
problem:

The current implementation

(http://geocities.com/dragontamer5788/maple2.html) uses the normal
curve to estimate just about everything. Not necessarily a bad idea
for when it takes 10 or 15 hits to destroy a single enemy, Central
Limit Theorm kicks in and normal curve is probably a good idea, but my
gut feeling is that it is not accurate for estimating kills in 1 or 2
shots (which happens in the majority of "training" monsters), or the
probability of Knockback (which is always determined by a single
shot).

The (simplified) function to represent the damage would be:

sdmg <- function(min, max, skill){

if(runif(1) > .4) (runif(1) * (max-min) + min) * skill
else (runif(1) * (max-min) + min) * (skill+1)

*}
*

total_damage <- function(min, max, skill, num_attacks){
total <- 0

for(i in 1:num_attacks){

total <- total + sdmg(min, max, skill)
}

total

*}
*

The above is how damage is calculated. So the probability distribution looks like 2 rectangles next to each other, one with height .6 and the other with height .4. Sdmg is a helper function, because some attacks attack 2 or 4 times in a single turn.

Though, I dont want the simulation (what I'm doing with the runif here). I'd like to calculate the probability distribution of total_damage, total_damage + total damage (the convolution, representing 2 hits), and so on till about 5-8 hits (then I can just use normal curve in the web-calculator I'm making), then have a polynomial function estimate the probability distributions based on min, max, and skill. (So I can make my online calculator estimate the probability of killing enemies)

Erm, I know it is a lot to ask for, but how would I go about making this in R? And if R isn't the right tool for this, is there any other tool you'd reccomend? Cause doing convolutions by hand sucks.

Thanks a lot for reading this long message :) And thanks in advance for your help.

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat May 13 04:11:18 2006

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.1.8, at Sat 13 May 2006 - 06:10:07 EST.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*