Files
math-quiz/lib/engine/variable-types.ts
T

47 lines
1.0 KiB
TypeScript

export type VariableTermKind = "constant" | "variable";
export interface VariableParenthesisTerm {
kind: VariableTermKind;
coefficient: number;
variable?: "x";
}
export interface DistributedVariableTerm {
kind: VariableTermKind;
coefficient: number;
variable?: "x";
latex: string;
}
export interface VariableTermChoice {
id: string;
coefficient: number;
variable?: "x";
latex: string;
}
export interface VariableParenthesisProblem {
id: string;
key: string;
multiplier: number;
terms: VariableParenthesisTerm[];
operators: ("+" | "-")[];
operator: "+" | "-";
firstTerm: VariableParenthesisTerm;
secondTerm: VariableParenthesisTerm;
correctTerms: DistributedVariableTerm[];
choices: VariableTermChoice[][];
latexBefore: string;
latexAfter: string;
}
export interface VariableUserAnswer {
selectedChoiceIds: (string | null)[];
}
export interface VariableGradeResult {
correct: boolean;
userAnswer: (DistributedVariableTerm | null)[];
correctAnswer: DistributedVariableTerm[];
}