This repository has been archived by the owner on Oct 25, 2022. It is now read-only.
forked from cameroncondry/cbc-kitten-scientists
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(village): New job distribution logic
The "limited" option has been removed as it didn't provide any meaningful change in behavior, compared to just setting a limit value. The limit value can be set to -1, meaning unlimited, and the unlimited jobs will be filled when the limited jobs have reached their limit. If you want kittens to be distributed to those jobs earlier, set a very high limit. Kittens will always be assigned to the job with the least amount of kittens currently assigned.
- Loading branch information
1 parent
f9dadd5
commit 174d3a9
Showing
7 changed files
with
63 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export const shuffleArray = <T>(array: Array<T>) => { | ||
for (let index = array.length - 1; index > 0; index--) { | ||
const targetIndex = Math.floor(Math.random() * (index + 1)); | ||
const temp = array[index]; | ||
array[index] = array[targetIndex]; | ||
array[targetIndex] = temp; | ||
} | ||
return array; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters