Skip to content

Commit

Permalink
feat: Remove randomness from purchasing strategy
Browse files Browse the repository at this point in the history
However helpful this seemed at the time, you want predictable behavior, not random behavior when you configure KS. This needs to be removed again.
  • Loading branch information
oliversalzburg committed Sep 14, 2024
1 parent f248185 commit 866afc4
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { difference, shuffleArray } from "@oliversalzburg/js-utils/data/array.js";
import { difference } from "@oliversalzburg/js-utils/data/array.js";
import { isNil, mustExist } from "@oliversalzburg/js-utils/data/nil.js";
import { KittenScientists } from "../KittenScientists.js";
import { WorkshopManager } from "../WorkshopManager.js";
Expand Down Expand Up @@ -249,9 +249,7 @@ export class BulkPurchaseHelper {
let iterations = 0;
const buildsCommitted = new Array<PotentialBuild>();
while (iterations < 1e5) {
// Randomize the potential builds each iteration. This should help evening out
// build requests for buildings that regularly appear first in the list.
const candidatesThisIteration = shuffleArray(difference(potentialBuilds, buildsCommitted));
const candidatesThisIteration = difference(potentialBuilds, buildsCommitted);

let buildThisIteration = 0;
const committedThisIteration = [];
Expand Down

0 comments on commit 866afc4

Please sign in to comment.