Commit Graph

7 Commits

Author SHA1 Message Date
Aryadev Chavali
163f1e691a NodeAllocator can now get nodes by value or by reference
Abstracting the interface more, such that callers can use functions
rather than accessing internals directly, allows me to refactor the
allocator without having to do a ton of edits all across the source
tree.
2024-07-26 17:01:20 +01:00
Aryadev Chavali
8cbc602799 Changed from int64_t to optional<word_t> for pointers in Node 2024-07-26 17:00:59 +01:00
Aryadev Chavali
4cc1af94f6 iterate now computes highest value fraction it generated.
Not very useful, but isn't a massive performance waster (I think) and
it will be useful when thinking about colour schemes in graphics.
2024-07-26 03:13:24 +01:00
Aryadev Chavali
84c07870e4 Rework MAX macro to use < operator
MAX now works with Fraction's
2024-07-26 03:13:14 +01:00
Aryadev Chavali
7f7a609d30 Introduce normalised value in fraction class
Bit of a cheat but it would allow us to do some interesting graphical
stuff later.
2024-07-26 03:11:58 +01:00
Aryadev Chavali
139f2e9e5a Rework node constructor and general procedure API
Node constructor is now completely default constructed i.e. no
constructor arguments required.  The iterate function takes the queue
by reference, so it can update the caller's state.

Finally, to_string for a Node now uses the node allocator and an index
to print out trees.  Seems simpler and more in line with the current
implementation.
2024-07-26 02:55:58 +01:00
Aryadev Chavali
d73ecff38a Made header file for a separate numerics file
Separates the (basically) completed cw_tree implementation in a
separate module so we can spend time implementing graphics in main.

NOTE: nodes are now generated from a node allocator, which just wraps
around the vector.  We also take an allocator and queue by reference
in the iterate procedure now.
2024-07-26 02:54:02 +01:00