Probability distribution for filling a tiled map / (or pascal conversion)
$30-5000 USD
Dibatalkan
Dibuat hampir 15 tahun yang lalu
$30-5000 USD
Dibayar ketika dikirim
![][1]
If you look at the image above, you can see a grid of 40x22. Scattered around this grid are a number of diamonds.
Some form of random probability distribution using a seed value of 10 and a probability of 15 was used to scatter these diamonds - although there's more than 15 diamonds.
![][2]
In this example, it's probability of 60 for the spaces, 50 for the boulders and 9 for the diamonds. Yet there's more boulders than spaces...
I haven't a clue about probabability theory and I've spend more than enough time scratching my head trying to work this out.
What I want is a single function that will accept a number of types, and the probability of each type, and then places these types across the map using a base random seed value. Using .NET's random generator is fine, I realize this will mean you won't be able able to directly reproduce the output of the above screenshot though. However, as long as the distribution works and is close that's good enough for me.
This bid request is probably a little more vague that my usual requests, as I simply haven't a clue on the subject. Tried reading the Wikipedia page on Probability Distribution and it did it's very best to send me to sleep! So please ask questions if you need clarification on this bid request.
The following function (in Pascal) apparently does something similar but unfortunately I can't read German and while the Pascal code makes some sense I've ran out of time for this particular module. And I don't even know if it does what I want :) I can't include it in this text as I've only got 2000 characters to play with.
[[login to view URL]][3]
## Deliverables
1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
2) Deliverables must be in ready-to-run condition, as follows? (depending on the nature? of the deliverables):
a)? For web sites or? other server-side deliverables intended to only ever exist in one place in the Buyer's environment--Deliverables must be installed by the Seller in ready-to-run condition in the Buyer's environment.
b) For all others including desktop software or software the buyer intends to distribute: A software? installation package that will install the software in ready-to-run condition on the platform(s) specified in this bid request.
3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement).
This is the pascal function which "probably" does what is required:
Boulder Dash Inside FAQ v1.06 Freeware 1998 by Marek 11. Nov. 2001
----------------------------------------------------
Anhang:
- Zufallsroutine in BD1, BD2 und CrDr zum Levelaufbau
-------------------------------------------------------
- Zufallsroutine in BD1, BD2 und CrDr zum Levelaufbau -
-------------------------------------------------------
So sieht die Routine in Pascal aus:
hoehe, breite, menge[0..3] und item[0..3] sind globale variablen, die beim
Leveleinladen gesetzt werden.
ar, xr, yr und carry stellen die 6510-Register bzw. Carryflag dar.
zx und zy sind die Levelkoordinaten.
procedure shuffel(wurf);
var
shuffel1, shuffel2, shuffel3, shuffel4, ar, xr, yr : integer;
carry : shortint;
function rorc(ar:integer):integer;
var carbak: shortint;
begin
carbak:=carry;
carry:=ar and 1;
rorc:=128*carbak+(ar div 2);
end;
begin
shuffel1:=wurf;
shuffel2:=0;
for zy:=1 to hoehe-2 do begin
for zx:=0 to pred(breite) do begin
xr:=1;
ar:=shuffel2;
ar:=rorc(ar);
ar:=rorc(ar);
shuffel3:=ar and 128;
ar:=shuffel1;
ar:=rorc(ar);
shuffel4:=ar and 127;
ar:=shuffel1;
ar:=rorc(ar);
ar:=rorc(ar);
ar:=ar and 128;
carry:=0;
ar:=shuffel1+ar;
if ar>255 then begin
carry:=1;
ar:=ar and 255;
end;
ar:=ar+carry+19;
if ar>255 then begin
carry:=1;
ar:=ar and 255;
end else begin
carry:=0;
end;
shuffel1:=ar;
ar:=shuffel2;
ar:=ar+carry+shuffel3;
if ar>255 then begin
carry:=1;
ar:=ar and 255;
end else begin
carry:=0;
end;
ar:=ar+carry+shuffel4;
if ar>255 then begin
carry:=1;
ar:=ar and 255;
end else begin
carry:=0;
end;
shuffel2:=ar;
for yr:=0 to 3 do begin
if menge[yr]>ar then begin
xr:=item[yr];
end;
end;
if (zx>0) and (zx
## Platform
C# 3.0 (Visual Studio 2005, .NET Framework 2.0)