diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..b58b603
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,5 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..e836b20
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+GGP_Exam
\ No newline at end of file
diff --git a/.idea/editor.xml b/.idea/editor.xml
new file mode 100644
index 0000000..e75b270
--- /dev/null
+++ b/.idea/editor.xml
@@ -0,0 +1,317 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..0b76fe5
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..47008e4
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..8306744
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/zombieGame.iml b/.idea/zombieGame.iml
new file mode 100644
index 0000000..f08604b
--- /dev/null
+++ b/.idea/zombieGame.iml
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/_DEMO_DEBUG/GPP_Plugin_d.dll b/_DEMO_DEBUG/GPP_Plugin_d.dll
index 577bf39..0a66bd9 100644
Binary files a/_DEMO_DEBUG/GPP_Plugin_d.dll and b/_DEMO_DEBUG/GPP_Plugin_d.dll differ
diff --git a/_DEMO_DEBUG/GPP_Plugin_d.exp b/_DEMO_DEBUG/GPP_Plugin_d.exp
index 43549f6..a1ab601 100644
Binary files a/_DEMO_DEBUG/GPP_Plugin_d.exp and b/_DEMO_DEBUG/GPP_Plugin_d.exp differ
diff --git a/_DEMO_DEBUG/GPP_Plugin_d.lib b/_DEMO_DEBUG/GPP_Plugin_d.lib
index 571eb07..49fbb0a 100644
Binary files a/_DEMO_DEBUG/GPP_Plugin_d.lib and b/_DEMO_DEBUG/GPP_Plugin_d.lib differ
diff --git a/_DEMO_DEBUG/GPP_Plugin_d.pdb b/_DEMO_DEBUG/GPP_Plugin_d.pdb
index 28d6044..5feb62c 100644
Binary files a/_DEMO_DEBUG/GPP_Plugin_d.pdb and b/_DEMO_DEBUG/GPP_Plugin_d.pdb differ
diff --git a/project/BehaviourTree.cpp b/project/BehaviourTree.cpp
new file mode 100644
index 0000000..129c4af
--- /dev/null
+++ b/project/BehaviourTree.cpp
@@ -0,0 +1,7 @@
+#pragma once
+
+class BehaviorTree
+{
+public:
+
+};
diff --git a/project/BehaviourTree.h b/project/BehaviourTree.h
new file mode 100644
index 0000000..e1fb80f
--- /dev/null
+++ b/project/BehaviourTree.h
@@ -0,0 +1,2 @@
+#include "stdafx.h"
+#include "BehaviorTree.h"
\ No newline at end of file
diff --git a/project/BlackBoard.h b/project/BlackBoard.h
new file mode 100644
index 0000000..db8fb2f
--- /dev/null
+++ b/project/BlackBoard.h
@@ -0,0 +1,80 @@
+#pragma once
+
+#include
+#include
+
+
+class IBlackBoardField
+{
+public:
+ IBlackBoardField() = default;
+ virtual ~IBlackBoardField() = default;
+};
+
+//BlackboardField does not take ownership of pointers whatsoever!
+template
+class BlackboardField : public IBlackBoardField
+{
+public:
+ explicit BlackboardField(T data) : m_Data(data) {
+ }
+ T GetData() { return m_Data; };
+ void SetData(T data) { m_Data = data; }
+
+private:
+ T m_Data;
+};
+
+class Blackboard final
+{
+public:
+ Blackboard() = default;
+ ~Blackboard() {
+ for (auto el : m_BlackboardData)
+ delete el.second;
+ m_BlackboardData.clear();
+ }
+
+ Blackboard(const Blackboard& other) = delete;
+ Blackboard& operator=(const Blackboard& other) = delete;
+ Blackboard(Blackboard&& other) = delete;
+ Blackboard& operator=(Blackboard&& other) = delete;
+
+ template bool AddData(const std::string& name, T data) {
+ auto it = m_BlackboardData.find(name);
+ if (it == m_BlackboardData.end()) {
+ m_BlackboardData[name] = new BlackboardField(data);
+ return true;
+ }
+ printf("WARNING: Data '%s' of type '%s' already in Blackboard \n", name.c_str(), typeid(T).name());
+ return false;
+ }
+
+ template bool ChangeData(const std::string& name, T data) {
+ auto it = m_BlackboardData.find(name);
+ if (it != m_BlackboardData.end()) {
+ BlackboardField* p = dynamic_cast*>(m_BlackboardData[name]);
+ if (p) {
+ p->SetData(data);
+ return true;
+ }
+ }
+ printf("WARNING: Data '%s' of type '%s' not found in Blackboard \n", name.c_str(), typeid(T).name());
+ return false;
+ }
+
+ //Get the data from the blackboard
+ template bool GetData(const std::string& name, T& data) {
+ BlackboardField* p = dynamic_cast*>(m_BlackboardData[name]);
+ if (p != nullptr) {
+ data = p->GetData();
+ return true;
+ }
+ printf("WARNING: Data '%s' of type '%s' not found in Blackboard \n", name.c_str(), typeid(T).name());
+ return false;
+ }
+
+private:
+ std::unordered_map m_BlackboardData;
+};
+
diff --git a/project/CMakeLists.txt b/project/CMakeLists.txt
index afe0652..0abddc8 100644
--- a/project/CMakeLists.txt
+++ b/project/CMakeLists.txt
@@ -3,7 +3,7 @@
# ADD NEW .cpp FILES HERE
add_library(Exam_Plugin SHARED
"stdafx.cpp"
- "SurvivalAgentPlugin.cpp" )
+ "SurvivalAgentPlugin.cpp" "BehaviourTree.cpp" "BehaviourTree.h" "BlackBoard.h" "Thinker.h" "Thinker.cpp")
target_link_libraries(Exam_Plugin PUBLIC ${EXAM_LIB_DEBUG})
target_include_directories(Exam_Plugin PUBLIC ${EXAM_INCLUDE_DIR})
diff --git a/project/SurvivalAgentPlugin.cpp b/project/SurvivalAgentPlugin.cpp
index 685a58b..08c1bba 100644
--- a/project/SurvivalAgentPlugin.cpp
+++ b/project/SurvivalAgentPlugin.cpp
@@ -12,10 +12,10 @@ void SurvivalAgentPlugin::Initialize(IBaseInterface* pInterface, PluginInfo& inf
m_pInterface = static_cast(pInterface);
//Information for the leaderboards!
- info.BotName = "MinionExam";
- info.Student_Name = "Firstname_Lastname"; //No special characters allowed. Highscores won't work with special characters.
- info.Student_Class = "2DAE00";
- info.LB_Password = "TheChampIsHere123!";//Don't use a real password! This is only to prevent other students from overwriting your highscore!
+ info.BotName = "Cat";
+ info.Student_Name = "Bram Verhulst";//No special characters allowed. Highscores won't work with special characters.
+ info.Student_Class = "2DAE11";
+ info.LB_Password = "ILikeCuteCats!";//Don't use a real password! This is only to prevent other students from overwriting your highscore!
}
//Called only once
diff --git a/project/Thinker.cpp b/project/Thinker.cpp
new file mode 100644
index 0000000..c0e98fc
--- /dev/null
+++ b/project/Thinker.cpp
@@ -0,0 +1,21 @@
+#include "stdafx.h"
+#include "Thinker.h"
+#include
+
+void Thinker::CheckIfNewHouse(const HouseInfo& newHouse) {
+ auto it = std::find_if(m_HousesMemory.begin(), m_HousesMemory.end(),
+ [&newHouse](const HouseMemory& house) {
+ return house.info.Center == newHouse.Center;
+ });
+
+ if (it != m_HousesMemory.end()) {
+ //it->lastSaw = std::chrono::steady_clock::now();
+ //it->newHouse = false;
+ return;
+ }
+
+ HouseMemory houseToMemory{};
+ houseToMemory.info = newHouse;
+
+ m_HousesMemory.push_back(houseToMemory);
+}
diff --git a/project/Thinker.h b/project/Thinker.h
new file mode 100644
index 0000000..6a1e0f7
--- /dev/null
+++ b/project/Thinker.h
@@ -0,0 +1,25 @@
+#pragma once
+#include
+#include
+#include
+
+class Thinker final {
+public:
+
+ struct HouseMemory {
+ bool newHouse{ true };
+ HouseInfo info;
+ std::chrono::steady_clock::time_point lastSaw;
+ };
+ Thinker() = default;
+
+ ~Thinker() = default;
+ Thinker(const Thinker&) = default;
+ Thinker& operator=(const Thinker&) = default;
+ Thinker(Thinker&&) = default;
+ Thinker& operator=(Thinker&&) = default;
+
+ void CheckIfNewHouse(const HouseInfo& newHouse);
+private:
+ std::vector m_HousesMemory{};
+};