Skip to content

Conversation

@JoshdRod
Copy link
Owner

Formula for calculating correctness = 100(1 - e^(-(no. identical nodes /(no. nodes in solution + difference in no. nodes)))).

Same as #9, just accidentally force pushed without adding these changes to my local branch.

JoshdRod and others added 14 commits December 6, 2025 07:53
Added methods for converting:
Valid expression -> Components
Components -> Postfix
Prefix (**) -> Graph
All nodes now have a property that points to their parent. This enables graph normalisation (sorting).
1. Graph normaliser takes in a binary tree, and converts it into a standard form. It does this by ensuring the content on the left node on commutative operators is lower than the right node.
2. Requires pass to convert -1 patterns into subtractions (e.g: (-1 * 10) + 5 -> 5 - 10. This prevents potential comparison errors which can occur due to this discrepancy.
…to equivalent expressions

Previously, -x+f(x) would lower to a component list of -1 * x + f(x).
f(x)-x would lower to f(x) - x.
As a result, this expression wouldn't lower to the same tree. Now, expressionToComponentList converts subtractions to additions of -1 * the number.
e.g: a-b -> a + -1 * b.
Function takes in 2 binary trees, and evaluates whether their contents are equivalent.
Function converts expression trees into MathJax expressions, which can be shown to the user.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
"Complex" in this case means "The operator's children contain one or more other operators". This means the MathJax expression will need to surround that part of the expression with brackets.
Formula for calculating correctness = 100(1 - e^(no. identical nodes /(no. nodes in solution + difference in no. nodes))).
…on (#12)

Addresses question on PR #9 about helper function refactoring to reduce code duplication in response colour coding.

## Changes

- Added `getColourString()` helper function to encapsulate RGB string formatting
- Extracted repeated color string construction (8 occurrences) into single variable
@JoshdRod JoshdRod force-pushed the add-correctness-evaluator branch from 51702d4 to f75ecb3 Compare December 21, 2025 20:06
@JoshdRod JoshdRod merged commit 9dd3745 into dev-untested Dec 21, 2025
@JoshdRod JoshdRod deleted the add-correctness-evaluator branch January 4, 2026 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants