Skip to content

Commit

Permalink
ADD minor doc
Browse files Browse the repository at this point in the history
  • Loading branch information
deepnight committed Jan 9, 2025
1 parent 90b88c8 commit 94a94d8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/dn/Lib.hx
Original file line number Diff line number Diff line change
Expand Up @@ -358,24 +358,28 @@ class Lib {
if (total<=0 || nbStacks<=0)
return new Array();

// Spreading would overflow all maxStackValues
if( maxStackValue!=null && total/nbStacks>maxStackValue ) {
var a = [];
for(i in 0...nbStacks)
a.push(maxStackValue);
return a;
}

// Too many stacks
if( nbStacks>total ) {
var a = [];
for(i in 0...total)
a.push(1);
return a;
}

// Ensure we have at least one in each stack
var plist = new Array();
for (i in 0...nbStacks)
plist[i] = 1;

// Spread the rest
var remain = total-plist.length;
while (remain>0) {
var move = M.ceil(total*(randFunc(8)+1)/100);
Expand Down

0 comments on commit 94a94d8

Please sign in to comment.