CaptainSora / Dark-Nebula-Toolbox

Useful information and calculators for Dark Nebula, powered by Streamlit
0 stars 0 forks source link

Simulation return values #18

Closed CaptainSora closed 1 month ago

CaptainSora commented 2 months ago

Change output to be a dict of objects, to pass as a single object and unpack later

Also add a "valid" or "success" field for quick validations (to skip any truthy or df.empty() checks)

CaptainSora commented 1 month ago

https://refactoring.guru/design-patterns/strategy

Rewrite simulation function as a class, say Simulation This maintains a reference to a mining strategy object and can hold all the fields required

Create a Strategy class which acts as an interface Each strategy becomes its own subclass which overrides any common class methods

Big idea: Simulation class handles all the interaction with the user input. It holds all the module levels as well as all the possible results the frontend may need. Strategy class provides the framework for any specific mining strategy. Implements the generic method "execute" which "runs the simulation". Subclasses of Strategy are created for each additional mining strategy without any change to the information flow.

CaptainSora commented 1 month ago

Laying groundwork for issues #4 and #5