From abad2c7fe55e8aa3bef5b0fd88533bd941cb772d Mon Sep 17 00:00:00 2001
From: Jeshua Reyes <jeshuakrc@gmail.com>
Date: Sun, 30 Mar 2025 18:44:49 -0600
Subject: [PATCH 1/2] Initial design proposal

---
 design/design.puml | 112 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 112 insertions(+)
 create mode 100644 design/design.puml

diff --git a/design/design.puml b/design/design.puml
new file mode 100644
index 0000000..83ccf4b
--- /dev/null
+++ b/design/design.puml
@@ -0,0 +1,112 @@
+@startuml
+title BattleShip ULM
+
+' ========================================================================
+'                     DataStructure Hierarchy
+' ========================================================================
+interface DataStructure {
+  +OperationReport insert(int)
+  +OperationReport remove(int)
+  +OperationReport search(int)
+  +int getSize()
+}
+
+class OperationReport {
+  -int iterations
+  -std::chrono::milliseconds duration
+  -bool success
+
+  +OperationReport(int, std::chrono::milliseconds, bool)
+  +int getIterations()
+  +std::chrono::milliseconds getDuration()
+  +bool wasSuccessful()
+}
+
+DataStructure <|.. LinkedList
+DataStructure <|.. Set
+DataStructure <|.. BinarySearchList
+DataStructure <|.. BTree
+DataStructure <|.. BinaryTree
+
+abstract class BinaryTree {}
+
+BinaryTree <|-- Splay
+BinaryTree <|-- RedBlackTree
+
+class RedBlackTree {}
+
+class BTree {}
+
+class LinkedList {}
+
+class Set {
+  +bool contains()
+}
+
+class BinarySearchList {}
+
+' ========================================================================
+'                               Game Classes
+' ========================================================================
+class Wallet {
+  -int balance
+  +Wallet()
+  +void deposit(int)
+  +bool withdraw(int)
+  +int getBalance()
+}
+
+class Player {
+  -std::string name
+  -Wallet wallet
+  +Player(std::string)
+  +Wallet& getWallet()
+}
+
+class Board {
+  -int height
+  -int width
+  -std::vector<std::shared_ptr<Ship>> cells
+  -Player& player
+  +Board(int, int, Player&)
+  +int getHeight()
+  +int getWidth()
+  +std::shared_ptr<Ship> getAt(int, int)
+  +void setAt(int, int, std::shared_ptr<Ship>)
+  +bool containsShipAt(int, int)
+  +void moveTo(int, int, int, int)
+}
+
+class Ship {
+  -std::unique_ptr<DataStructure> structure
+  -std::vector<int> elms
+  -float health
+
+  +Ship(std::unique_ptr<DataStructure>)
+  +double shoot(Ship&)
+  +void powerUp()
+  +double getHealth()
+  +bool isSank()
+}
+
+class Shop {
+  +Shop()
+  +void addEntry(std::string, int, std::function<DataStructure*()>)
+  +std::shared_ptr<Ship> purchase(int, Wallet&)
+
+  -std::vector<Entry> entries
+}
+
+' ========================================================================
+'                              Relationships
+' ========================================================================
+Player "1" *-- "1" Wallet : has-a
+Board "1" o-- "1" Player : reference
+Board "1" o-- "0..*" Ship : cells (shared_ptr)
+
+Ship "1" *-- "1" DataStructure : structure (unique_ptr)
+
+Shop "1" o-- "1..*" Shop::Entry
+Shop ..> Ship : purchase(...) returns shared_ptr<Ship>
+
+@enduml
\ No newline at end of file
-- 
GitLab


From c3126ff2fa086d4ce3d9b03971312b8a6efebd0f Mon Sep 17 00:00:00 2001
From: Jeshua Reyes <jeshuakrc@gmail.com>
Date: Sun, 30 Mar 2025 18:57:02 -0600
Subject: [PATCH 2/2] Updated DataStructure relation with OperationReport in
 design.pulm

---
 design/design.puml | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/design/design.puml b/design/design.puml
index 83ccf4b..bc45521 100644
--- a/design/design.puml
+++ b/design/design.puml
@@ -100,13 +100,15 @@ class Shop {
 ' ========================================================================
 '                              Relationships
 ' ========================================================================
-Player "1" *-- "1" Wallet : has-a
+DataStructure "1" *-- "1" OperationReport : has a
+
+Player "1" *-- "1" Wallet : has a
 Board "1" o-- "1" Player : reference
 Board "1" o-- "0..*" Ship : cells (shared_ptr)
 
 Ship "1" *-- "1" DataStructure : structure (unique_ptr)
 
-Shop "1" o-- "1..*" Shop::Entry
+
 Shop ..> Ship : purchase(...) returns shared_ptr<Ship>
 
 @enduml
\ No newline at end of file
-- 
GitLab