Senryoku / Draftmancer

Multiplayer MTG Limited Simulator
https://draftmancer.com
MIT License
86 stars 32 forks source link

Feature Request - mass pack generation #803

Open tiera3 opened 2 months ago

tiera3 commented 2 months ago

When using a detailed specification, it would be nice to have a way to generate a huge number of packs (eg 100,000) and output to a file that can be processed to check statistics to verify they match what is expected.

Senryoku commented 2 months ago

This should be pretty easy to do programmatically using a local copy. Here's a basic Typescript file that will dump 60 packs to a text file:

import fs from "fs";
import parseCardList from "./parseCardList.js";
import { isMessageError, isSocketError } from "./Message.js";
import { generateBoosterFromCustomCardList } from "./CustomCardList.js";

const ccl = parseCardList(fs.readFileSync("./test/data/DOMLayoutExample.txt", "utf8"), {});
if (isSocketError(ccl)) {
    console.error(ccl);
    process.exit(1);
}

const boosters = generateBoosterFromCustomCardList(ccl, 60, { withReplacement: true });
if (isMessageError(boosters)) {
    console.error(boosters);
    process.exit(1);
}

fs.writeFileSync("./boosters.txt", JSON.stringify(boosters, null, 2));

Let me know if you need help setting up the project locally