From 8df59362613a14ea7fc54f98c666b0ac30d057e4 Mon Sep 17 00:00:00 2001
From: Jeshua Reyes <jeshuakrc@gmail.com>
Date: Fri, 28 Mar 2025 21:21:37 -0600
Subject: [PATCH 01/17] Defining datastrucutres design a initial files

---
 .vscode/settings.json                   | 12 ++++++++++++
 Makefile                                |  0
 include/dataStructure/DataStructure.h   | 17 +++++++++++++++++
 include/dataStructure/OperationReport.h | 16 ++++++++++++++++
 include/game/board.h                    |  0
 include/ship/Ship.h                     |  0
 src/main.cpp                            |  0
 7 files changed, 45 insertions(+)
 create mode 100644 .vscode/settings.json
 create mode 100644 Makefile
 create mode 100644 include/dataStructure/DataStructure.h
 create mode 100644 include/dataStructure/OperationReport.h
 create mode 100644 include/game/board.h
 create mode 100644 include/ship/Ship.h
 create mode 100644 src/main.cpp

diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..c07e551
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,12 @@
+{
+    "files.associations": {
+        "chrono": "cpp",
+        "compare": "cpp",
+        "concepts": "cpp",
+        "cstdint": "cpp",
+        "ctime": "cpp",
+        "ratio": "cpp",
+        "type_traits": "cpp",
+        "limits": "cpp"
+    }
+}
\ No newline at end of file
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..e69de29
diff --git a/include/dataStructure/DataStructure.h b/include/dataStructure/DataStructure.h
new file mode 100644
index 0000000..9dcf5f6
--- /dev/null
+++ b/include/dataStructure/DataStructure.h
@@ -0,0 +1,17 @@
+#pragma once
+
+#include "OperationReport.h"
+
+class DataStructure {
+public:
+    virtual OperationReport insert(int elm);
+    virtual OperationReport remove(int elm);
+    virtual OperationReport search(int elm);
+};
+
+class LinkedList : DataStructure {};
+class BinarySearchList : DataStructure {};
+class Set : DataStructure {};
+class RedBlackTree : DataStructure {};
+class BTree : DataStructure {};
+class Splay : DataStructure {};
\ No newline at end of file
diff --git a/include/dataStructure/OperationReport.h b/include/dataStructure/OperationReport.h
new file mode 100644
index 0000000..1efd43d
--- /dev/null
+++ b/include/dataStructure/OperationReport.h
@@ -0,0 +1,16 @@
+#pragma once
+
+#include <chrono>
+
+class OperationReport {
+private:
+    int iterations;
+    std::chrono::milliseconds duration;
+    bool success;
+
+public:
+    OperationReport(int iterations, std::chrono::milliseconds duration, bool successful);
+    int getIterations();
+    std::chrono::milliseconds getDuration();
+    bool wasSuccessful();
+};
\ No newline at end of file
diff --git a/include/game/board.h b/include/game/board.h
new file mode 100644
index 0000000..e69de29
diff --git a/include/ship/Ship.h b/include/ship/Ship.h
new file mode 100644
index 0000000..e69de29
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644
index 0000000..e69de29
-- 
GitLab


From 032754ac211613d2c2bc9c9f554771230f971d20 Mon Sep 17 00:00:00 2001
From: Jeshua Reyes <jeshuakrc@gmail.com>
Date: Fri, 28 Mar 2025 22:28:37 -0600
Subject: [PATCH 02/17] Defining DataStructure implementations

---
 include/dataStructure/BTree.h            | 17 +++++++++++++++++
 include/dataStructure/BinarySearchList.h | 17 +++++++++++++++++
 include/dataStructure/BinaryTree.h       | 19 +++++++++++++++++++
 include/dataStructure/DataStructure.h    | 15 ++++-----------
 include/dataStructure/LinkedList.h       | 22 ++++++++++++++++++++++
 include/dataStructure/RedBlackTree.h     | 24 ++++++++++++++++++++++++
 include/dataStructure/Set.h              | 18 ++++++++++++++++++
 include/dataStructure/Splay.h            | 12 ++++++++++++
 8 files changed, 133 insertions(+), 11 deletions(-)
 create mode 100644 include/dataStructure/BTree.h
 create mode 100644 include/dataStructure/BinarySearchList.h
 create mode 100644 include/dataStructure/BinaryTree.h
 create mode 100644 include/dataStructure/LinkedList.h
 create mode 100644 include/dataStructure/RedBlackTree.h
 create mode 100644 include/dataStructure/Set.h
 create mode 100644 include/dataStructure/Splay.h

diff --git a/include/dataStructure/BTree.h b/include/dataStructure/BTree.h
new file mode 100644
index 0000000..c7627f9
--- /dev/null
+++ b/include/dataStructure/BTree.h
@@ -0,0 +1,17 @@
+#pragma once
+
+#include "DataStructure.h"
+
+class BTree : DataStructure {
+private:
+    class Node {
+        // Need to further investigate this one
+    };
+
+public:
+    BTree();
+
+    OperationReport insert(int elm) const;
+    OperationReport remove(int elm) const;
+    OperationReport search(int elm) const;
+};
\ No newline at end of file
diff --git a/include/dataStructure/BinarySearchList.h b/include/dataStructure/BinarySearchList.h
new file mode 100644
index 0000000..5aed715
--- /dev/null
+++ b/include/dataStructure/BinarySearchList.h
@@ -0,0 +1,17 @@
+#pragma once
+
+#include "DataStructure.h"
+#include <memory>
+#include <vector>
+
+class BinarySearchList : DataStructure {
+private:
+    std::vector<int> elms;
+
+public:
+    BinarySearchList();
+
+    OperationReport insert(int elm) const override;
+    OperationReport remove(int elm) const override;
+    OperationReport search(int elm) const override;
+};
\ No newline at end of file
diff --git a/include/dataStructure/BinaryTree.h b/include/dataStructure/BinaryTree.h
new file mode 100644
index 0000000..cece427
--- /dev/null
+++ b/include/dataStructure/BinaryTree.h
@@ -0,0 +1,19 @@
+#pragma once
+
+#include <memory>
+#include "DataStructure.h"
+
+class BinaryTree : DataStructure {
+protected:
+    class Node {
+    public:
+        int val;
+        std::unique_ptr<Node> left;
+        std::unique_ptr<Node> right;
+    };
+
+public:
+    virtual OperationReport insert(int elm) const override = 0;
+    virtual OperationReport remove(int elm) const override = 0;
+    virtual OperationReport search(int elm) const override = 0;
+};
\ No newline at end of file
diff --git a/include/dataStructure/DataStructure.h b/include/dataStructure/DataStructure.h
index 9dcf5f6..64f3d5a 100644
--- a/include/dataStructure/DataStructure.h
+++ b/include/dataStructure/DataStructure.h
@@ -4,14 +4,7 @@
 
 class DataStructure {
 public:
-    virtual OperationReport insert(int elm);
-    virtual OperationReport remove(int elm);
-    virtual OperationReport search(int elm);
-};
-
-class LinkedList : DataStructure {};
-class BinarySearchList : DataStructure {};
-class Set : DataStructure {};
-class RedBlackTree : DataStructure {};
-class BTree : DataStructure {};
-class Splay : DataStructure {};
\ No newline at end of file
+    virtual OperationReport insert(int elm) const = 0;
+    virtual OperationReport remove(int elm) const = 0;
+    virtual OperationReport search(int elm) const = 0;
+};
\ No newline at end of file
diff --git a/include/dataStructure/LinkedList.h b/include/dataStructure/LinkedList.h
new file mode 100644
index 0000000..15f791f
--- /dev/null
+++ b/include/dataStructure/LinkedList.h
@@ -0,0 +1,22 @@
+#pragma once
+
+#include "DataStructure.h"
+#include <memory>
+
+class LinkedList : DataStructure {
+private:
+    class Node{
+    public:
+        int val;
+        std::unique_ptr<Node> next;
+    };
+    std::unique_ptr<Node> head;
+
+
+public:
+    LinkedList();
+
+    OperationReport insert(int elm) const override;
+    OperationReport remove(int elm) const override;
+    OperationReport search(int elm) const override;
+};
\ No newline at end of file
diff --git a/include/dataStructure/RedBlackTree.h b/include/dataStructure/RedBlackTree.h
new file mode 100644
index 0000000..4b76341
--- /dev/null
+++ b/include/dataStructure/RedBlackTree.h
@@ -0,0 +1,24 @@
+#pragma once
+
+#include "BinaryTree.h"
+
+class RedBlackTree : BinaryTree {
+private:
+    class RedBlackNode : BinaryTree::Node {
+    private:
+        bool isBlack;
+
+    public:
+        bool isBlack();
+        bool isRed();
+        void turnBlack();
+        void turnRed();
+    };
+
+public:
+    RedBlackTree();
+
+    OperationReport insert(int elm) const override;
+    OperationReport remove(int elm) const override;
+    OperationReport search(int elm) const override;
+};
\ No newline at end of file
diff --git a/include/dataStructure/Set.h b/include/dataStructure/Set.h
new file mode 100644
index 0000000..72aa02f
--- /dev/null
+++ b/include/dataStructure/Set.h
@@ -0,0 +1,18 @@
+#pragma once
+
+#include "DataStructure.h"
+#include <memory>
+#include <vector>
+
+class Set : DataStructure {
+private:
+    std::vector<bool> exists;
+
+public:
+    Set(int size);
+
+    OperationReport insert(int elm) const override;
+    OperationReport remove(int elm) const override;
+    OperationReport search(int elm) const override;
+    bool contains();
+};
\ No newline at end of file
diff --git a/include/dataStructure/Splay.h b/include/dataStructure/Splay.h
new file mode 100644
index 0000000..92c1d7f
--- /dev/null
+++ b/include/dataStructure/Splay.h
@@ -0,0 +1,12 @@
+#pragma once
+
+#include "BinaryTree.h"
+
+class Splay : BinaryTree {
+public:
+    Splay();
+
+    OperationReport insert(int elm) const override;
+    OperationReport remove(int elm) const override;
+    OperationReport search(int elm) const override;
+};
\ No newline at end of file
-- 
GitLab


From 959d1dfe3776f4cc686b460b9f6646d03afe19c6 Mon Sep 17 00:00:00 2001
From: Jeshua Reyes <jeshuakrc@gmail.com>
Date: Sat, 29 Mar 2025 15:42:03 -0600
Subject: [PATCH 03/17] Defined Board and Ship classes

---
 include/game/Board.h | 25 +++++++++++++++++++++++++
 include/game/board.h |  0
 include/ship/Ship.h  | 20 ++++++++++++++++++++
 3 files changed, 45 insertions(+)
 create mode 100644 include/game/Board.h
 delete mode 100644 include/game/board.h

diff --git a/include/game/Board.h b/include/game/Board.h
new file mode 100644
index 0000000..cd2df3c
--- /dev/null
+++ b/include/game/Board.h
@@ -0,0 +1,25 @@
+#pragma once
+
+#include <memory>
+#include <vector>
+#include "Ship.h"
+
+#define MAX_DAMAGE int 100;
+
+class Board {
+private:
+    int height;
+    int width;
+    std::vector<std::shared_ptr<Ship>> cells;
+
+public:
+
+    Board(int height, int width);
+
+    int getHeight();
+    int getWidth();
+    std::shared_ptr<Ship> getAt(int x, int y);
+    void setAt(int x, int y, std::shared_ptr<Ship> Ship);
+    bool containsShipAt(int x, int y);
+    void moveTo(int fromX, int fromY, int toX, int toY);
+};
\ No newline at end of file
diff --git a/include/game/board.h b/include/game/board.h
deleted file mode 100644
index e69de29..0000000
diff --git a/include/ship/Ship.h b/include/ship/Ship.h
index e69de29..018fe60 100644
--- a/include/ship/Ship.h
+++ b/include/ship/Ship.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#include <memory>
+#include "DataStructure.h"
+#include "Set.h"
+
+class Ship {
+private:
+    std::unique_ptr<DataStructure> structure;
+    Set elms;
+    float health;
+
+    void takeDamage(double damage);
+
+public:
+    Ship();
+
+    double shoot(Ship& target);
+    void powerUp();
+};
\ No newline at end of file
-- 
GitLab


From 71ea59639fc5053ec289b95f51aa93a5d1631893 Mon Sep 17 00:00:00 2001
From: Jeshua Reyes <jeshuakrc@gmail.com>
Date: Sat, 29 Mar 2025 20:47:46 -0600
Subject: [PATCH 04/17] Adding getSize method to data structures

---
 include/dataStructure/BTree.h            |  1 +
 include/dataStructure/BinarySearchList.h |  1 +
 include/dataStructure/BinaryTree.h       |  1 +
 include/dataStructure/DataStructure.h    |  1 +
 include/dataStructure/LinkedList.h       |  1 +
 include/dataStructure/RedBlackTree.h     |  1 +
 include/dataStructure/Set.h              |  2 ++
 include/dataStructure/Splay.h            |  1 +
 include/game/Board.h                     |  2 --
 include/ship/Ship.h                      | 20 --------------------
 10 files changed, 9 insertions(+), 22 deletions(-)
 delete mode 100644 include/ship/Ship.h

diff --git a/include/dataStructure/BTree.h b/include/dataStructure/BTree.h
index c7627f9..47a0bb4 100644
--- a/include/dataStructure/BTree.h
+++ b/include/dataStructure/BTree.h
@@ -14,4 +14,5 @@ public:
     OperationReport insert(int elm) const;
     OperationReport remove(int elm) const;
     OperationReport search(int elm) const;
+    int getSize() override;
 };
\ No newline at end of file
diff --git a/include/dataStructure/BinarySearchList.h b/include/dataStructure/BinarySearchList.h
index 5aed715..1650687 100644
--- a/include/dataStructure/BinarySearchList.h
+++ b/include/dataStructure/BinarySearchList.h
@@ -14,4 +14,5 @@ public:
     OperationReport insert(int elm) const override;
     OperationReport remove(int elm) const override;
     OperationReport search(int elm) const override;
+    int getSize() override;
 };
\ No newline at end of file
diff --git a/include/dataStructure/BinaryTree.h b/include/dataStructure/BinaryTree.h
index cece427..f690a23 100644
--- a/include/dataStructure/BinaryTree.h
+++ b/include/dataStructure/BinaryTree.h
@@ -16,4 +16,5 @@ public:
     virtual OperationReport insert(int elm) const override = 0;
     virtual OperationReport remove(int elm) const override = 0;
     virtual OperationReport search(int elm) const override = 0;
+    int getSize() override;
 };
\ No newline at end of file
diff --git a/include/dataStructure/DataStructure.h b/include/dataStructure/DataStructure.h
index 64f3d5a..ef12aa9 100644
--- a/include/dataStructure/DataStructure.h
+++ b/include/dataStructure/DataStructure.h
@@ -7,4 +7,5 @@ public:
     virtual OperationReport insert(int elm) const = 0;
     virtual OperationReport remove(int elm) const = 0;
     virtual OperationReport search(int elm) const = 0;
+    virtual int getSize() = 0;
 };
\ No newline at end of file
diff --git a/include/dataStructure/LinkedList.h b/include/dataStructure/LinkedList.h
index 15f791f..0a73776 100644
--- a/include/dataStructure/LinkedList.h
+++ b/include/dataStructure/LinkedList.h
@@ -19,4 +19,5 @@ public:
     OperationReport insert(int elm) const override;
     OperationReport remove(int elm) const override;
     OperationReport search(int elm) const override;
+    int getSize() override;
 };
\ No newline at end of file
diff --git a/include/dataStructure/RedBlackTree.h b/include/dataStructure/RedBlackTree.h
index 4b76341..4c5929a 100644
--- a/include/dataStructure/RedBlackTree.h
+++ b/include/dataStructure/RedBlackTree.h
@@ -21,4 +21,5 @@ public:
     OperationReport insert(int elm) const override;
     OperationReport remove(int elm) const override;
     OperationReport search(int elm) const override;
+    int getSize() override;
 };
\ No newline at end of file
diff --git a/include/dataStructure/Set.h b/include/dataStructure/Set.h
index 72aa02f..0eee414 100644
--- a/include/dataStructure/Set.h
+++ b/include/dataStructure/Set.h
@@ -7,6 +7,7 @@
 class Set : DataStructure {
 private:
     std::vector<bool> exists;
+    int size;
 
 public:
     Set(int size);
@@ -14,5 +15,6 @@ public:
     OperationReport insert(int elm) const override;
     OperationReport remove(int elm) const override;
     OperationReport search(int elm) const override;
+    int getSize() override;
     bool contains();
 };
\ No newline at end of file
diff --git a/include/dataStructure/Splay.h b/include/dataStructure/Splay.h
index 92c1d7f..76e6488 100644
--- a/include/dataStructure/Splay.h
+++ b/include/dataStructure/Splay.h
@@ -9,4 +9,5 @@ public:
     OperationReport insert(int elm) const override;
     OperationReport remove(int elm) const override;
     OperationReport search(int elm) const override;
+    int getSize() override;
 };
\ No newline at end of file
diff --git a/include/game/Board.h b/include/game/Board.h
index cd2df3c..3dfd8ad 100644
--- a/include/game/Board.h
+++ b/include/game/Board.h
@@ -4,8 +4,6 @@
 #include <vector>
 #include "Ship.h"
 
-#define MAX_DAMAGE int 100;
-
 class Board {
 private:
     int height;
diff --git a/include/ship/Ship.h b/include/ship/Ship.h
deleted file mode 100644
index 018fe60..0000000
--- a/include/ship/Ship.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#pragma once
-
-#include <memory>
-#include "DataStructure.h"
-#include "Set.h"
-
-class Ship {
-private:
-    std::unique_ptr<DataStructure> structure;
-    Set elms;
-    float health;
-
-    void takeDamage(double damage);
-
-public:
-    Ship();
-
-    double shoot(Ship& target);
-    void powerUp();
-};
\ No newline at end of file
-- 
GitLab


From 245584c18ca4e5c256d9048a3d39751781d8b501 Mon Sep 17 00:00:00 2001
From: Jeshua Reyes <jeshuakrc@gmail.com>
Date: Sat, 29 Mar 2025 20:48:07 -0600
Subject: [PATCH 05/17] Implementing Ship

---
 include/game/Ship.h | 25 ++++++++++++++++++++
 src/game/Board.cpp  | 23 ++++++++++++++++++
 src/game/Ship.cpp   | 57 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 105 insertions(+)
 create mode 100644 include/game/Ship.h
 create mode 100644 src/game/Board.cpp
 create mode 100644 src/game/Ship.cpp

diff --git a/include/game/Ship.h b/include/game/Ship.h
new file mode 100644
index 0000000..8fbcf94
--- /dev/null
+++ b/include/game/Ship.h
@@ -0,0 +1,25 @@
+#pragma once
+
+#include <memory>
+#include "DataStructure.h"
+#include "Set.h"
+
+#define MAX_DAMAGE 100
+#define ELMS_AMOUNT 15
+
+class Ship {
+private:
+    std::unique_ptr<DataStructure> structure;
+    std::vector<int> elms;
+    float health;
+
+    void takeDamage(double damage);
+
+public:
+    Ship(std::unique_ptr<DataStructure> ds);
+
+    double shoot(Ship& target);
+    void powerUp();
+    double getHealth();
+    bool isSank();
+};
\ No newline at end of file
diff --git a/src/game/Board.cpp b/src/game/Board.cpp
new file mode 100644
index 0000000..66dcbce
--- /dev/null
+++ b/src/game/Board.cpp
@@ -0,0 +1,23 @@
+#include "Board.h"
+
+Board::Board(int height, int width) {
+
+}
+int Board::getHeight() {
+
+}
+int Board::getWidth() {
+
+}
+std::shared_ptr<Ship> Board::getAt(int x, int y) {
+
+}
+void Board::setAt(int x, int y, std::shared_ptr<Ship> Ship) {
+
+}
+bool Board::containsShipAt(int x, int y) {
+
+}
+void Board::moveTo(int fromX, int fromY, int toX, int toY) {
+
+}
\ No newline at end of file
diff --git a/src/game/Ship.cpp b/src/game/Ship.cpp
new file mode 100644
index 0000000..f1c721a
--- /dev/null
+++ b/src/game/Ship.cpp
@@ -0,0 +1,57 @@
+#include <random>
+#include <algorithm>
+#include "Ship.h"
+
+int randomUpTo(int max) {
+    std::random_device rd;
+    std::mt19937 gen(rd());
+    std::uniform_int_distribution<> dis(0, max);
+
+    return dis(gen);
+}
+
+Ship::Ship(std::unique_ptr<DataStructure> ds) : structure(std::move(ds)), elms(std::vector<int>(ELMS_AMOUNT)), health(MAX_DAMAGE) {
+    std::iota(elms.begin(), elms.end(), 1);
+
+    std::random_device rd;
+    std::mt19937 gen(rd());
+    std::shuffle(elms.begin(), elms.end(), gen);
+
+    for (int elm : elms) {
+        this->structure->insert(elm);
+    }
+}
+void Ship::takeDamage(double damage) {
+    if (this->health <= 0) { return; }
+
+    this->health = this->health - damage;
+    if (this->health < 0) { this->health = 0; }
+}
+double Ship::shoot(Ship& target) {
+    // Get random index from elements set
+    int index = randomUpTo(this->elms.size());
+
+    // Search element in data structure
+    OperationReport rep = this->structure->search(elms[index]);
+
+    // Calculate damage
+    int dmg = MAX_DAMAGE / rep.getIterations();
+
+    // Attach
+    target.takeDamage(dmg);
+}
+void Ship::powerUp() {
+    // Selecting the latests element of the elms vector to be deleted
+    // (so deletion is constant, elms's already shuffled)
+    int elm = elms[elms.size() - 1];
+    elms.pop_back();
+
+    // Deleting elm from this ship's data structure
+    OperationReport rep = this->structure.get()->remove(elm);
+}
+double Ship::getHealth() {
+    return this->health;
+}
+bool Ship::isSank() {
+    return this->health <= 0;
+}
\ No newline at end of file
-- 
GitLab


From 73f886cd2607beb6554ab2a3ac6e7e65795274e1 Mon Sep 17 00:00:00 2001
From: Jeshua Reyes <jeshuakrc@gmail.com>
Date: Sun, 30 Mar 2025 16:40:26 -0600
Subject: [PATCH 06/17] Defined Shop and Wallet classes

---
 include/game/Shop.h   | 23 +++++++++++++++++++++++
 include/game/Wallet.h | 12 ++++++++++++
 2 files changed, 35 insertions(+)
 create mode 100644 include/game/Shop.h
 create mode 100644 include/game/Wallet.h

diff --git a/include/game/Shop.h b/include/game/Shop.h
new file mode 100644
index 0000000..d7b2167
--- /dev/null
+++ b/include/game/Shop.h
@@ -0,0 +1,23 @@
+#pragma once
+
+#include <functional>
+#include <string>
+#include <vector>
+#include "Ship.h"
+#include "Wallet.h"
+
+class Shop {
+public:
+    class Entry {
+        short id;
+        int price;
+        std::string name;
+        std::function<DataStructure*()> DataStructureSupplier;
+    };
+    std::vector<Shop::Entry> entries;
+
+    Shop();
+
+    void addEntry(std::string name, int price, std::function<DataStructure*()>);
+    std::shared_ptr<Ship> purchase(int entryId, Wallet& Wallet);
+};
\ No newline at end of file
diff --git a/include/game/Wallet.h b/include/game/Wallet.h
new file mode 100644
index 0000000..7d4f8de
--- /dev/null
+++ b/include/game/Wallet.h
@@ -0,0 +1,12 @@
+#pragma once
+
+class Wallet {
+private:
+    int balance;
+
+public:
+    Wallet();
+    void deposit(int amount);
+    bool withdraw(int amount);
+    int getBalance();
+};
\ No newline at end of file
-- 
GitLab


From 2d709b313ffa3bf4fbd3502a1afbe017249d58c0 Mon Sep 17 00:00:00 2001
From: Jeshua Reyes <jeshuakrc@gmail.com>
Date: Sun, 30 Mar 2025 16:49:12 -0600
Subject: [PATCH 07/17] Defining Player class

---
 include/game/Board.h  |  4 +++-
 include/game/Player.h | 14 ++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 include/game/Player.h

diff --git a/include/game/Board.h b/include/game/Board.h
index 3dfd8ad..87772bb 100644
--- a/include/game/Board.h
+++ b/include/game/Board.h
@@ -3,16 +3,18 @@
 #include <memory>
 #include <vector>
 #include "Ship.h"
+#include "Player.h"
 
 class Board {
 private:
     int height;
     int width;
     std::vector<std::shared_ptr<Ship>> cells;
+    Player& player;
 
 public:
 
-    Board(int height, int width);
+    Board(int height, int width, Player& player);
 
     int getHeight();
     int getWidth();
diff --git a/include/game/Player.h b/include/game/Player.h
new file mode 100644
index 0000000..b84c4c2
--- /dev/null
+++ b/include/game/Player.h
@@ -0,0 +1,14 @@
+#pragma once
+
+#include <string>
+#include "Wallet.h"
+
+class Player {
+private:
+    std::string name;
+    Wallet wallet;
+
+public:
+    Player(std::string name);
+    Wallet& getWallet();
+};
\ No newline at end of file
-- 
GitLab


From ffff1a2950777ce12b4e3d95f119e5cb1711fe07 Mon Sep 17 00:00:00 2001
From: Jeshua Reyes <jeshuakrc@gmail.com>
Date: Sun, 30 Mar 2025 16:51:12 -0600
Subject: [PATCH 08/17] Adding .gitingore

---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 .gitignore

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..dbe9c82
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.vscode/
\ No newline at end of file
-- 
GitLab


From f2c65096541f0e0a96d25cc8454067064f0ecb34 Mon Sep 17 00:00:00 2001
From: Jeshua Reyes <jeshuakrc@gmail.com>
Date: Sun, 30 Mar 2025 16:53:22 -0600
Subject: [PATCH 09/17] Removed .vscode

---
 .vscode/settings.json | 12 ------------
 1 file changed, 12 deletions(-)
 delete mode 100644 .vscode/settings.json

diff --git a/.vscode/settings.json b/.vscode/settings.json
deleted file mode 100644
index c07e551..0000000
--- a/.vscode/settings.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
-    "files.associations": {
-        "chrono": "cpp",
-        "compare": "cpp",
-        "concepts": "cpp",
-        "cstdint": "cpp",
-        "ctime": "cpp",
-        "ratio": "cpp",
-        "type_traits": "cpp",
-        "limits": "cpp"
-    }
-}
\ No newline at end of file
-- 
GitLab


From 1ce80ee7329b05bc24be1169f2224732e5cd313a Mon Sep 17 00:00:00 2001
From: Jeshua Reyes <jeshuakrc@gmail.com>
Date: Sun, 30 Mar 2025 16:54:18 -0600
Subject: [PATCH 10/17] updated .gitignore

---
 .gitignore | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index dbe9c82..0433f03 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,3 @@
-.vscode/
\ No newline at end of file
+.vscode/
+out/
+bin/
\ No newline at end of file
-- 
GitLab


From 59a1f4b93735dda1c236e64af3ef401a4a7bf46b Mon Sep 17 00:00:00 2001
From: Jeshua Reyes <jeshuakrc@gmail.com>
Date: Sun, 30 Mar 2025 17:58:45 -0600
Subject: [PATCH 11/17] Implementing OperationReport

---
 src/dataStructure/OperationReport.cpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 src/dataStructure/OperationReport.cpp

diff --git a/src/dataStructure/OperationReport.cpp b/src/dataStructure/OperationReport.cpp
new file mode 100644
index 0000000..d5fc88d
--- /dev/null
+++ b/src/dataStructure/OperationReport.cpp
@@ -0,0 +1,14 @@
+#include "OperationReport.h"
+
+OperationReport::OperationReport(int iterations, std::chrono::milliseconds duration, bool successful)
+: iterations(iterations), duration(duration), success(successful) {}
+
+int OperationReport::getIterations() {
+    return this->iterations;
+}
+std::chrono::milliseconds OperationReport::getDuration() {
+    return this->duration;
+}
+bool OperationReport::wasSuccessful() {
+    return this->success;
+}
\ No newline at end of file
-- 
GitLab


From e51cd04cd54dd5adeb246327682e0372bb415012 Mon Sep 17 00:00:00 2001
From: Jeshua Reyes <jeshuakrc@gmail.com>
Date: Sun, 30 Mar 2025 17:59:05 -0600
Subject: [PATCH 12/17] Implementing Board

---
 src/game/Board.cpp | 41 ++++++++++++++++++++++++++++++++++-------
 1 file changed, 34 insertions(+), 7 deletions(-)

diff --git a/src/game/Board.cpp b/src/game/Board.cpp
index 66dcbce..5938a87 100644
--- a/src/game/Board.cpp
+++ b/src/game/Board.cpp
@@ -1,23 +1,50 @@
+#include <stdexcept>
 #include "Board.h"
 
-Board::Board(int height, int width) {
+struct Coordinates
+{
+    int x;
+    int y;
+};
+int flatten(int x, int y, Board& board) {
+    return y * board.getWidth() + x;
+}
+struct Coordinates toCoordinates(int i, Board& Board) {
+    struct Coordinates c;
+    c.y = i / Board.getWidth();
+    c.x = i % Board.getWidth();
 
+    return c;
 }
-int Board::getHeight() {
 
+
+Board::Board(int height, int width, Player& player) : height(height), width(width), player(player) {
+
+}
+int Board::getHeight() {
+    return this->height;
 }
 int Board::getWidth() {
-
+    return this->width;
 }
 std::shared_ptr<Ship> Board::getAt(int x, int y) {
-
+    return this->cells[flatten(x, y, *this)];
 }
-void Board::setAt(int x, int y, std::shared_ptr<Ship> Ship) {
-
+void Board::setAt(int x, int y, std::shared_ptr<Ship> ship) {
+    this->cells[flatten(x, y, *this)] = ship;
 }
 bool Board::containsShipAt(int x, int y) {
-
+    return this->cells[flatten(x, y, *this)] != nullptr;
 }
 void Board::moveTo(int fromX, int fromY, int toX, int toY) {
+    if (!this->containsShipAt(fromX, fromY)) { return; }
+
+    if (this->containsShipAt(toX, toY)) {
+        throw std::runtime_error("Destination cell is not empty.");
+    }
+
+    int toI = flatten(toX, toY, *this), fromI = flatten(fromX, fromY, *this);
 
+    this->cells[toI] = this->cells[fromI];
+    this->cells[fromI].reset();
 }
\ No newline at end of file
-- 
GitLab


From 8c0c8a0113568a51c87756a6421d58d16ccd92a2 Mon Sep 17 00:00:00 2001
From: Jeshua Reyes <jeshuakrc@gmail.com>
Date: Sun, 30 Mar 2025 17:59:20 -0600
Subject: [PATCH 13/17] Fixing Ship.cpp compilation errors

---
 src/game/Ship.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/game/Ship.cpp b/src/game/Ship.cpp
index f1c721a..ee8fade 100644
--- a/src/game/Ship.cpp
+++ b/src/game/Ship.cpp
@@ -35,10 +35,12 @@ double Ship::shoot(Ship& target) {
     OperationReport rep = this->structure->search(elms[index]);
 
     // Calculate damage
-    int dmg = MAX_DAMAGE / rep.getIterations();
+    double dmg = MAX_DAMAGE / rep.getIterations();
 
     // Attach
     target.takeDamage(dmg);
+
+    return dmg;
 }
 void Ship::powerUp() {
     // Selecting the latests element of the elms vector to be deleted
@@ -47,7 +49,7 @@ void Ship::powerUp() {
     elms.pop_back();
 
     // Deleting elm from this ship's data structure
-    OperationReport rep = this->structure.get()->remove(elm);
+    /*OperationReport rep = */this->structure.get()->remove(elm);
 }
 double Ship::getHealth() {
     return this->health;
-- 
GitLab


From 0a05c3596e97d764037f1f134f4f9258c03f0096 Mon Sep 17 00:00:00 2001
From: Jeshua Reyes <jeshuakrc@gmail.com>
Date: Sun, 30 Mar 2025 17:59:51 -0600
Subject: [PATCH 14/17] Declaring a main method

---
 include/game/Board.h | 2 +-
 src/main.cpp         | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/game/Board.h b/include/game/Board.h
index 87772bb..a2541e0 100644
--- a/include/game/Board.h
+++ b/include/game/Board.h
@@ -19,7 +19,7 @@ public:
     int getHeight();
     int getWidth();
     std::shared_ptr<Ship> getAt(int x, int y);
-    void setAt(int x, int y, std::shared_ptr<Ship> Ship);
+    void setAt(int x, int y, std::shared_ptr<Ship> ship);
     bool containsShipAt(int x, int y);
     void moveTo(int fromX, int fromY, int toX, int toY);
 };
\ No newline at end of file
diff --git a/src/main.cpp b/src/main.cpp
index e69de29..5b0d568 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -0,0 +1,5 @@
+#include <iostream>
+
+int main(int argc, char *argv[]) {
+    std::cout << "I do nothing xd\n";
+}
-- 
GitLab


From 5f099242714e1b85d7059005515f2928e5b2bf55 Mon Sep 17 00:00:00 2001
From: Jeshua Reyes <jeshuakrc@gmail.com>
Date: Sun, 30 Mar 2025 18:00:16 -0600
Subject: [PATCH 15/17] Adding Makefile, so it now compiles. It does nothing,
 but it compiles :)

---
 Makefile | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/Makefile b/Makefile
index e69de29..657b789 100644
--- a/Makefile
+++ b/Makefile
@@ -0,0 +1,32 @@
+# Define the output executable name
+CC = g++
+CFLAGS = -m64 -Wall -Werror
+CCLIBS = 
+OUTPUT = battleship
+SRC_DIR = src
+BIN_DIR = bin
+OUT_DIR = out
+SRCS = $(shell find $(SRC_DIR) -name '*.cpp')
+OBJS = $(patsubst $(SRC_DIR)/%.cpp,$(BIN_DIR)/%.o,$(SRCS))
+INCLUDES = $(shell find ./include -type d -exec echo -I{} \;)
+
+# Default target to build the program
+all: build
+
+# Rule to assemble and link the program
+build: $(OBJS)
+	mkdir -p $(OUT_DIR)
+	$(CC) $(CFLAGS) -o $(OUT_DIR)/$(OUTPUT) $^ $(CCLIBS)
+
+# Rule to assemble the .asm file to an object file
+$(BIN_DIR)/%.o: $(SRC_DIR)/%.cpp
+	@mkdir -p $(dir $@)
+	$(CC) $(CFLAGS) -g $(INCLUDES) -c -o $@ $< $(CCLIBS)
+
+# Clean up the compiled files
+clean:
+	rm -r $(BIN_DIR) $(OUT_DIR)
+
+# Run the program
+run: all
+	./$(OUT_DIR)/$(OUTPUT)
\ No newline at end of file
-- 
GitLab


From 398cf69e8d59092239198cd17e11f1d17642f036 Mon Sep 17 00:00:00 2001
From: Jeshua Reyes <jeshuakrc@gmail.com>
Date: Sun, 30 Mar 2025 18:02:47 -0600
Subject: [PATCH 16/17] Adding ui.cpp as a placeholder

---
 src/ui/ui.cpp | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 src/ui/ui.cpp

diff --git a/src/ui/ui.cpp b/src/ui/ui.cpp
new file mode 100644
index 0000000..e69de29
-- 
GitLab


From 1a21ca75e25129319faffa76faedc655b8b26ab4 Mon Sep 17 00:00:00 2001
From: Jeshua Reyes <jeshuakrc@gmail.com>
Date: Sun, 30 Mar 2025 19:30:40 -0600
Subject: [PATCH 17/17] Making it so that OperationReport can be passed to
 ostream for debug purposes

---
 include/dataStructure/OperationReport.h | 3 +++
 src/dataStructure/OperationReport.cpp   | 9 +++++++++
 src/main.cpp                            | 9 ++++++++-
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/include/dataStructure/OperationReport.h b/include/dataStructure/OperationReport.h
index 1efd43d..fea0a0d 100644
--- a/include/dataStructure/OperationReport.h
+++ b/include/dataStructure/OperationReport.h
@@ -1,6 +1,7 @@
 #pragma once
 
 #include <chrono>
+#include <ostream>
 
 class OperationReport {
 private:
@@ -13,4 +14,6 @@ public:
     int getIterations();
     std::chrono::milliseconds getDuration();
     bool wasSuccessful();
+
+    friend std::ostream& operator<<(std::ostream& os, const OperationReport& report);
 };
\ No newline at end of file
diff --git a/src/dataStructure/OperationReport.cpp b/src/dataStructure/OperationReport.cpp
index d5fc88d..b1bb4f4 100644
--- a/src/dataStructure/OperationReport.cpp
+++ b/src/dataStructure/OperationReport.cpp
@@ -11,4 +11,13 @@ std::chrono::milliseconds OperationReport::getDuration() {
 }
 bool OperationReport::wasSuccessful() {
     return this->success;
+}
+std::ostream& operator<<(std::ostream& os, const OperationReport& report) {
+    os  << "\n"
+        << "Iteration:\t" << report.iterations << "\n"
+        << "Time:\t\t" << report.duration.count() << " ms\n"
+        << "Success:\t" << (report.success ? "true" : "false") << "\n"
+        << "\n";
+
+    return os;
 }
\ No newline at end of file
diff --git a/src/main.cpp b/src/main.cpp
index 5b0d568..b2db93c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,5 +1,12 @@
 #include <iostream>
+#include <chrono>
+
+#include "OperationReport.h"
 
 int main(int argc, char *argv[]) {
-    std::cout << "I do nothing xd\n";
+    OperationReport r(10, std::chrono::milliseconds(100000), true);
+
+    std::cout << r;
+
+    return 0;
 }
-- 
GitLab