From a6e13ac7881d3fbf9a373d8bb046f49de0946757 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kruli=C5=A1?= Date: Sat, 13 Jun 2020 00:26:27 +0200 Subject: [PATCH] Updated Score Calculators (markdown) --- Score-Calculators.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Score-Calculators.md b/Score-Calculators.md index 40c1ad5..bc04360 100644 --- a/Score-Calculators.md +++ b/Score-Calculators.md @@ -23,11 +23,21 @@ The keys are test names (must correspond with the `name` column of the `exercise The most complex calculator which was added last. It holds an AST (Abstract Syntax Tree) of an expression used to compute the score in the configuration. -The AST is encoded directly into Yaml structure -- each node is represented as a collection (object). A node must always have property `type`, which holds a string identifier of the node type (types of nodes are below). +The AST is encoded directly into Yaml structure -- each node is represented as a collection (object). A node must always have property `type`, which holds a string identifier of the node type (types of nodes are below). Internal nodes also have `children` property, which holds a list (array) of child nodes. Leaf nodes do not have `children` property. + +Some nodes may have additional properties. Furthermore, a node is allowed to have arbitrary number of extension properties prefixed with `x-`. These properties are not recognized by API/backend, but they may be use by frontend (web app). The only reason they are recognized in the API is to ensure their correct (de)serialization. Other unknown properties are removed in the normalization process. Leaf nodes (without children): * `value` - a literal value, which holds one float (the value itself is stored in `value` property) * `test-result` - reference to a test score, which is also a float between 0 and 1 (name of the test is in the `test` property) Internal nodes (functions): -* `sum` \ No newline at end of file +* `sum` - computes sum of all children values +* `mul` - computes product of all children values +* `sub` - binary node that computes *a* - *b* +* `div` - binary node that computes *a* / *b* (it yields 0 if *b* == 0) +* `neg` - unary node that negates its operand +* `min` - computes minimum of all children values +* `max` - computes maximum of all children values +* `avg` - computes arithmetic average of all children values +* `clamp` - unary node that clamps its operand value into [0,1] range \ No newline at end of file