Open duanegoodner opened 4 days ago
Work on steps 1. Replace all CRTP interfaces with C++ Concepts and 2. Implement Builders is onging in concepts_for_interfaces branch.
concepts_for_interfaces branch pulled into main so we can address some general project cleanup issues without creating extra branch management / merge-fix work down the road. Work on this issue will resume soon on a new branch.
This issue consolidates issues https://github.com/duanegoodner/xiangqigame/issues/86 (moving Game and Player to C++ side of app) and https://github.com/duanegoodner/xiangqigame/issues/88 (unncecessary use of CRTP for some interfaces).
Will address these issues by doing the following:
1. Replace all CRTP interfaces with C++ Concepts. Like CRTP, will still have compile time polymorphism, but compiler errors are cleaner and syntax is easier to keep concise and self-documenting. For interfaces where performance gain of compile-time polymorphism doesn't matter, will still use Concept. Interfaces to convert to Concepts: SpaceInfoProvider PieceValueProvider BoardStateSummarizer MoveEvaluator JsonUtility
2. Implement Builders. For any class that implements any of the above interfaces, create a ....Builder class. ...Builder.build() methods will return std::shared_ptr.
3. Implement Game and Player on C++ side of app. Define Game and Player Concepts, implementations, and associated Builder classes. Builder for Player implementation(s) will return std::shared_ptr. GameBuilder will be top level builder, will handle majority of dependency injection, and will return a std::unique_ptr.
4. Simplify bindings. Expose Game and GameBuilder via Pybind. Should be able to remove most / all other bindings.
5. Simplify Python side of app. Python responsibilities will be reduced to: Collecting command line input, get GameSummary data from C++ Game object after each move and report status to terminal. Transfrorm GameSummary at end of game into objects that can be easily analyzed with tools like Pandas, matplotlib etc., and generate standard summary plots for each Game.
Note: Once Step 2, is done, might expose MoveEvaluator builders to Pybind as intermediate step before completing remaining steps.