-- brit2dice.hs -- Haskell program for calculating proabilities of Britannia battles -- ak = number of values (out of 6) that the attacker kills on (normally 2) -- dk = number of values (out of 6) that the defender kills on (normally 2) -- aa = original number of attackers -- dd = original number of defenders -- a = final number of attackers -- d = final number of defenders p0(ak,dk,aa,dd,a,d) = p(a,d) where p(a,d) | (a,d)==(aa,dd) = 1 p(a,d) = sum [(pp!!i!!j)*t(i,j,a,d) | i<-[a..aa], j <-[d..dd], (i,j)/=(a,d)] pp = [[p(a,d)|d<-[0..dd]]|a<-[0..aa]] t(i,j,a,d) | i