client

package
v0.0.0-...-0505374 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DoublePointAnswerAnKind     = "DoublePointAnswer"
	DoublePointPairAnswerAnKind = "DoublePointPairAnswer"
	ExpressionAnswerAnKind      = "ExpressionAnswer"
	FunctionPointsAnswerAnKind  = "FunctionPointsAnswer"
	NumberAnswerAnKind          = "NumberAnswer"
	OrderedListAnswerAnKind     = "OrderedListAnswer"
	PointAnswerAnKind           = "PointAnswer"
	ProofAnswerAnKind           = "ProofAnswer"
	RadioAnswerAnKind           = "RadioAnswer"
	SetAnswerAnKind             = "SetAnswer"
	SignTableAnswerAnKind       = "SignTableAnswer"
	TableAnswerAnKind           = "TableAnswer"
	TreeAnswerAnKind            = "TreeAnswer"
	VariationTableAnswerAnKind  = "VariationTableAnswer"
	VectorNumberAnswerAnKind    = "VectorNumberAnswer"
)
View Source
const (
	EqualityAsKind  = "Equality"
	NodeAsKind      = "Node"
	SequenceAsKind  = "Sequence"
	StatementAsKind = "Statement"
)
View Source
const (
	DropDownFieldBlockBlKind              = "DropDownFieldBlock"
	ExpressionFieldBlockBlKind            = "ExpressionFieldBlock"
	FigureBlockBlKind                     = "FigureBlock"
	FormulaBlockBlKind                    = "FormulaBlock"
	FunctionPointsFieldBlockBlKind        = "FunctionPointsFieldBlock"
	FunctionsGraphBlockBlKind             = "FunctionsGraphBlock"
	GeometricConstructionFieldBlockBlKind = "GeometricConstructionFieldBlock"
	NumberFieldBlockBlKind                = "NumberFieldBlock"
	OrderedListFieldBlockBlKind           = "OrderedListFieldBlock"
	ProofFieldBlockBlKind                 = "ProofFieldBlock"
	RadioFieldBlockBlKind                 = "RadioFieldBlock"
	SetFieldBlockBlKind                   = "SetFieldBlock"
	SignTableBlockBlKind                  = "SignTableBlock"
	SignTableFieldBlockBlKind             = "SignTableFieldBlock"
	TableBlockBlKind                      = "TableBlock"
	TableFieldBlockBlKind                 = "TableFieldBlock"
	TextBlockBlKind                       = "TextBlock"
	TreeBlockBlKind                       = "TreeBlock"
	TreeFieldBlockBlKind                  = "TreeFieldBlock"
	VariationTableBlockBlKind             = "VariationTableBlock"
	VariationTableFieldBlockBlKind        = "VariationTableFieldBlock"
	VectorFieldBlockBlKind                = "VectorFieldBlock"
)
View Source
const (
	FigureBlockFiKind         = "FigureBlock"
	FunctionsGraphBlockFiKind = "FunctionsGraphBlock"
)
View Source
const (
	GFPointGeKind      = "GFPoint"
	GFVectorGeKind     = "GFVector"
	GFVectorPairGeKind = "GFVectorPair"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Answer

type Answer interface {
	// contains filtered or unexported methods
}

Answer is a sum type for the possible answers of question fields

type AnswerWrapper

type AnswerWrapper struct {
	Data Answer
}

AnswerWrapper may be used as replacements for Answer when working with JSON

func (AnswerWrapper) MarshalJSON

func (item AnswerWrapper) MarshalJSON() ([]byte, error)

func (*AnswerWrapper) UnmarshalJSON

func (out *AnswerWrapper) UnmarshalJSON(src []byte) error

type Answers

type Answers map[int]Answer

func (Answers) MarshalJSON

func (dict Answers) MarshalJSON() ([]byte, error)

func (*Answers) UnmarshalJSON

func (dict *Answers) UnmarshalJSON(src []byte) error

type Assertion

type Assertion interface {
	// contains filtered or unexported methods
}

Assertion is the general container for an element of the proof

type AssertionWrapper

type AssertionWrapper struct {
	Data Assertion
}

AssertionWrapper may be used as replacements for Assertion when working with JSON

func (AssertionWrapper) MarshalJSON

func (item AssertionWrapper) MarshalJSON() ([]byte, error)

func (*AssertionWrapper) UnmarshalJSON

func (out *AssertionWrapper) UnmarshalJSON(src []byte) error

type Assertions

type Assertions []Assertion

func (Assertions) MarshalJSON

func (list Assertions) MarshalJSON() ([]byte, error)

func (*Assertions) UnmarshalJSON

func (list *Assertions) UnmarshalJSON(data []byte) error

type Binary

type Binary uint8

Binary represents a logical connector between two propositions

const (
	Invalid Binary = iota // Invalide
	And                   // Et
	Or                    // Ou
)

type Block

type Block interface {
	// contains filtered or unexported methods
}

type BlockWrapper

type BlockWrapper struct {
	Data Block
}

BlockWrapper may be used as replacements for Block when working with JSON

func (BlockWrapper) MarshalJSON

func (item BlockWrapper) MarshalJSON() ([]byte, error)

func (*BlockWrapper) UnmarshalJSON

func (out *BlockWrapper) UnmarshalJSON(src []byte) error

type DoublePointAnswer

type DoublePointAnswer struct {
	From repere.IntCoord
	To   repere.IntCoord
}

type DoublePointPairAnswer

type DoublePointPairAnswer struct {
	From1 repere.IntCoord
	To1   repere.IntCoord
	From2 repere.IntCoord
	To2   repere.IntCoord
}
type DropDownFieldBlock struct {
	Proposals []TextLine
	ID        int
}

DropDownFieldBlock is the same has RadioFieldBlock, but is displayed inline.

type Enonce

type Enonce []Block

func (Enonce) MarshalJSON

func (list Enonce) MarshalJSON() ([]byte, error)

func (*Enonce) UnmarshalJSON

func (list *Enonce) UnmarshalJSON(data []byte) error

type Equality

type Equality struct {
	Terms   []TextLine
	Def     TextLine // Optional avec x = 2k term
	WithDef bool
}

Equality is an equality of the form A1 = A2 = A3

type ExpressionAnswer

type ExpressionAnswer struct {
	Expression string
}

type ExpressionFieldBlock

type ExpressionFieldBlock struct {
	Label  string // as LaTeX, optional
	Suffix string // as LaTeX, optional

	// Typical values range from 1 to 30
	SizeHint SizeHint

	// If true, the field is diplayed with two subfields
	ShowFractionHelp bool

	ID int
}

type FigureBlock

type FigureBlock struct {
	Figure repere.Figure
}

func (FigureBlock) FigBounds

func (fg FigureBlock) FigBounds() repere.RepereBounds

type FigureOrGraph

type FigureOrGraph interface {
	FigBounds() repere.RepereBounds
	// contains filtered or unexported methods
}

type FigureOrGraphWrapper

type FigureOrGraphWrapper struct {
	Data FigureOrGraph
}

FigureOrGraphWrapper may be used as replacements for FigureOrGraph when working with JSON

func (FigureOrGraphWrapper) MarshalJSON

func (item FigureOrGraphWrapper) MarshalJSON() ([]byte, error)

func (*FigureOrGraphWrapper) UnmarshalJSON

func (out *FigureOrGraphWrapper) UnmarshalJSON(src []byte) error

type FormulaBlock

type FormulaBlock struct {
	Formula string // as latex
}

FormulaBlock is whole line, rendered as LaTeX in display mode

type FunctionArea

type FunctionArea struct {
	Color repere.ColorHex
	Path  []functiongrapher.BezierCurve
}

type FunctionPoint

type FunctionPoint struct {
	Color  repere.ColorHex
	Legend string // LaTeX code
	Coord  repere.Coord
}

type FunctionPointsAnswer

type FunctionPointsAnswer struct {
	Fxs []int
}

type FunctionPointsFieldBlock

type FunctionPointsFieldBlock struct {
	IsDiscrete bool   // true for sequences, removing the curve between points
	Label      string // name of the function
	Xs         []int  // the grid
	// the derivatives of the function, to plot a nice curve
	// empty if [IsDiscrete] is true
	Dfxs   []float64
	Bounds repere.RepereBounds
	ID     int
}

FunctionPointsFieldBlock asks to place points to draw the graph of a function

type FunctionSign

type FunctionSign struct {
	Label     string       // printed in math mode
	FxSymbols []SignSymbol // one for each X, alternate with [Signs]
	Signs     []bool       // is positive, with length len(Xs) - 1
}

type FunctionsGraphBlock

type FunctionsGraphBlock struct {
	Functions []functiongrapher.FunctionGraph
	Sequences []functiongrapher.SequenceGraph
	Areas     []FunctionArea
	Points    []FunctionPoint
	Bounds    repere.RepereBounds
}

func (FunctionsGraphBlock) FigBounds

func (fg FunctionsGraphBlock) FigBounds() repere.RepereBounds

type GFPoint

type GFPoint struct{}

FigurePointFieldBlock asks for one 2D point

type GFVector

type GFVector struct {
	LineLabel string // ignored if AsLine is false
	AsLine    bool
}

FigureVectorFieldBlock asks for a vector, represented by start and end. It may be used for vectors and affine functions

type GFVectorPair

type GFVectorPair struct{}

FigureVectorPairFieldBlock asks for two vectors, represented by start and end, but evaluated as vector. The trivial case where the two pair of points are equals is not allowed

type GeoField

type GeoField interface {
	// contains filtered or unexported methods
}

type GeoFieldWrapper

type GeoFieldWrapper struct {
	Data GeoField
}

GeoFieldWrapper may be used as replacements for GeoField when working with JSON

func (GeoFieldWrapper) MarshalJSON

func (item GeoFieldWrapper) MarshalJSON() ([]byte, error)

func (*GeoFieldWrapper) UnmarshalJSON

func (out *GeoFieldWrapper) UnmarshalJSON(src []byte) error

type GeometricConstructionFieldBlock

type GeometricConstructionFieldBlock struct {
	ID         int
	Field      GeoField
	Background FigureOrGraph
}

func (GeometricConstructionFieldBlock) MarshalJSON

func (item GeometricConstructionFieldBlock) MarshalJSON() ([]byte, error)

func (*GeometricConstructionFieldBlock) UnmarshalJSON

func (item *GeometricConstructionFieldBlock) UnmarshalJSON(src []byte) error

type Node

type Node struct {
	Left, Right Assertion
	Op          Binary
}

Node is an higher level assertion, such as (m is even) AND (n is odd)

func (Node) MarshalJSON

func (item Node) MarshalJSON() ([]byte, error)

func (*Node) UnmarshalJSON

func (item *Node) UnmarshalJSON(src []byte) error

type NumberAnswer

type NumberAnswer struct {
	Value float64
}

NumberAnswer is compared with float equality, with a fixed precision of 8 digits

type NumberFieldBlock

type NumberFieldBlock struct {
	ID int
	// Typical values range from 1 to 15
	SizeHint SizeHint
}

NumberFieldBlock is an answer field where only numbers are allowed answers are compared as float values

type OrderedListAnswer

type OrderedListAnswer struct {
	Indices []int // indices into the question field proposals
}

type OrderedListFieldBlock

type OrderedListFieldBlock struct {
	Label string // as LaTeX, optional, displayed before the answer
	// Proposals is a shuffled version of the list
	Proposals    []TextLine
	AnswerLength int
	ID           int
}

type PointAnswer

type PointAnswer struct {
	Point repere.IntCoord
}

PointAnswer is a 2D point, whoose coordinates are rounded before begin compared

type Proof

type Proof struct {
	Root Sequence
}

type ProofAnswer

type ProofAnswer struct {
	Proof Proof
}

type ProofFieldBlock

type ProofFieldBlock struct {
	Shape         Proof
	TermProposals []TextLine
	ID            int
}

type Question

type Question struct {
	Enonce     Enonce
	Correction Enonce
}

type QuestionAnswersIn

type QuestionAnswersIn struct {
	Data Answers
}

QuestionAnswersIn map the field ids to their answer

type QuestionAnswersOut

type QuestionAnswersOut struct {
	Results         map[int]bool
	ExpectedAnswers Answers
}

func (QuestionAnswersOut) IsCorrect

func (qu QuestionAnswersOut) IsCorrect() bool

IsCorrect returns `true` if all the fields are correct.

type QuestionSyntaxCheckIn

type QuestionSyntaxCheckIn struct {
	Answer Answer
	ID     int
}

QuestionSyntaxCheckIn is emitted by the client to perform a preliminary check of the syntax, without validating the answer

func (QuestionSyntaxCheckIn) MarshalJSON

func (item QuestionSyntaxCheckIn) MarshalJSON() ([]byte, error)

func (*QuestionSyntaxCheckIn) UnmarshalJSON

func (item *QuestionSyntaxCheckIn) UnmarshalJSON(src []byte) error

type QuestionSyntaxCheckOut

type QuestionSyntaxCheckOut struct {
	Reason  string
	ID      int
	IsValid bool
}

type RadioAnswer

type RadioAnswer struct {
	Index int
}

RadioAnswer is compared against a reference index It is shared by Radio and DropDown fields.

type RadioFieldBlock

type RadioFieldBlock struct {
	Proposals []TextLine
	ID        int
}

type Sequence

type Sequence struct {
	Parts Assertions
}

Sequence is a list of elementary steps needed to write a mathematical proof, where each step are implicitely connected by a "So" (Donc) connector.

type SetAnswer

type SetAnswer struct {
	// Sets are relative to the question [Sets] list.
	Root sets.ListNode
}

type SetFieldBlock

type SetFieldBlock struct {
	Sets []string
	ID   int
}

SetFieldBlock asks the student to build a set expression, using the given [Sets] and math set operators

type SignSymbol

type SignSymbol uint8
const (
	Nothing        SignSymbol = iota //
	Zero                             // 0
	ForbiddenValue                   // ||
)

func (SignSymbol) MarshalJSON

func (s SignSymbol) MarshalJSON() ([]byte, error)

By default a slice of SignSymbol is marshalled as string by Go, which is not recognized by Dart

type SignTableAnswer

type SignTableAnswer struct {
	Xs        []string       // expressions
	Functions []FunctionSign // each label is ignored
}

type SignTableBlock

type SignTableBlock struct {
	Xs        []string // as LaTeX code, includes empty cells
	Functions []FunctionSign
}

type SignTableFieldBlock

type SignTableFieldBlock struct {
	LengthProposals []int    // propositions of the number of signs to fill
	Labels          []string // LaTeX code, for each function
	ID              int
}

SignTableFieldBlock asks to complete a sign table (with fixed length)

type SizeHint

type SizeHint = int

SizeHint is the length of the expected answer, in runes. It may be used by the client to adjust the field width.

type Statement

type Statement struct {
	Content TextLine
}

Statement is a basic statement

type TableAnswer

type TableAnswer struct {
	Rows [][]float64
}

type TableBlock

type TableBlock struct {
	HorizontalHeaders []TextOrMath // optional
	VerticalHeaders   []TextOrMath // optional
	Values            [][]TextOrMath
}

type TableFieldBlock

type TableFieldBlock struct {
	HorizontalHeaders []TextOrMath
	VerticalHeaders   []TextOrMath
	ID                int
}

type TextBlock

type TextBlock struct {
	Parts   TextLine
	Bold    bool
	Italic  bool
	Smaller bool
}

type TextLine

type TextLine []TextOrMath

TextLine is the general form of a static chunk of text, alternating LaTeX or basic text

type TextOrMath

type TextOrMath struct {
	Text   string
	IsMath bool
}

TextOrMath is a part of a text line, rendered either as plain text or using LaTeX in text mode.

type TreeAnswer

type TreeAnswer struct {
	Root TreeNodeAnswer
}

type TreeBlock

type TreeBlock struct {
	EventsProposals []TextLine
	Root            TreeNodeAnswer
}

type TreeFieldBlock

type TreeFieldBlock struct {
	ShapeProposals  []TreeShape
	EventsProposals []TextLine
	ID              int
}

TreeFieldBlock asks to choose the shape and complete a probability tree

type TreeNodeAnswer

type TreeNodeAnswer struct {
	Children      []TreeNodeAnswer
	Probabilities []string // expression for edges, same length as Children
	Value         int      // index into the proposals, ignored for the root
}

type TreeShape

type TreeShape []int

TreeShape defines the shape of a "regular" tree, specifying the number of children for each level

type VariationColumnNumber

type VariationColumnNumber struct {
	X, Y string // LaTeX
	IsUp bool   // to adjust the vertical alignment
}

VariationColumnNumber is a column in a variation table displaying (x, f(x)) values

type VariationTableAnswer

type VariationTableAnswer struct {
	Xs     []string // expressions
	Fxs    []string // expressions
	Arrows []bool   // isUp
}

type VariationTableBlock

type VariationTableBlock struct {
	Label   string // LaTeX
	Columns []VariationColumnNumber
	// Arrows displays the arrows between two local extrema,
	// with the convention that `true` means `isUp`.
	Arrows []bool
}

type VariationTableFieldBlock

type VariationTableFieldBlock struct {
	Label           string // LaTeX code
	LengthProposals []int  // propositions of the number of arrows
	ID              int
}

VariationTableFieldBlock asks to complete a variation table (with fixed length)

type VectorFieldBlock

type VectorFieldBlock struct {
	ID            int
	DisplayColumn bool
	// Typical values range from 1 to 15
	SizeHintX, SizeHintY SizeHint
}

type VectorNumberAnswer

type VectorNumberAnswer struct {
	X, Y float64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL