summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Dessaux2022-12-31 17:18:07 +0100
committerJulien Dessaux2022-12-31 17:18:07 +0100
commit1f359e735d64fe45fb1019322fc72f3f3186975c (patch)
tree66c1d7ce94cc1d43cfbac32028836cfa8760c015
parentUpdated dependencies (diff)
downloadjeux-de-mots-1f359e735d64fe45fb1019322fc72f3f3186975c.tar.gz
jeux-de-mots-1f359e735d64fe45fb1019322fc72f3f3186975c.tar.bz2
jeux-de-mots-1f359e735d64fe45fb1019322fc72f3f3186975c.zip
Fixed game creation
Diffstat (limited to '')
-rw-r--r--utils/board.js5
1 files changed, 2 insertions, 3 deletions
diff --git a/utils/board.js b/utils/board.js
index ba43c45..72c7951 100644
--- a/utils/board.js
+++ b/utils/board.js
@@ -41,8 +41,7 @@ export function pickLetters(bag, count) {
}
let ret = [];
for (let i=0; i<count; i++) {
- let n = Math.floor(Math.random() * bag.remaining) -1;
- console.log(n);
+ let n = Math.floor(Math.random() * bag.remaining);
let j = 0;
for (;;) {
if (bag.letters[allLetters[j]].count === 0) {
@@ -55,8 +54,8 @@ export function pickLetters(bag, count) {
break;
}
}
- console.log("j:", j);
bag.letters[allLetters[j]].count--;
+ bag.remaining--;
ret.push(allLetters[j]);
}
return ret;