Browse Source

Fix infinite loop in RandomWord

vintage
Fen Dweller 5 years ago
parent
commit
d7e6a54811
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      src/game/language.ts

+ 1
- 1
src/game/language.ts View File

@@ -226,7 +226,7 @@ export class RandomWord extends Word {


do { do {
choice = Math.floor(Math.random() * this.choices.length) choice = Math.floor(Math.random() * this.choices.length)
} while (choice === this.history.last)
} while (choice === this.history.last && this.choices.length > 1)


this.history.last = choice this.history.last = choice
return this.choices[choice].configure(this.opt).toString() return this.choices[choice].configure(this.opt).toString()


Loading…
Cancel
Save