Rename corelogic->hcore, add simulator skeleton classes

This commit is contained in:
2025-01-03 20:02:24 -04:00
parent bb54aac865
commit f9b377a9f4
30 changed files with 153 additions and 9 deletions
+15
View File
@@ -0,0 +1,15 @@
#ifndef _ASSOCIATION_H
#define _ASSOCIATION_H
#include <chronomenon.h>
#include <existent.h>
class Association
{
public:
Association(Quale quale, Chronomenon chron);
Association(Quale quale, Existent ex);
Association(Quale quale, Existent ex);
};
#endif
+25
View File
@@ -0,0 +1,25 @@
#ifndef _ATTENTION_GRABBER_H
#define _ATTENTION_GRABBER_H
#include <cstdbool>
#include <attentionTrigger.h>
#include <chronomenon.h>
class AttentionGrabber
{
public:
AttentionGrabber(AttentionTrigger cause, Chronomenon chron)
: isNull(false)
{
}
void setNull(void) { isNull = true; }
int operator!(void) { return isNull; }
public:
AttentionTrigger cause;
Chronomenon chron;
bool isNull;
};
#endif
+7
View File
@@ -0,0 +1,7 @@
#ifndef _ATTENTION_TRIGGER_H
#define _ATTENTION_TRIGGER_H
class AttentionTrigger
{};
#endif
+17
View File
@@ -0,0 +1,17 @@
#ifndef _BODY_MAP_H
#define _BODY_MAP_H
#include <set>
#include <cstdint>
#include <body/limb.h>
class BodyMap {
public:
BodyMap() = default;
~BodyMap() = default;
std::set<uint32_t, BodyLimb> limbs;
};
#endif // _BODY_MAP_H
+64
View File
@@ -0,0 +1,64 @@
#ifndef BODY_MESSAGE_H
#define BODY_MESSAGE_H
#include <vector>
#include <cstdint>
#include <body/limb.h>
#include <body/bodyPart.h>
class BodyMessage
{
public:
BodyMessage() = default;
~BodyMessage() = default;
};
class BodySpotImpactEntry
{
public:
enum class ReportType
{
PRESSURE,
PAIN,
PLEASURE,
HEAT,
COLD
};
BodySpotImpactEntry(uint32_t _spot, ReportType _type, uint32_t _value)
: spot(_spot), type(_type), value(_value)
{}
~BodySpotImpactEntry() = default;
public:
uint32_t spot;
ReportType type;
uint32_t value;
};
class BodySpotImpactInd
: public BodyMessage
{
public:
BodySpotImpactInd(BodyPart &_part) : part(_part) {}
~BodySpotImpactInd() = default;
public:
BodyPart &part;
std::vector<BodySpotImpactEntry> entries;
};
class BodyPartMsg
: public BodyMessage
{
public:
BodyPartMsg(const BodyPart& _part)
:part(_part)
{}
public:
const BodyPart& part;
};
#endif // BODY_MESSAGE_H
+42
View File
@@ -0,0 +1,42 @@
#ifndef BODYPART_H
#define BODYPART_H
#include <cstdint>
#include <string>
#include <set>
#include <sensors/interoceptor.h>
class BodySpot
{
public:
BodySpot(uint32_t _id, std::string _description)
: id(_id), description(_description)
{}
~BodySpot() = default;
public:
uint32_t id;
std::string description;
std::set<uint32_t, Interoceptor> interoceptors;
};
class BodyPart
{
public:
BodyPart(uint32_t _partId, std::string _partName,
std::string _partDesc, std::string _partLoc)
: id(_partId), name(_partName),
description(_partDesc), location(_partLoc)
{}
~BodyPart() = default;
public:
const uint32_t id;
std::string name, description, location;
std::set<uint32_t, BodySpot> spots;
};
#endif // BODYPART_H
+28
View File
@@ -0,0 +1,28 @@
#ifndef BODY_LIMB_H
#define BODY_LIMB_H
#include <string>
#include <set>
#include <cstdint>
#include <body/bodyPart.h>
class BodyLimb
{
public:
BodyLimb(uint32_t _id) : id(_id) {}
BodyLimb(uint32_t _id,
const std::string& _name, const std::string& _desc,
const std::string& _loc)
: id(_id), name(_name), description(_desc), location(_loc)
{}
~BodyLimb() = default;
public:
uint32_t id;
std::string name, description, location;
std::set<uint32_t, BodyPart> parts;
};
#endif // BODY_LIMB_H
+30
View File
@@ -0,0 +1,30 @@
#ifndef _CHRONOMENON_H
#define _CHRONOMENON_H
#include <vector>
#include <qualeBundle.h>
#include <mentalEntity.h>
class Chronomenon
: public MentalEntity
{
public:
class Timestamp
{
uintptr_t value;
};
class Duration
{
uintptr_t value;
};
public:
Chronomenon extract(Timestamp start, Duration len);
public:
std::vector<QualeBundle> qualia;
};
#endif
+11
View File
@@ -0,0 +1,11 @@
#ifndef _CONCEPT_H
#define _CONCEPT_H
#include <mentalEntity.h>
class Concept
: public MentalEntity
{
};
#endif
+11
View File
@@ -0,0 +1,11 @@
#ifndef _EXISTENT_H
#define _EXISTENT_H
#include <mentalEntity.h>
class Existent
: public MentalEntity
{
};
#endif
+15
View File
@@ -0,0 +1,15 @@
#ifndef _GOAL_H
#define _GOAL_H
namespace thought {
enum class Goal
{
DRIFT,
ASSOCIATE_CAUSAL_QUALE_WITH_INTRINSIC_MOTIVATORS,
RESPOND_TO_CAUSAL_QUALE
};
}
#endif
+8
View File
@@ -0,0 +1,8 @@
#ifndef _MENTAL_ENTITY_H
#define _MENTAL_ENTITY_H
class MentalEntity
{
};
#endif
+32
View File
@@ -0,0 +1,32 @@
#ifndef _MIND_H
#define _MIND_H
#include <cstdlib>
#include <memory>
#include <thought.h>
#include <concept.h>
#include <attentionGrabber.h>
class Mind
{
public:
AttentionGrabber poll(void);
void focusOn(std::shared_ptr<Thought> thought)
{
currentThought = thought;
}
void execute(void)
{};
bool recognizes(AttentionTrigger intrin)
{ return !!(std::rand() / 2); };
public:
std::shared_ptr<Thought> currentThought;
Concept Desirables,
Undesirables;
};
#endif
+20
View File
@@ -0,0 +1,20 @@
#ifndef _NON_NEUTRAL_QUALIA_H
#define _NON_NEUTRAL_QUALIA_H
#include <quale.h>
class PleasurableQuale
: public NonNeutralQuale
{
public:
virtual void eventInd(void);
};
class PainfulQuale
: public NonNeutralQuale
{
public:
virtual void eventInd(void);
};
#endif
+39
View File
@@ -0,0 +1,39 @@
#ifndef _QUALE_H
#define _QUALE_H
#include <cstdint>
#include <attentionTrigger.h>
class Quale
{
public:
enum class Type
{
NEUTRAL,
/* Bounding refers to qualia such as tactile pressure which
* are mostly neutral but disclose information about the limits
* of the body.
**/
BOUNDING,
PAINFUL,
PLEASURABLE
} type;
int32_t intensity;
};
class NeutralQuale
: public Quale
{
};
class NonNeutralQuale
: public Quale, public AttentionTrigger
{
public:
virtual void eventInd(void);
public:
};
#endif
+16
View File
@@ -0,0 +1,16 @@
#ifndef _QUALE_BUNDLE_H
#define _QUALE_BUNDLE_H
#include <config.h>
#include <array>
#include <quale.h>
#define CONFIG_NUM_SENSORS 5
typedef std::array<Quale, CONFIG_NUM_SENSORS> QualeBundle_t;
class QualeBundle
{
QualeBundle_t qualia;
};
#endif
+93
View File
@@ -0,0 +1,93 @@
#ifndef _INTEROCEPTOR_H
#define _INTEROCEPTOR_H
#include <cstdint>
class Interoceptor {
public:
Interoceptor(uint32_t _id, uint32_t _value = 0)
: id(_id), value(_value)
{}
~Interoceptor() = default;
public:
uint32_t id;
uint64_t value;
};
class NeutralInteroceptor
: public Interoceptor {
public:
NeutralInteroceptor(uint32_t _id, uint32_t _value = 0)
: Interoceptor(_id, _value)
{}
};
class IntrinInteroceptor
: public Interoceptor {
public:
static constexpr uint32_t DEFAULT_INDICATION_THRESHOLD = 1;
static constexpr uint32_t DEFAULT_ALERT_THRESHOLD = 5;
static constexpr uint32_t DEFAULT_OVERLOAD_THRESHOLD = 9;
IntrinInteroceptor(
uint32_t _id,
uint32_t _value = 0,
uint32_t _indicationThreshold = DEFAULT_INDICATION_THRESHOLD,
uint32_t _alertThreshold = DEFAULT_ALERT_THRESHOLD,
uint32_t _overloadThreshold = DEFAULT_OVERLOAD_THRESHOLD)
: Interoceptor(_id, _value),
indicationThreshold(_indicationThreshold),
alertThreshold(_alertThreshold),
overloadThreshold(_overloadThreshold)
{}
~IntrinInteroceptor() = default;
public:
uint32_t indicationThreshold;
uint32_t alertThreshold;
uint32_t overloadThreshold;
};
/**
* Pain and pleasure interoceptors are specialized intrinsic interoceptors that, unlike
* neutral interoceptors, have activation thresholds for different response levels
* (indication, alert, and overload). These thresholds allow them to trigger graduated
* responses based on stimulus intensity.
*
* While neutral interoceptors simply record a binary state or basic value, pain and
* pleasure interoceptors can model complex sensory responses with multiple activation
* levels, similar to biological pain/pleasure responses. Each threshold represents a
* different level of urgency or intensity in the sensory input.
*
* @see IntrinInteroceptor for the threshold values and implementation details
*****************************************************************************************/
class PainInteroceptor
: public IntrinInteroceptor {
public:
PainInteroceptor(
uint32_t _id,
uint32_t _value = 0,
uint32_t _indicationThreshold = DEFAULT_INDICATION_THRESHOLD,
uint32_t _alertThreshold = DEFAULT_ALERT_THRESHOLD,
uint32_t _overloadThreshold = DEFAULT_OVERLOAD_THRESHOLD)
: IntrinInteroceptor(_id, _value, _indicationThreshold, _alertThreshold, _overloadThreshold)
{}
};
class PleasureInteroceptor
: public IntrinInteroceptor {
public:
PleasureInteroceptor(
uint32_t _id,
uint32_t _value = 0,
uint32_t _indicationThreshold = DEFAULT_INDICATION_THRESHOLD,
uint32_t _alertThreshold = DEFAULT_ALERT_THRESHOLD,
uint32_t _overloadThreshold = DEFAULT_OVERLOAD_THRESHOLD)
: IntrinInteroceptor(_id, _value, _indicationThreshold, _alertThreshold, _overloadThreshold)
{}
};
#endif // _INTEROCEPTOR_H
+21
View File
@@ -0,0 +1,21 @@
#ifndef CANVAS_H
#define CANVAS_H
#include <simulator/scene.h>
namespace canvas {
class Canvas {
public:
Canvas();
~Canvas();
SceneId loadScene(Scene &scene);
private:
// Add private members here
};
} // namespace canvas
#endif // CANVAS_H
+72
View File
@@ -0,0 +1,72 @@
#ifndef SIMULATOR_COMMANDLIST_H
#define SIMULATOR_COMMANDLIST_H
#include <vector>
#include <cstdint>
#include <mentalEntity.h>
namespace scene {
/**
* @brief Base class for all commands, storing a reference to a mental entity ID.
*
* Derived classes can extend this to include additional command-specific
* data and behavior.
*/
class Command
{
public:
Command(const MentalEntity::Id menty) : menty(menty) {}
public:
const MentalEntity::Id menty;
};
class CommandList
{
public:
CommandList() = default;
/**
* @brief Used by Scene to point to the currently executing command.
*
* scene::Scene maintains an internal cursor. As it executes commands from
* its internal command list, it advances the cursor to the current command
* before executing it.
*/
class Cursor
{
public:
Cursor(CommandList& commandList)
: commandList(commandList), iter(commandList.commands.begin())
{}
void reset() { iter = commandList.commands.begin(); }
bool hasNext() const { return iter != commandList.commands.end(); }
Cursor next() { return Cursor(commandList, ++iter); }
private:
Cursor(
CommandList& commandList,
std::vector<Command>::iterator iter)
: commandList(commandList), iter(iter)
{}
public:
CommandList& commandList;
std::vector<Command>::iterator iter;
};
Cursor getCursor() { return Cursor(*this); }
void addCommand(const Command& command)
{
commands.push_back(command);
}
public:
std::vector<Command> commands;
};
} // namespace scene
#endif // SIMULATOR_COMMANDLIST_H
+36
View File
@@ -0,0 +1,36 @@
#ifndef _SCENE_H
#define _SCENE_H
#include <cstdint>
#include <map>
#include <mentalEntity.h>
#include <simulator/commandList.h>
namespace scene {
class Scene
{
public:
using Id = uint32_t;
Scene();
~Scene();
bool hasMentalEntity(const MentalEntity::Id menty) const;
MentalEntity::Id addMentalEntity(const MentalEntity& menty);
void replaceMentalEntity(const MentalEntity::Id menty, const MentalEntity& newMenty);
void removeMentalEntity(const MentalEntity::Id menty);
void executeInd(void);
CommandList::Cursor haltInd(void);
private:
std::map<MentalEntity::Id, MentalEntity &> menties;
CommandList commands;
CommandList::Cursor cursor;
};
}
#endif
+24
View File
@@ -0,0 +1,24 @@
#ifndef SIMULATOR_H
#define SIMULATOR_H
#include <simulator/canvas.h>
namespace simulator {
class Simulator {
public:
Simulator();
~Simulator();
void initialize();
void run();
void stop();
private:
bool isRunning;
Canvas canvas;
};
}
#endif // SIMULATOR_H
+30
View File
@@ -0,0 +1,30 @@
#ifndef STUPEFIER_H
#define STUPEFIER_H
#include <cstdint>
class Stupefier {
public:
Stupefier();
~Stupefier();
void up(uint32_t);
void down(uint32_t);
public:
uint32_t focus;
};
class SoftStupefier : public Stupefier {
public:
SoftStupefier();
~SoftStupefier();
};
class HardStupefier : public Stupefier {
public:
HardStupefier();
~HardStupefier();
};
#endif // STUPEFIER_H
+11
View File
@@ -0,0 +1,11 @@
#ifndef _SUBCONSCIOUS_H
#define _SUBCONSCIOUS_H
#include <thoughtContentSource.h>
class Subconscious
: public ThoughtContentSource
{
};
#endif
+60
View File
@@ -0,0 +1,60 @@
#ifndef _THOUGHT_H
#define _THOUGHT_H
#include <iostream>
#include <scene.h>
#include <attentionGrabber.h>
#include <goal.h>
class Thought
{
public:
Thought(void)
{
setGoal(thought::Goal::DRIFT);
}
public:
void walk(void)
{
for (;;)
{
step();
}
};
void step(void) { std::cout <<"Step\n"; }
void setGoal(thought::Goal g)
{ goal = g; }
public:
Scene scene;
thought::Goal goal;
};
class ActiveThought
: public Thought
{
public:
ActiveThought(AttentionGrabber ag)
: currFocus(ag)
{
setGoal(thought::Goal
::ASSOCIATE_CAUSAL_QUALE_WITH_INTRINSIC_MOTIVATORS);
}
public:
AttentionGrabber currFocus;
};
class IdleThought
: public Thought
{
public:
IdleThought(void)
{}
};
#endif
+8
View File
@@ -0,0 +1,8 @@
#ifndef _THOUGHT_CONTENT_SOURCE_H
#define _THOUGHT_CONTENT_SOURCE_H
class ThoughtContentSource
{
};
#endif
+26
View File
@@ -0,0 +1,26 @@
#ifndef _VALUE_JUDGEMENT_H
#define _VALUE_JUDGEMENT_H
#include <cstdint>
class ValueJdgmnt
{
uint32_t intensity;
};
class PosValueJdgmnt
: public ValueJdgmnt
{
};
class NegValueJdgmnt
: public ValueJdgmnt
{
};
class NtrlValueJdgmnt
: public ValueJdgmnt
{
};
#endif