diff --git a/Makefile.am b/Makefile.am index e055d37..93c0b5a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,7 @@ -SUBDIRS = corelogic +SUBDIRS = hcore + +AM_CPPFLAGS+= -I"$(abs_srcdir)/hcore/include" bin_PROGRAMS = harikoff harikoff_SOURCES = main.cpp -harikoff_LDADD = corelogic/libcorelogic.a +harikoff_LDADD = hcore/libhcore.a diff --git a/configure.ac b/configure.ac index 728900d..9de04d2 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_INIT([The Harriman-Peikoff Project], [0.00.000], [harikoff], [github.com/latentprion/harikoff]) -AC_CONFIG_SRCDIR([corelogic/mind.cpp]) +AC_CONFIG_SRCDIR([hcore/mind.cpp]) AC_CONFIG_AUX_DIR([autotools-aux]) AM_INIT_AUTOMAKE([foreign -Wall -Werror]) @@ -13,14 +13,13 @@ AC_PROG_CXX AC_PROG_RANLIB AM_PROG_AR -AM_CPPFLAGS=m4_normalize(["-I\"\$(abs_top_srcdir)/include\" \ - -I\"\$(abs_top_srcdir)/corelogic/include\""]) +AM_CPPFLAGS=m4_normalize(["-I\"\$(abs_top_srcdir)/include\""]) AC_SUBST([AM_CPPFLAGS]) AC_CONFIG_HEADERS([include/config.h]) AC_CONFIG_FILES([ - Makefile corelogic/Makefile + Makefile hcore/Makefile ]) AC_OUTPUT diff --git a/hcore/Makefile.am b/hcore/Makefile.am index d1efd59..dbfc28d 100644 --- a/hcore/Makefile.am +++ b/hcore/Makefile.am @@ -1,2 +1,4 @@ -noinst_LIBRARIES = libcorelogic.a -libcorelogic_a_SOURCES = painfulQuale.cpp mind.cpp +AM_CPPFLAGS+= -I"$(abs_top_srcdir)/hcore/include" + +noinst_LIBRARIES = libhcore.a +libhcore_a_SOURCES = mind.cpp diff --git a/hcore/include/director/commandList.h b/hcore/include/director/commandList.h index 922f0b8..bc78330 100644 --- a/hcore/include/director/commandList.h +++ b/hcore/include/director/commandList.h @@ -43,7 +43,12 @@ public: void reset() { iter = commandList.commands.begin(); } bool hasNext() const { return iter != commandList.commands.end(); } - Cursor next() { return Cursor(commandList, ++iter); } + Cursor next() { return ++(*this); } + + Cursor& operator++() { + ++iter; + return *this; + } private: Cursor( diff --git a/hcore/include/director/director.h b/hcore/include/director/director.h index 89c9462..3ccf5ed 100644 --- a/hcore/include/director/director.h +++ b/hcore/include/director/director.h @@ -1,6 +1,8 @@ #ifndef DIRECTOR_H #define DIRECTOR_H +#include + namespace director { class Director { diff --git a/hcore/include/mentalEntity.h b/hcore/include/mentalEntity.h index 3bf99da..96b5f70 100644 --- a/hcore/include/mentalEntity.h +++ b/hcore/include/mentalEntity.h @@ -3,6 +3,8 @@ class MentalEntity { +public: + using Id = uint32_t; }; #endif diff --git a/hcore/include/mind.h b/hcore/include/mind.h index e696628..cff354d 100644 --- a/hcore/include/mind.h +++ b/hcore/include/mind.h @@ -1,32 +1,21 @@ #ifndef _MIND_H #define _MIND_H -#include -#include +#include +#include -#include -#include -#include +#include +#include class Mind { public: - AttentionGrabber poll(void); - void focusOn(std::shared_ptr thought) - { - currentThought = thought; - } + std::thread directorThread; + std::thread simulatorThread; + std::thread subconsciousThread; - void execute(void) - {}; - - bool recognizes(AttentionTrigger intrin) - { return !!(std::rand() / 2); }; - -public: - std::shared_ptr currentThought; - Concept Desirables, - Undesirables; + director::Director director; + simulator::Simulator simulator; }; #endif diff --git a/hcore/include/simulator/commandList.h b/hcore/include/simulator/commandList.h index fa8de1c..959380c 100644 --- a/hcore/include/simulator/commandList.h +++ b/hcore/include/simulator/commandList.h @@ -43,7 +43,12 @@ public: void reset() { iter = commandList.commands.begin(); } bool hasNext() const { return iter != commandList.commands.end(); } - Cursor next() { return Cursor(commandList, ++iter); } + Cursor next() { return ++(*this); } + + Cursor& operator++() { + ++iter; + return *this; + } private: Cursor( diff --git a/hcore/include/simulator/scene.h b/hcore/include/simulator/scene.h index 9f4e79f..e3ead27 100644 --- a/hcore/include/simulator/scene.h +++ b/hcore/include/simulator/scene.h @@ -13,8 +13,10 @@ class Scene public: using Id = uint32_t; - Scene(); - ~Scene(); + Scene() : + cursor(commands) + {} + ~Scene() = default; bool hasMentalEntity(const MentalEntity::Id menty) const; MentalEntity::Id addMentalEntity(const MentalEntity& menty); diff --git a/hcore/include/simulator/simulator.h b/hcore/include/simulator/simulator.h index 9e4ac8b..741edc6 100644 --- a/hcore/include/simulator/simulator.h +++ b/hcore/include/simulator/simulator.h @@ -1,6 +1,7 @@ #ifndef SIMULATOR_H #define SIMULATOR_H +#include #include namespace simulator { diff --git a/hcore/mind.cpp b/hcore/mind.cpp index cee0de4..38d08ed 100644 --- a/hcore/mind.cpp +++ b/hcore/mind.cpp @@ -1,10 +1,2 @@ #include - -AttentionGrabber Mind::poll(void) -{ - AttentionTrigger tmpAt; - Chronomenon tmpChron; - - return AttentionGrabber(tmpAt, tmpChron); -} diff --git a/main.cpp b/main.cpp index a8c7dea..e282edb 100644 --- a/main.cpp +++ b/main.cpp @@ -4,38 +4,5 @@ int main(int argc, char **argv) { Mind mind; - for (;;) - { - AttentionGrabber currentEmergency = mind.poll(); - - if (!currentEmergency) - { - // Idle thought's goal is automatically Goal::DRIFT. - auto idleThought = std::make_shared(); - - mind.focusOn(idleThought); - } - else - { - thought::Goal goal; - - auto urgentThought = std::make_shared(currentEmergency); - - if (!mind.recognizes(currentEmergency.cause)) { - goal = thought::Goal - ::ASSOCIATE_CAUSAL_QUALE_WITH_INTRINSIC_MOTIVATORS; - } - else { - goal = thought::Goal - ::RESPOND_TO_CAUSAL_QUALE; - } - - urgentThought->setGoal(goal); - mind.focusOn(urgentThought); - } - - mind.execute(); - } - return 0; }