You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
558 B
23 lines
558 B
import { randomChoice } from "../core/utils";
|
|
import { T } from "../translations";
|
|
|
|
const hintsShown = [];
|
|
|
|
/**
|
|
* Finds a new hint to show about the game which the user hasn't seen within this session
|
|
*/
|
|
export function getRandomHint() {
|
|
let maxTries = 100 * T.tips.length;
|
|
|
|
while (maxTries-- > 0) {
|
|
const hint = randomChoice(T.tips);
|
|
if (!hintsShown.includes(hint)) {
|
|
hintsShown.push(hint);
|
|
return hint;
|
|
}
|
|
}
|
|
|
|
// All tips shown so far
|
|
return randomChoice(T.tips);
|
|
}
|