Reference · Framing, geometry and quiz tools
FindQuestiontype
A "which one is this?" question: the place asked about, the choices (it among its look-alikes) and where it is in them.
Import it
import type { FindQuestion } from "@johnmorrisdotca/chizu";
Definition
type FindQuestion = {
target: string;
choices: string[];
answerIndex: number;
};
Members
| Name | Type | Description |
|---|---|---|
target | string | The code of the place asked about. |
choices | string[] | The codes to choose from, in an order a seed fixes, the target among them. |
answerIndex | number | Where in |
Examples
import WORLD from "@johnmorrisdotca/chizu/world";
import { findQuestion, seededRandom, type FindQuestion } from "@johnmorrisdotca/chizu";
const question: FindQuestion = findQuestion(WORLD, "FR", seededRandom(7))!;
console.log(question.choices[question.answerIndex]);
// FRFRWhat it prints (run when this page was built)