So that means only 2.33 months left to program the game into alpha testing for net play. (I've told some of the people who follow the game that I want to be able to have it playable by the end of 2008) Oooh... I am putting pressure on myself. But it's a good thing.

Anyway, at the moment, with the new compiler, DA for linux is not even getting to the main screen. So my first priority is to get that working again. Also on linux Lazarus default development widgetset is gtk2, which will give me a sexier interface than gtk1, but that might be the blame for the non-starting too.

On windows my SVN lazarus (I am going to continue to use lazarus SVN now, as well as glscene SVN) is not rebuilding yet. It is because the compiler is trying to recompile stuff where he only needs to look at the .ppu files. Anyway, so I have some groundwork to be done to actually get it working.

On my wishlist for the deckeditor is the same ol', same ol' mana curve. Hopefully making it look pretty with GLScene, and some cool stacked graphs etc. Anyway... another is to incorporate my Excel "combo" calculator.

For this however, I had to implement the Hyper Geometric Distribution in pascal... I read the wikipedia article... My statistics are a little bit rusty, and I was really struggling. However, I followed the external links, to nerdbucket. He has an implementation for C++ as well as one for Ruby. But what *really* interested me, was the exponent / ln mathematics.

This enabled me to create a decent implementation of Hyper Geometric Distribution for Pascal... and here it follows:

Function lnFactorial(N:Integer):Double;
var i : integer;
aValue : double;
begin
if N = 0 then begin result := 1; exit; end;
aValue := 0;
for i := 1 to N do
aValue := aValue + ln(i);
Result := aValue;
end;


function BinomialCoef(n,k:integer):double;
var aValue : double;
begin
aValue := exp(lnFactorial(n) - (lnFactorial(k) + lnFactorial(n-k)));
BinomialCoef:=aValue;
end;

Function HypGeomDist(RequiredHits, PopulationSize, Targets, Attempts:integer):double;
begin
Result :=
BinomialCoef
(Targets,RequiredHits)
*
BinomialCoef
(PopulationSize-Targets,Attempts - RequiredHits)
/
BinomialCoef
(PopulationSize,Attempts);
end;

Please consider the code as public domain.

Newer Posts Older Posts Home

Blogger Template by Blogcrowds.