Get the graph rendering as expected

This commit is contained in:
Oliver-Akins 2025-04-23 00:16:24 -06:00
parent 3796687a72
commit 5e9b91b199
5 changed files with 98 additions and 24 deletions

View file

@ -52,13 +52,17 @@ export class MemoryDatabase {
if (!subtable) {
continue;
}
const size = Number.parseInt(subtable.slice(1));
const rows = [];
for (let i = 1; i <= size; i++) {
const count = getNormalDistributionHeight(i, size / 2, size);
console.table({ count, i });
const temp = new Array(count).fill(null).map(() => generateRow(i));
const temp = new Array(count)
.fill(null)
.map(() => generateRow(
game.user.id == user ? i : Math.ceil(Math.random() * size),
));
rows.push(...temp);
};

View file

@ -0,0 +1,19 @@
/**
*
* @param {string | number} a
* @param {string | number} b
*/
export function smallToLarge(a, b) {
const aInt = Number.parseInt(a);
const bInt = Number.parseInt(b);
const aIsInvalid = Number.isNaN(aInt);
const bIsInvalid = Number.isNaN(bInt);
if (aIsInvalid && bIsInvalid) {
return a > b;
} else if (aIsInvalid || bIsInvalid) {
return aIsInvalid ? -1 : 1;
};
return Math.sign(aInt - bInt);
};