From 7845c895593accb26a9cda66601a8bca668c37f4 Mon Sep 17 00:00:00 2001 From: Christian Heinemann Date: Wed, 13 Nov 2024 21:21:08 +0100 Subject: [PATCH] renaming: acitivity -> signal --- source/EngineGpuKernels/AttackerProcessor.cuh | 12 +- .../CellFunctionProcessor.cuh | 54 ++--- .../EngineGpuKernels/ConstructorProcessor.cuh | 22 +- source/EngineGpuKernels/DataAccessKernels.cu | 8 +- .../EngineGpuKernels/DetonatorProcessor.cuh | 8 +- source/EngineGpuKernels/InjectorProcessor.cuh | 12 +- source/EngineGpuKernels/MuscleProcessor.cuh | 56 ++--- source/EngineGpuKernels/NerveProcessor.cuh | 10 +- source/EngineGpuKernels/NeuronProcessor.cuh | 20 +- source/EngineGpuKernels/Object.cuh | 8 +- source/EngineGpuKernels/ObjectFactory.cuh | 24 +-- .../EngineGpuKernels/ReconnectorProcessor.cuh | 30 +-- source/EngineGpuKernels/RenderingKernels.cu | 2 +- source/EngineGpuKernels/SensorProcessor.cuh | 88 ++++---- source/EngineGpuKernels/SimulationKernels.cu | 2 +- source/EngineGpuKernels/TOs.cuh | 6 +- .../EngineGpuKernels/TransmitterProcessor.cuh | 6 +- source/EngineImpl/DescriptionConverter.cpp | 16 +- .../EngineInterface/CellFunctionConstants.h | 8 +- source/EngineInterface/Descriptions.h | 24 +-- .../EngineInterface/SimulationParameters.cpp | 10 +- source/EngineInterface/SimulationParameters.h | 12 +- source/EngineTests/AttackerTests.cpp | 32 +-- source/EngineTests/ConstructorTests.cpp | 22 +- source/EngineTests/DataTransferTests.cpp | 2 +- source/EngineTests/DefenderTests.cpp | 16 +- source/EngineTests/DetonatorTests.cpp | 8 +- source/EngineTests/InjectorTests.cpp | 20 +- source/EngineTests/MuscleTests.cpp | 48 ++--- source/EngineTests/NerveTests.cpp | 192 ++++++++--------- source/EngineTests/NeuronTests.cpp | 18 +- source/EngineTests/ReconnectorTests.cpp | 70 +++---- source/EngineTests/SensorTests.cpp | 198 +++++++++--------- source/EngineTests/TransmitterTests.cpp | 12 +- source/Gui/GettingStartedWindow.cpp | 46 ++-- source/Gui/HelpStrings.h | 37 ++-- source/Gui/InspectorWindow.cpp | 8 +- .../AuxiliaryDataParserService.cpp | 20 +- .../PersisterInterface/SerializerService.cpp | 18 +- 39 files changed, 602 insertions(+), 603 deletions(-) diff --git a/source/EngineGpuKernels/AttackerProcessor.cuh b/source/EngineGpuKernels/AttackerProcessor.cuh index 0cd34e1e8..d5851238e 100644 --- a/source/EngineGpuKernels/AttackerProcessor.cuh +++ b/source/EngineGpuKernels/AttackerProcessor.cuh @@ -42,10 +42,10 @@ __device__ __inline__ void AttackerProcessor::process(SimulationData& data, Simu __device__ __inline__ void AttackerProcessor::processCell(SimulationData& data, SimulationStatistics& statistics, Cell* cell) { - auto activity = CellFunctionProcessor::calcInputActivity(cell); - CellFunctionProcessor::updateInvocationState(cell, activity); + auto signal = CellFunctionProcessor::calcInputSignal(cell); + CellFunctionProcessor::updateInvocationState(cell, signal); - if (abs(activity.channels[0]) >= cudaSimulationParameters.cellFunctionAttackerActivityThreshold) { + if (abs(signal.channels[0]) >= cudaSimulationParameters.cellFunctionAttackerSignalThreshold) { float energyDelta = 0; auto cellMinEnergy = SpotCalculator::calcParameter( &SimulationParametersSpotValues::cellMinEnergy, &SimulationParametersSpotActivatedValues::cellMinEnergy, data, cell->pos, cell->color); @@ -161,7 +161,7 @@ __device__ __inline__ void AttackerProcessor::processCell(SimulationData& data, if (energyToTransfer > NEAR_ZERO) { //notify attacked cell - atomicAdd(&otherCell->activity.channels[7], 1.0f); + atomicAdd(&otherCell->signal.channels[7], 1.0f); otherCell->event = CellEvent_Attacked; otherCell->eventCounter = 6; otherCell->eventPos = cell->pos; @@ -194,7 +194,7 @@ __device__ __inline__ void AttackerProcessor::processCell(SimulationData& data, radiate(data, cell); //output - activity.channels[0] = energyDelta / 10; + signal.channels[0] = energyDelta / 10; if (energyDelta > NEAR_ZERO) { cell->event = CellEvent_Attacking; @@ -203,7 +203,7 @@ __device__ __inline__ void AttackerProcessor::processCell(SimulationData& data, } } - CellFunctionProcessor::setActivity(cell, activity); + CellFunctionProcessor::setSignal(cell, signal); } __device__ __inline__ void AttackerProcessor::radiate(SimulationData& data, Cell* cell) diff --git a/source/EngineGpuKernels/CellFunctionProcessor.cuh b/source/EngineGpuKernels/CellFunctionProcessor.cuh index c37a8cd4e..85735fdec 100644 --- a/source/EngineGpuKernels/CellFunctionProcessor.cuh +++ b/source/EngineGpuKernels/CellFunctionProcessor.cuh @@ -11,11 +11,11 @@ class CellFunctionProcessor public: __inline__ __device__ static void collectCellFunctionOperations(SimulationData& data); __inline__ __device__ static void updateRenderingData(SimulationData& data); - __inline__ __device__ static void resetFetchedActivities(SimulationData& data); + __inline__ __device__ static void resetFetchedSignals(SimulationData& data); - __inline__ __device__ static Activity calcInputActivity(Cell* cell); - __inline__ __device__ static void setActivity(Cell* cell, Activity const& newActivity); - __inline__ __device__ static void updateInvocationState(Cell* cell, Activity const& activity); + __inline__ __device__ static Signal calcInputSignal(Cell* cell); + __inline__ __device__ static void setSignal(Cell* cell, Signal const& newSignal); + __inline__ __device__ static void updateInvocationState(Cell* cell, Signal const& signal); struct ReferenceAndActualAngle { @@ -66,7 +66,7 @@ __inline__ __device__ void CellFunctionProcessor::updateRenderingData(Simulation } } -__inline__ __device__ void CellFunctionProcessor::resetFetchedActivities(SimulationData& data) +__inline__ __device__ void CellFunctionProcessor::resetFetchedSignals(SimulationData& data) { auto& cells = data.objects.cellPointers; auto partition = calcAllThreadsPartition(cells.getNumEntries()); @@ -75,7 +75,7 @@ __inline__ __device__ void CellFunctionProcessor::resetFetchedActivities(Simulat auto& cell = cells.at(index); if (cell->cellFunction == CellFunction_None) { for (int i = 0; i < MAX_CHANNELS; ++i) { - cell->activity.channels[i] = 0; + cell->signal.channels[i] = 0; } continue; } @@ -104,16 +104,16 @@ __inline__ __device__ void CellFunctionProcessor::resetFetchedActivities(Simulat && executionOrderNumber == (cell->executionOrderNumber + 1) % cudaSimulationParameters.cellNumExecutionOrderNumbers) || (maxOtherExecutionOrderNumber != -1 && maxOtherExecutionOrderNumber == executionOrderNumber)) { for (int i = 0; i < MAX_CHANNELS; ++i) { - cell->activity.channels[i] = 0; + cell->signal.channels[i] = 0; } } } } -__inline__ __device__ Activity CellFunctionProcessor::calcInputActivity(Cell* cell) +__inline__ __device__ Signal CellFunctionProcessor::calcInputSignal(Cell* cell) { - Activity result; - result.origin = ActivityOrigin_Unknown; + Signal result; + result.origin = SignalOrigin_Unknown; result.targetX = 0; result.targetY = 0; @@ -125,7 +125,7 @@ __inline__ __device__ Activity CellFunctionProcessor::calcInputActivity(Cell* ce return result; } - int numSensorActivities = 0; + int numSensorSignals = 0; for (int i = 0, j = cell->numConnections; i < j; ++i) { auto connectedCell = cell->connections[i].cell; if (connectedCell->outputBlocked || connectedCell->livingState != LivingState_Ready ) { @@ -133,39 +133,39 @@ __inline__ __device__ Activity CellFunctionProcessor::calcInputActivity(Cell* ce } if (connectedCell->executionOrderNumber == cell->inputExecutionOrderNumber) { for (int i = 0; i < MAX_CHANNELS; ++i) { - result.channels[i] += connectedCell->activity.channels[i]; + result.channels[i] += connectedCell->signal.channels[i]; result.channels[i] = max(-10.0f, min(10.0f, result.channels[i])); //truncate value to avoid overflow } - if (connectedCell->activity.origin == ActivityOrigin_Sensor) { - result.origin = ActivityOrigin_Sensor; - result.targetX += connectedCell->activity.targetX; - result.targetY += connectedCell->activity.targetY; - ++numSensorActivities; + if (connectedCell->signal.origin == SignalOrigin_Sensor) { + result.origin = SignalOrigin_Sensor; + result.targetX += connectedCell->signal.targetX; + result.targetY += connectedCell->signal.targetY; + ++numSensorSignals; } } } - if (numSensorActivities > 0) { - result.targetX /= numSensorActivities; - result.targetY /= numSensorActivities; + if (numSensorSignals > 0) { + result.targetX /= numSensorSignals; + result.targetY /= numSensorSignals; } return result; } -__inline__ __device__ void CellFunctionProcessor::setActivity(Cell* cell, Activity const& newActivity) +__inline__ __device__ void CellFunctionProcessor::setSignal(Cell* cell, Signal const& newSignal) { for (int i = 0; i < MAX_CHANNELS; ++i) { - cell->activity.channels[i] = newActivity.channels[i]; + cell->signal.channels[i] = newSignal.channels[i]; } - cell->activity.origin = newActivity.origin; - cell->activity.targetX = newActivity.targetX; - cell->activity.targetY = newActivity.targetY; + cell->signal.origin = newSignal.origin; + cell->signal.targetX = newSignal.targetX; + cell->signal.targetY = newSignal.targetY; } -__inline__ __device__ void CellFunctionProcessor::updateInvocationState(Cell* cell, Activity const& activity) +__inline__ __device__ void CellFunctionProcessor::updateInvocationState(Cell* cell, Signal const& signal) { if (cell->cellFunctionUsed == CellFunctionUsed_No) { for (int i = 0; i < MAX_CHANNELS - 1; ++i) { - if (activity.channels[i] != 0) { + if (signal.channels[i] != 0) { cell->cellFunctionUsed = CellFunctionUsed_Yes; break; } diff --git a/source/EngineGpuKernels/ConstructorProcessor.cuh b/source/EngineGpuKernels/ConstructorProcessor.cuh index 034c2ae1d..3bd502667 100644 --- a/source/EngineGpuKernels/ConstructorProcessor.cuh +++ b/source/EngineGpuKernels/ConstructorProcessor.cuh @@ -47,7 +47,7 @@ private: __inline__ __device__ static void processCell(SimulationData& data, SimulationStatistics& statistics, Cell* cell); __inline__ __device__ static ConstructionData readConstructionData(Cell* cell); - __inline__ __device__ static bool isConstructionTriggered(SimulationData const& data, Cell* cell, Activity const& activity); + __inline__ __device__ static bool isConstructionTriggered(SimulationData const& data, Cell* cell, Signal const& signal); __inline__ __device__ static Cell* tryConstructCell(SimulationData& data, SimulationStatistics& statistics, Cell* hostCell, ConstructionData const& constructionData); @@ -102,8 +102,8 @@ __inline__ __device__ void ConstructorProcessor::completenessCheck(SimulationDat if (!GenomeDecoder::isFirstNode(constructor)) { return; } - auto activity = CellFunctionProcessor::calcInputActivity(cell); - if (!isConstructionTriggered(data, cell, activity)) { + auto signal = CellFunctionProcessor::calcInputSignal(cell); + if (!isConstructionTriggered(data, cell, signal)) { return; } @@ -149,12 +149,12 @@ __inline__ __device__ void ConstructorProcessor::completenessCheck(SimulationDat __inline__ __device__ void ConstructorProcessor::processCell(SimulationData& data, SimulationStatistics& statistics, Cell* cell) { auto& constructor = cell->cellFunctionData.constructor; - auto activity = CellFunctionProcessor::calcInputActivity(cell); - CellFunctionProcessor::updateInvocationState(cell, activity); + auto signal = CellFunctionProcessor::calcInputSignal(cell); + CellFunctionProcessor::updateInvocationState(cell, signal); if (!GenomeDecoder::isFinished(constructor)) { auto constructionData = readConstructionData(cell); auto cellBuilt = false; - if (isConstructionTriggered(data, cell, activity)) { + if (isConstructionTriggered(data, cell, signal)) { if (tryConstructCell(data, statistics, cell, constructionData)) { cellBuilt = true; cell->cellFunctionUsed = CellFunctionUsed_Yes; @@ -162,7 +162,7 @@ __inline__ __device__ void ConstructorProcessor::processCell(SimulationData& dat } if (cellBuilt) { - activity.channels[0] = 1; + signal.channels[0] = 1; if (GenomeDecoder::isLastNode(constructor)) { constructor.genomeCurrentNodeIndex = 0; if (!constructionData.genomeHeader.hasInfiniteRepetitions()) { @@ -178,10 +178,10 @@ __inline__ __device__ void ConstructorProcessor::processCell(SimulationData& dat ++constructor.genomeCurrentNodeIndex; } } else { - activity.channels[0] = 0; + signal.channels[0] = 0; } } - CellFunctionProcessor::setActivity(cell, activity); + CellFunctionProcessor::setSignal(cell, signal); } __inline__ __device__ ConstructorProcessor::ConstructionData ConstructorProcessor::readConstructionData(Cell* cell) @@ -269,10 +269,10 @@ __inline__ __device__ ConstructorProcessor::ConstructionData ConstructorProcesso } __inline__ __device__ bool -ConstructorProcessor::isConstructionTriggered(SimulationData const& data, Cell* cell, Activity const& activity) +ConstructorProcessor::isConstructionTriggered(SimulationData const& data, Cell* cell, Signal const& signal) { if (cell->cellFunctionData.constructor.activationMode == 0 - && abs(activity.channels[0]) < cudaSimulationParameters.cellFunctionConstructorActivityThreshold[cell->color]) { + && abs(signal.channels[0]) < cudaSimulationParameters.cellFunctionConstructorSignalThreshold[cell->color]) { return false; } if (cell->cellFunctionData.constructor.activationMode > 0 diff --git a/source/EngineGpuKernels/DataAccessKernels.cu b/source/EngineGpuKernels/DataAccessKernels.cu index c6d2073cc..4cc40b096 100644 --- a/source/EngineGpuKernels/DataAccessKernels.cu +++ b/source/EngineGpuKernels/DataAccessKernels.cu @@ -40,11 +40,11 @@ namespace cellTO.color = cell->color; cellTO.age = cell->age; for (int i = 0; i < MAX_CHANNELS; ++i) { - cellTO.activity.channels[i] = cell->activity.channels[i]; + cellTO.signal.channels[i] = cell->signal.channels[i]; } - cellTO.activity.origin = cell->activity.origin; - cellTO.activity.targetX = cell->activity.targetX; - cellTO.activity.targetY = cell->activity.targetY; + cellTO.signal.origin = cell->signal.origin; + cellTO.signal.targetX = cell->signal.targetX; + cellTO.signal.targetY = cell->signal.targetY; cellTO.activationTime = cell->activationTime; cellTO.detectedByCreatureId = cell->detectedByCreatureId; cellTO.cellFunctionUsed = cell->cellFunctionUsed; diff --git a/source/EngineGpuKernels/DetonatorProcessor.cuh b/source/EngineGpuKernels/DetonatorProcessor.cuh index fe8ea440b..0e879ef41 100644 --- a/source/EngineGpuKernels/DetonatorProcessor.cuh +++ b/source/EngineGpuKernels/DetonatorProcessor.cuh @@ -34,11 +34,11 @@ __device__ __inline__ void DetonatorProcessor::process(SimulationData& data, Sim __device__ __inline__ void DetonatorProcessor::processCell(SimulationData& data, SimulationStatistics& statistics, Cell* cell) { - auto activity = CellFunctionProcessor::calcInputActivity(cell); - CellFunctionProcessor::updateInvocationState(cell, activity); + auto signal = CellFunctionProcessor::calcInputSignal(cell); + CellFunctionProcessor::updateInvocationState(cell, signal); auto& detonator = cell->cellFunctionData.detonator; - if (activity.channels[0] >= abs(cudaSimulationParameters.cellFunctionDetonatorActivityThreshold) && detonator.state == DetonatorState_Ready) { + if (signal.channels[0] >= abs(cudaSimulationParameters.cellFunctionDetonatorSignalThreshold) && detonator.state == DetonatorState_Ready) { detonator.state = DetonatorState_Activated; } if (detonator.state == DetonatorState_Activated) { @@ -72,5 +72,5 @@ __device__ __inline__ void DetonatorProcessor::processCell(SimulationData& data, detonator.state = DetonatorState_Exploded; } } - CellFunctionProcessor::setActivity(cell, activity); + CellFunctionProcessor::setSignal(cell, signal); } diff --git a/source/EngineGpuKernels/InjectorProcessor.cuh b/source/EngineGpuKernels/InjectorProcessor.cuh index a9cf9bf78..432a2f9aa 100644 --- a/source/EngineGpuKernels/InjectorProcessor.cuh +++ b/source/EngineGpuKernels/InjectorProcessor.cuh @@ -28,10 +28,10 @@ __device__ __inline__ void InjectorProcessor::process(SimulationData& data, Simu __inline__ __device__ void InjectorProcessor::processCell(SimulationData& data, SimulationStatistics& statistics, Cell* cell) { - auto activity = CellFunctionProcessor::calcInputActivity(cell); - CellFunctionProcessor::updateInvocationState(cell, activity); + auto signal = CellFunctionProcessor::calcInputSignal(cell); + CellFunctionProcessor::updateInvocationState(cell, signal); - if (abs(activity.channels[0]) >= cudaSimulationParameters.cellFunctionInjectorActivityThreshold) { + if (abs(signal.channels[0]) >= cudaSimulationParameters.cellFunctionInjectorSignalThreshold) { auto& injector = cell->cellFunctionData.injector; @@ -133,13 +133,13 @@ __inline__ __device__ void InjectorProcessor::processCell(SimulationData& data, } else { ++injector.counter; } - activity.channels[0] = 1; + signal.channels[0] = 1; } else { injector.counter = 0; - activity.channels[0] = 0; + signal.channels[0] = 0; } } - CellFunctionProcessor::setActivity(cell, activity); + CellFunctionProcessor::setSignal(cell, signal); } __inline__ __device__ int InjectorProcessor::countAndTrackDefenderCells(SimulationStatistics& statistics, Cell* cell) diff --git a/source/EngineGpuKernels/MuscleProcessor.cuh b/source/EngineGpuKernels/MuscleProcessor.cuh index e0ba2d77d..df1076bc7 100644 --- a/source/EngineGpuKernels/MuscleProcessor.cuh +++ b/source/EngineGpuKernels/MuscleProcessor.cuh @@ -15,13 +15,13 @@ public: private: __inline__ __device__ static void processCell(SimulationData& data, SimulationStatistics& statistics, Cell* cell); - __inline__ __device__ static void movement(SimulationData& data, SimulationStatistics& statistics, Cell* cell, Activity& activity); - __inline__ __device__ static void contractionExpansion(SimulationData& data, SimulationStatistics& statistics, Cell* cell, Activity const& activity); - __inline__ __device__ static void bending(SimulationData& data, SimulationStatistics& statistics, Cell* cell, Activity const& activity); + __inline__ __device__ static void movement(SimulationData& data, SimulationStatistics& statistics, Cell* cell, Signal& signal); + __inline__ __device__ static void contractionExpansion(SimulationData& data, SimulationStatistics& statistics, Cell* cell, Signal const& signal); + __inline__ __device__ static void bending(SimulationData& data, SimulationStatistics& statistics, Cell* cell, Signal const& signal); __inline__ __device__ static int getConnectionIndex(Cell* cell, Cell* otherCell); __inline__ __device__ static bool hasTriangularConnection(Cell* cell, Cell* otherCell); - __inline__ __device__ static float getTruncatedUnitValue(Activity const& activity, int channel = 0); + __inline__ __device__ static float getTruncatedUnitValue(Signal const& signal, int channel = 0); }; /************************************************************************/ @@ -38,25 +38,25 @@ __device__ __inline__ void MuscleProcessor::process(SimulationData& data, Simula __device__ __inline__ void MuscleProcessor::processCell(SimulationData& data, SimulationStatistics& statistics, Cell* cell) { - auto activity = CellFunctionProcessor::calcInputActivity(cell); - CellFunctionProcessor::updateInvocationState(cell, activity); + auto signal = CellFunctionProcessor::calcInputSignal(cell); + CellFunctionProcessor::updateInvocationState(cell, signal); cell->cellFunctionData.muscle.lastMovementX = 0; cell->cellFunctionData.muscle.lastMovementY = 0; switch (cell->cellFunctionData.muscle.mode) { case MuscleMode_Movement: { - movement(data, statistics, cell, activity); + movement(data, statistics, cell, signal); } break; case MuscleMode_ContractionExpansion: { - contractionExpansion(data, statistics, cell, activity); + contractionExpansion(data, statistics, cell, signal); } break; case MuscleMode_Bending: { - bending(data, statistics, cell, activity); + bending(data, statistics, cell, signal); } break; } - CellFunctionProcessor::setActivity(cell, activity); + CellFunctionProcessor::setSignal(cell, signal); } @@ -83,9 +83,9 @@ namespace } } -__device__ __inline__ void MuscleProcessor::movement(SimulationData& data, SimulationStatistics& statistics, Cell* cell, Activity& activity) +__device__ __inline__ void MuscleProcessor::movement(SimulationData& data, SimulationStatistics& statistics, Cell* cell, Signal& signal) { - if (abs(activity.channels[0]) < NEAR_ZERO) { + if (abs(signal.channels[0]) < NEAR_ZERO) { return; } if (!cell->tryLock()) { @@ -104,8 +104,8 @@ __device__ __inline__ void MuscleProcessor::movement(SimulationData& data, Simul } } } else { - if (activity.origin == ActivityOrigin_Sensor && (activity.targetX != 0 || activity.targetY != 0)) { - direction = {activity.targetX, activity.targetY}; + if (signal.origin == SignalOrigin_Sensor && (signal.targetX != 0 || signal.targetY != 0)) { + direction = {signal.targetX, signal.targetY}; acceleration = cudaSimulationParameters.cellFunctionMuscleMovementAcceleration[cell->color]; } } @@ -113,8 +113,8 @@ __device__ __inline__ void MuscleProcessor::movement(SimulationData& data, Simul direction = CellFunctionProcessor::calcSignalDirection(data, cell); acceleration = cudaSimulationParameters.cellFunctionMuscleMovementAcceleration[cell->color]; } - float angle = max(-0.5f, min(0.5f, activity.channels[3])) * 360.0f; - direction = Math::normalized(Math::rotateClockwise(direction, angle)) * acceleration * getTruncatedUnitValue(activity); + float angle = max(-0.5f, min(0.5f, signal.channels[3])) * 360.0f; + direction = Math::normalized(Math::rotateClockwise(direction, angle)) * acceleration * getTruncatedUnitValue(signal); cell->vel += direction; cell->cellFunctionData.muscle.lastMovementX = direction.x; cell->cellFunctionData.muscle.lastMovementY = direction.y; @@ -122,9 +122,9 @@ __device__ __inline__ void MuscleProcessor::movement(SimulationData& data, Simul statistics.incNumMuscleActivities(cell->color); } -__device__ __inline__ void MuscleProcessor::contractionExpansion(SimulationData& data, SimulationStatistics& statistics, Cell* cell, Activity const& activity) +__device__ __inline__ void MuscleProcessor::contractionExpansion(SimulationData& data, SimulationStatistics& statistics, Cell* cell, Signal const& signal) { - if (abs(activity.channels[0]) < NEAR_ZERO) { + if (abs(signal.channels[0]) < NEAR_ZERO) { return; } if (!cell->tryLock()) { @@ -139,11 +139,11 @@ __device__ __inline__ void MuscleProcessor::contractionExpansion(SimulationData& continue; } auto newDistance = - connection.distance + cudaSimulationParameters.cellFunctionMuscleContractionExpansionDelta[cell->color] * getTruncatedUnitValue(activity); - if (activity.channels[0] > 0 && newDistance >= maxDistance) { + connection.distance + cudaSimulationParameters.cellFunctionMuscleContractionExpansionDelta[cell->color] * getTruncatedUnitValue(signal); + if (signal.channels[0] > 0 && newDistance >= maxDistance) { continue; } - if (activity.channels[0] < 0 && newDistance <= minDistance) { + if (signal.channels[0] < 0 && newDistance <= minDistance) { continue; } connection.distance = newDistance; @@ -157,9 +157,9 @@ __device__ __inline__ void MuscleProcessor::contractionExpansion(SimulationData& statistics.incNumMuscleActivities(cell->color); } -__inline__ __device__ void MuscleProcessor::bending(SimulationData& data, SimulationStatistics& statistics, Cell* cell, Activity const& activity) +__inline__ __device__ void MuscleProcessor::bending(SimulationData& data, SimulationStatistics& statistics, Cell* cell, Signal const& signal) { - if (abs(activity.channels[0]) < NEAR_ZERO) { + if (abs(signal.channels[0]) < NEAR_ZERO) { return; } if (cell->numConnections < 2) { @@ -171,7 +171,7 @@ __inline__ __device__ void MuscleProcessor::bending(SimulationData& data, Simula for (int i = 0; i < cell->numConnections; ++i) { auto& connection = cell->connections[i]; if (connection.cell->executionOrderNumber == cell->inputExecutionOrderNumber) { - auto intensityChannel0 = getTruncatedUnitValue(activity); + auto intensityChannel0 = getTruncatedUnitValue(signal); auto bendingAngle = cudaSimulationParameters.cellFunctionMuscleBendingAngle[cell->color] * intensityChannel0; if (bendingAngle < 0 && connection.angleFromPrevious <= -bendingAngle) { @@ -201,11 +201,11 @@ __inline__ __device__ void MuscleProcessor::bending(SimulationData& data, Simula cell->cellFunctionData.muscle.lastBendingDirection = bendingDirection; cell->cellFunctionData.muscle.lastBendingSourceIndex = i; - if (abs(activity.channels[1]) > cudaSimulationParameters.cellFunctionMuscleBendingAccelerationThreshold + if (abs(signal.channels[1]) > cudaSimulationParameters.cellFunctionMuscleBendingAccelerationThreshold && !hasTriangularConnection(cell, connection.cell)) { auto delta = Math::normalized(data.cellMap.getCorrectedDirection(connection.cell->pos - cell->pos)); Math::rotateQuarterCounterClockwise(delta); - auto intensityChannel1 = getTruncatedUnitValue(activity, 1); + auto intensityChannel1 = getTruncatedUnitValue(signal, 1); if ((intensityChannel0 < -NEAR_ZERO && intensityChannel1 < -NEAR_ZERO) || (intensityChannel0 > NEAR_ZERO && intensityChannel1 > NEAR_ZERO)) { auto acceleration = delta * intensityChannel0 * cudaSimulationParameters.cellFunctionMuscleBendingAcceleration[cell->color] * sqrtf(cell->cellFunctionData.muscle.consecutiveBendingAngle + 1.0f) / 20 /*abs(bendingAngle) / 10*/; @@ -246,7 +246,7 @@ __inline__ __device__ bool MuscleProcessor::hasTriangularConnection(Cell* cell, return false; } -__inline__ __device__ float MuscleProcessor::getTruncatedUnitValue(Activity const& activity, int channel) +__inline__ __device__ float MuscleProcessor::getTruncatedUnitValue(Signal const& signal, int channel) { - return max(-0.3f, min(0.3f, activity.channels[channel])) / 0.3f; + return max(-0.3f, min(0.3f, signal.channels[channel])) / 0.3f; } diff --git a/source/EngineGpuKernels/NerveProcessor.cuh b/source/EngineGpuKernels/NerveProcessor.cuh index 4c12a469e..80a83a915 100644 --- a/source/EngineGpuKernels/NerveProcessor.cuh +++ b/source/EngineGpuKernels/NerveProcessor.cuh @@ -27,8 +27,8 @@ __inline__ __device__ void NerveProcessor::process(SimulationData& data, Simulat auto const& operation = operations.at(i); auto const& cell = operation.cell; - auto activity = CellFunctionProcessor::calcInputActivity(cell); - CellFunctionProcessor::updateInvocationState(cell, activity); + auto signal = CellFunctionProcessor::calcInputSignal(cell); + CellFunctionProcessor::updateInvocationState(cell, signal); auto const& nerve = cell->cellFunctionData.nerve; auto counter = (cell->age / cudaSimulationParameters.cellNumExecutionOrderNumbers) * cudaSimulationParameters.cellNumExecutionOrderNumbers @@ -36,14 +36,14 @@ __inline__ __device__ void NerveProcessor::process(SimulationData& data, Simulat if (nerve.pulseMode > 0 && (counter % (cudaSimulationParameters.cellNumExecutionOrderNumbers * nerve.pulseMode) == cell->executionOrderNumber)) { statistics.incNumNervePulses(cell->color); if (nerve.alternationMode == 0) { - activity.channels[0] += 1.0f; + signal.channels[0] += 1.0f; } else { auto evenPulse = counter % (cudaSimulationParameters.cellNumExecutionOrderNumbers * nerve.pulseMode * nerve.alternationMode * 2) < cell->executionOrderNumber + cudaSimulationParameters.cellNumExecutionOrderNumbers * nerve.pulseMode * nerve.alternationMode; - activity.channels[0] += evenPulse ? 1.0f : -1.0f; + signal.channels[0] += evenPulse ? 1.0f : -1.0f; } } - CellFunctionProcessor::setActivity(cell, activity); + CellFunctionProcessor::setSignal(cell, signal); } } diff --git a/source/EngineGpuKernels/NeuronProcessor.cuh b/source/EngineGpuKernels/NeuronProcessor.cuh index e02e86316..dd74e8154 100644 --- a/source/EngineGpuKernels/NeuronProcessor.cuh +++ b/source/EngineGpuKernels/NeuronProcessor.cuh @@ -31,11 +31,11 @@ __device__ __inline__ void NeuronProcessor::process(SimulationData& data, Simula __inline__ __device__ void NeuronProcessor::processCell(SimulationData& data, SimulationStatistics& statistics, Cell* cell) { - __shared__ Activity outputActivity; - __shared__ Activity inputActivity; + __shared__ Signal outputSignal; + __shared__ Signal inputSignal; if (0 == threadIdx.x) { - inputActivity = CellFunctionProcessor::calcInputActivity(cell); - CellFunctionProcessor::updateInvocationState(cell, inputActivity); + inputSignal = CellFunctionProcessor::calcInputSignal(cell); + CellFunctionProcessor::updateInvocationState(cell, inputSignal); } __syncthreads(); @@ -52,21 +52,21 @@ __inline__ __device__ void NeuronProcessor::processCell(SimulationData& data, Si auto row = entry / MAX_CHANNELS; auto col = entry % MAX_CHANNELS; - atomicAdd(&sumInput[row], neuronsState->weights[entry] * inputActivity.channels[col]); + atomicAdd(&sumInput[row], neuronsState->weights[entry] * inputSignal.channels[col]); } __syncthreads(); for (int i = channelPartition.startIndex; i <= channelPartition.endIndex; ++i) { - outputActivity.channels[i] = applyActivationFunction(cell->cellFunctionData.neuron.activationFunctions[i], sumInput[i]); + outputSignal.channels[i] = applyActivationFunction(cell->cellFunctionData.neuron.activationFunctions[i], sumInput[i]); } __syncthreads(); if (0 == threadIdx.x) { - outputActivity.origin = inputActivity.origin; - outputActivity.targetX = inputActivity.targetX; - outputActivity.targetY = inputActivity.targetY; - CellFunctionProcessor::setActivity(cell, outputActivity); + outputSignal.origin = inputSignal.origin; + outputSignal.targetX = inputSignal.targetX; + outputSignal.targetY = inputSignal.targetY; + CellFunctionProcessor::setSignal(cell, outputSignal); statistics.incNumNeuronActivities(cell->color); } __syncthreads(); diff --git a/source/EngineGpuKernels/Object.cuh b/source/EngineGpuKernels/Object.cuh index b1418004b..50e10f0e6 100644 --- a/source/EngineGpuKernels/Object.cuh +++ b/source/EngineGpuKernels/Object.cuh @@ -69,10 +69,10 @@ struct CellConnection float angleFromPrevious; }; -struct Activity +struct Signal { float channels[MAX_CHANNELS]; - ActivityOrigin origin; + SignalOrigin origin; float targetX; float targetY; }; @@ -229,7 +229,7 @@ struct Cell bool outputBlocked; CellFunction cellFunction; CellFunctionData cellFunctionData; - Activity activity; + Signal signal; uint32_t activationTime; CellFunctionUsed cellFunctionUsed; @@ -269,7 +269,7 @@ struct Cell __device__ __inline__ bool isActive() { for (int i = 0; i < MAX_CHANNELS; ++i) { - if (abs(activity.channels[i]) > NEAR_ZERO) { + if (abs(signal.channels[i]) > NEAR_ZERO) { return true; } } diff --git a/source/EngineGpuKernels/ObjectFactory.cuh b/source/EngineGpuKernels/ObjectFactory.cuh index a8980fdca..d79709e31 100644 --- a/source/EngineGpuKernels/ObjectFactory.cuh +++ b/source/EngineGpuKernels/ObjectFactory.cuh @@ -120,11 +120,11 @@ __inline__ __device__ void ObjectFactory::changeCellFromTO(DataTO const& dataTO, cell->metadata.description); for (int i = 0; i < MAX_CHANNELS; ++i) { - cell->activity.channels[i] = cellTO.activity.channels[i]; + cell->signal.channels[i] = cellTO.signal.channels[i]; } - cell->activity.origin = cellTO.activity.origin; - cell->activity.targetX = cellTO.activity.targetX; - cell->activity.targetY = cellTO.activity.targetY; + cell->signal.origin = cellTO.signal.origin; + cell->signal.targetX = cellTO.signal.targetX; + cell->signal.targetY = cellTO.signal.targetY; cell->cellFunction = cellTO.cellFunction; switch (cellTO.cellFunction) { @@ -286,11 +286,11 @@ __inline__ __device__ Cell* ObjectFactory::createRandomCell(float energy, float2 cell->inputExecutionOrderNumber = _data->numberGen1.random(cudaSimulationParameters.cellNumExecutionOrderNumbers - 1); cell->outputBlocked = _data->numberGen1.randomBool(); for (int i = 0; i < MAX_CHANNELS; ++i) { - cell->activity.channels[i] = 0; + cell->signal.channels[i] = 0; } - cell->activity.origin = ActivityOrigin_Unknown; - cell->activity.targetX = 0; - cell->activity.targetY = 0; + cell->signal.origin = SignalOrigin_Unknown; + cell->signal.targetX = 0; + cell->signal.targetY = 0; cell->density = 1.0f; cell->creatureId = 0; cell->mutationId = 1; @@ -416,11 +416,11 @@ __inline__ __device__ Cell* ObjectFactory::createCell(uint64_t& cellPointerIndex cell->vel = {0, 0}; cell->activationTime = 0; for (int i = 0; i < MAX_CHANNELS; ++i) { - cell->activity.channels[i] = 0; + cell->signal.channels[i] = 0; } - cell->activity.origin = ActivityOrigin_Unknown; - cell->activity.targetX = 0; - cell->activity.targetY = 0; + cell->signal.origin = SignalOrigin_Unknown; + cell->signal.targetX = 0; + cell->signal.targetY = 0; cell->density = 1.0f; cell->detectedByCreatureId = 0; cell->event = CellEvent_No; diff --git a/source/EngineGpuKernels/ReconnectorProcessor.cuh b/source/EngineGpuKernels/ReconnectorProcessor.cuh index d8505fb44..08e2ac916 100644 --- a/source/EngineGpuKernels/ReconnectorProcessor.cuh +++ b/source/EngineGpuKernels/ReconnectorProcessor.cuh @@ -18,8 +18,8 @@ public: private: __inline__ __device__ static void processCell(SimulationData& data, SimulationStatistics& statistics, Cell* cell); - __inline__ __device__ static void tryCreateConnection(SimulationData& data, SimulationStatistics& statistics, Cell* cell, Activity& activity); - __inline__ __device__ static void removeConnections(SimulationData& data, SimulationStatistics& statistics, Cell* cell, Activity& activity); + __inline__ __device__ static void tryCreateConnection(SimulationData& data, SimulationStatistics& statistics, Cell* cell, Signal& signal); + __inline__ __device__ static void removeConnections(SimulationData& data, SimulationStatistics& statistics, Cell* cell, Signal& signal); }; /************************************************************************/ @@ -37,18 +37,18 @@ __device__ __inline__ void ReconnectorProcessor::process(SimulationData& data, S __device__ __inline__ void ReconnectorProcessor::processCell(SimulationData& data, SimulationStatistics& statistics, Cell* cell) { - auto activity = CellFunctionProcessor::calcInputActivity(cell); - CellFunctionProcessor::updateInvocationState(cell, activity); + auto signal = CellFunctionProcessor::calcInputSignal(cell); + CellFunctionProcessor::updateInvocationState(cell, signal); - if (activity.channels[0] >= cudaSimulationParameters.cellFunctionReconnectorActivityThreshold) { - tryCreateConnection(data, statistics, cell, activity); - } else if (activity.channels[0] <= -cudaSimulationParameters.cellFunctionReconnectorActivityThreshold) { - removeConnections(data, statistics, cell, activity); + if (signal.channels[0] >= cudaSimulationParameters.cellFunctionReconnectorSignalThreshold) { + tryCreateConnection(data, statistics, cell, signal); + } else if (signal.channels[0] <= -cudaSimulationParameters.cellFunctionReconnectorSignalThreshold) { + removeConnections(data, statistics, cell, signal); } - CellFunctionProcessor::setActivity(cell, activity); + CellFunctionProcessor::setSignal(cell, signal); } -__inline__ __device__ void ReconnectorProcessor::tryCreateConnection(SimulationData& data, SimulationStatistics& statistics, Cell* cell, Activity& activity) +__inline__ __device__ void ReconnectorProcessor::tryCreateConnection(SimulationData& data, SimulationStatistics& statistics, Cell* cell, Signal& signal) { auto const& reconnector = cell->cellFunctionData.reconnector; Cell* closestCell = nullptr; @@ -94,7 +94,7 @@ __inline__ __device__ void ReconnectorProcessor::tryCreateConnection(SimulationD } }); - activity.channels[0] = 0; + signal.channels[0] = 0; if (closestCell) { SystemDoubleLock lock; lock.init(&cell->locked, &closestCell->locked); @@ -103,7 +103,7 @@ __inline__ __device__ void ReconnectorProcessor::tryCreateConnection(SimulationD closestCell->maxConnections = min(max(closestCell->maxConnections, closestCell->numConnections + 1), MAX_CELL_BONDS); cell->maxConnections = min(max(cell->maxConnections, cell->numConnections + 1), MAX_CELL_BONDS); CellConnectionProcessor::scheduleAddConnectionPair(data, cell, closestCell); - activity.channels[0] = 1; + signal.channels[0] = 1; statistics.incNumReconnectorCreated(cell->color); } lock.releaseLock(); @@ -111,15 +111,15 @@ __inline__ __device__ void ReconnectorProcessor::tryCreateConnection(SimulationD } } -__inline__ __device__ void ReconnectorProcessor::removeConnections(SimulationData& data, SimulationStatistics& statistics, Cell* cell, Activity& activity) +__inline__ __device__ void ReconnectorProcessor::removeConnections(SimulationData& data, SimulationStatistics& statistics, Cell* cell, Signal& signal) { - activity.channels[0] = 0; + signal.channels[0] = 0; if (cell->tryLock()) { for (int i = 0; i < cell->numConnections; ++i) { auto connectedCell = cell->connections[i].cell; if (connectedCell->creatureId != cell->creatureId) { CellConnectionProcessor::scheduleDeleteConnectionPair(data, cell, connectedCell); - activity.channels[0] = 1; + signal.channels[0] = 1; statistics.incNumReconnectorRemoved(cell->color); } } diff --git a/source/EngineGpuKernels/RenderingKernels.cu b/source/EngineGpuKernels/RenderingKernels.cu index 105ddc2a0..5d1a96efe 100644 --- a/source/EngineGpuKernels/RenderingKernels.cu +++ b/source/EngineGpuKernels/RenderingKernels.cu @@ -489,7 +489,7 @@ __global__ void cudaDrawCells( coloring == CellColoring_MutationId_AllCellFunctions ? calcColor(cell, cell->selected, coloring, false) * 0.5f : primaryColor * 0.6f; drawCircle(imageData, imageSize, cellImagePos, secondaryColor, cellRadius, shadedCells, true); - //draw activity + //draw signal if (cell->isActive() && zoom >= cudaSimulationParameters.zoomLevelNeuronalActivity) { drawCircle(imageData, imageSize, cellImagePos, float3{0.3f, 0.3f, 0.3f}, cellRadius, shadedCells); } diff --git a/source/EngineGpuKernels/SensorProcessor.cuh b/source/EngineGpuKernels/SensorProcessor.cuh index a64b50e3b..9667778ae 100644 --- a/source/EngineGpuKernels/SensorProcessor.cuh +++ b/source/EngineGpuKernels/SensorProcessor.cuh @@ -22,8 +22,8 @@ private: SensorRestrictToMutants const& restrictToMutants, DensityMap const& densityMap, float2 const& scanPos); - __inline__ __device__ static void searchNeighborhood(SimulationData& data, SimulationStatistics& statistics, Cell* cell, Activity& activity); - __inline__ __device__ static void searchByAngle(SimulationData& data, SimulationStatistics& statistics, Cell* cell, Activity& activity); + __inline__ __device__ static void searchNeighborhood(SimulationData& data, SimulationStatistics& statistics, Cell* cell, Signal& signal); + __inline__ __device__ static void searchByAngle(SimulationData& data, SimulationStatistics& statistics, Cell* cell, Signal& signal); __inline__ __device__ static void flagDetectedCells(SimulationData& data, Cell* cell, float2 const& scanPos); @@ -49,29 +49,29 @@ __inline__ __device__ void SensorProcessor::process(SimulationData& data, Simula __inline__ __device__ void SensorProcessor::processCell(SimulationData& data, SimulationStatistics& statistics, Cell* cell) { - __shared__ Activity activity; + __shared__ Signal signal; if (threadIdx.x == 0) { - activity = CellFunctionProcessor::calcInputActivity(cell); - CellFunctionProcessor::updateInvocationState(cell, activity); + signal = CellFunctionProcessor::calcInputSignal(cell); + CellFunctionProcessor::updateInvocationState(cell, signal); } __syncthreads(); - if (abs(activity.channels[0]) > cudaSimulationParameters.cellFunctionSensorActivityThreshold) { + if (abs(signal.channels[0]) > cudaSimulationParameters.cellFunctionSensorSignalThreshold) { statistics.incNumSensorActivities(cell->color); switch (cell->cellFunctionData.sensor.mode) { case SensorMode_Neighborhood: { - searchNeighborhood(data, statistics, cell, activity); - activity.origin = ActivityOrigin_Sensor; + searchNeighborhood(data, statistics, cell, signal); + signal.origin = SignalOrigin_Sensor; } break; //case SensorMode_FixedAngle: { - // searchByAngle(data, statistics, cell, activity); + // searchByAngle(data, statistics, cell, signal); //} break; } } __syncthreads(); if (threadIdx.x == 0) { - CellFunctionProcessor::setActivity(cell, activity); + CellFunctionProcessor::setSignal(cell, signal); } } @@ -118,7 +118,7 @@ __inline__ __device__ uint32_t SensorProcessor::getCellDensity( } __inline__ __device__ void -SensorProcessor::searchNeighborhood(SimulationData& data, SimulationStatistics& statistics, Cell* cell, Activity& activity) +SensorProcessor::searchNeighborhood(SimulationData& data, SimulationStatistics& statistics, Cell* cell, Signal& signal) { __shared__ uint32_t minDensity; __shared__ uint8_t restrictToColor; @@ -192,37 +192,37 @@ SensorProcessor::searchNeighborhood(SimulationData& data, SimulationStatistics& auto scanPos = cell->pos + Math::unitVectorOfAngle(scanAngle) * distance; flagDetectedCells(data, cell, scanPos); - activity.channels[0] = 1; //something found - activity.channels[1] = toFloat((lookupResult >> 40) & 0xff) / 256; //density - activity.channels[2] = 1.0f - min(1.0f, distance / 256); //distance: 1 = close, 0 = far away + signal.channels[0] = 1; //something found + signal.channels[1] = toFloat((lookupResult >> 40) & 0xff) / 256; //density + signal.channels[2] = 1.0f - min(1.0f, distance / 256); //distance: 1 = close, 0 = far away auto legacyMode_unrestrictedMovements = !cudaSimulationParameters.cellFunctionMuscleMovementTowardTargetedObject; - activity.channels[3] = legacyMode_unrestrictedMovements ? angle / 360.0f : 0; //angle: between -0.5 and 0.5 - cell->cellFunctionData.sensor.memoryChannel1 = activity.channels[1]; - cell->cellFunctionData.sensor.memoryChannel2 = activity.channels[2]; - cell->cellFunctionData.sensor.memoryChannel3 = activity.channels[3]; + signal.channels[3] = legacyMode_unrestrictedMovements ? angle / 360.0f : 0; //angle: between -0.5 and 0.5 + cell->cellFunctionData.sensor.memoryChannel1 = signal.channels[1]; + cell->cellFunctionData.sensor.memoryChannel2 = signal.channels[2]; + cell->cellFunctionData.sensor.memoryChannel3 = signal.channels[3]; statistics.incNumSensorMatches(cell->color); auto delta = data.cellMap.getCorrectedDirection(scanPos - cell->pos); - activity.targetX = delta.x; - activity.targetY = delta.y; + signal.targetX = delta.x; + signal.targetY = delta.y; cell->cellFunctionData.sensor.memoryTargetX = delta.x; cell->cellFunctionData.sensor.memoryTargetY = delta.y; } else { - activity.channels[0] = 0; //nothing found - //activity.channels[1] = cell->cellFunctionData.sensor.memoryChannel1; - //activity.channels[2] = cell->cellFunctionData.sensor.memoryChannel2; - //activity.channels[3] = cell->cellFunctionData.sensor.memoryChannel3; - //activity.targetX = cell->cellFunctionData.sensor.memoryTargetX; - //activity.targetY = cell->cellFunctionData.sensor.memoryTargetY; - activity.targetX = 0; - activity.targetY = 0; + signal.channels[0] = 0; //nothing found + //signal.channels[1] = cell->cellFunctionData.sensor.memoryChannel1; + //signal.channels[2] = cell->cellFunctionData.sensor.memoryChannel2; + //signal.channels[3] = cell->cellFunctionData.sensor.memoryChannel3; + //signal.targetX = cell->cellFunctionData.sensor.memoryTargetX; + //signal.targetY = cell->cellFunctionData.sensor.memoryTargetY; + signal.targetX = 0; + signal.targetY = 0; } } __syncthreads(); } __inline__ __device__ void -SensorProcessor::searchByAngle(SimulationData& data, SimulationStatistics& statistics, Cell* cell, Activity& activity) +SensorProcessor::searchByAngle(SimulationData& data, SimulationStatistics& statistics, Cell* cell, Signal& signal) { __shared__ uint32_t minDensity; __shared__ uint8_t restrictToColor; @@ -268,32 +268,32 @@ SensorProcessor::searchByAngle(SimulationData& data, SimulationStatistics& stati auto scanPos = cell->pos + searchDelta * distance; flagDetectedCells(data, cell, scanPos); - activity.channels[0] = 1; //something found - activity.channels[1] = static_cast((lookupResult >> 40) & 0xff) / 256; //density - activity.channels[2] = distance / 256; //distance + signal.channels[0] = 1; //something found + signal.channels[1] = static_cast((lookupResult >> 40) & 0xff) / 256; //density + signal.channels[2] = distance / 256; //distance auto legacyMode_unrestrictedMovements = !cudaSimulationParameters.cellFunctionMuscleMovementTowardTargetedObject; if (!legacyMode_unrestrictedMovements) { - activity.channels[3] = 0; + signal.channels[3] = 0; } - cell->cellFunctionData.sensor.memoryChannel1 = activity.channels[1]; - cell->cellFunctionData.sensor.memoryChannel2 = activity.channels[2]; - cell->cellFunctionData.sensor.memoryChannel3 = activity.channels[3]; + cell->cellFunctionData.sensor.memoryChannel1 = signal.channels[1]; + cell->cellFunctionData.sensor.memoryChannel2 = signal.channels[2]; + cell->cellFunctionData.sensor.memoryChannel3 = signal.channels[3]; statistics.incNumSensorMatches(cell->color); auto delta = data.cellMap.getCorrectedDirection(scanPos - cell->pos); - activity.targetX = delta.x; - activity.targetY = delta.y; + signal.targetX = delta.x; + signal.targetY = delta.y; cell->cellFunctionData.sensor.memoryTargetX = delta.x; cell->cellFunctionData.sensor.memoryTargetY = delta.y; } else { - activity.channels[0] = 0; //nothing found - activity.channels[1] = cell->cellFunctionData.sensor.memoryChannel1; - activity.channels[2] = cell->cellFunctionData.sensor.memoryChannel2; - activity.channels[3] = cell->cellFunctionData.sensor.memoryChannel3; - activity.targetX = cell->cellFunctionData.sensor.memoryTargetX; - activity.targetY = cell->cellFunctionData.sensor.memoryTargetY; + signal.channels[0] = 0; //nothing found + signal.channels[1] = cell->cellFunctionData.sensor.memoryChannel1; + signal.channels[2] = cell->cellFunctionData.sensor.memoryChannel2; + signal.channels[3] = cell->cellFunctionData.sensor.memoryChannel3; + signal.targetX = cell->cellFunctionData.sensor.memoryTargetX; + signal.targetY = cell->cellFunctionData.sensor.memoryTargetY; } } } diff --git a/source/EngineGpuKernels/SimulationKernels.cu b/source/EngineGpuKernels/SimulationKernels.cu index 4e050b35e..2a8f19b7f 100644 --- a/source/EngineGpuKernels/SimulationKernels.cu +++ b/source/EngineGpuKernels/SimulationKernels.cu @@ -151,7 +151,7 @@ __global__ void cudaNextTimestep_physics_applyInnerFriction(SimulationData data) __global__ void cudaNextTimestep_physics_applyFriction(SimulationData data) { - CellFunctionProcessor::resetFetchedActivities(data); + CellFunctionProcessor::resetFetchedSignals(data); CellProcessor::applyFriction(data); CellProcessor::decay(data); } diff --git a/source/EngineGpuKernels/TOs.cuh b/source/EngineGpuKernels/TOs.cuh index 14890ea48..ea7db63e4 100644 --- a/source/EngineGpuKernels/TOs.cuh +++ b/source/EngineGpuKernels/TOs.cuh @@ -34,10 +34,10 @@ struct ConnectionTO float angleFromPrevious; }; -struct ActivityTO +struct SignalTO { float channels[MAX_CHANNELS]; - ActivityOrigin origin; + SignalOrigin origin; float targetX; float targetY; }; @@ -184,7 +184,7 @@ struct CellTO bool outputBlocked; CellFunction cellFunction; CellFunctionTO cellFunctionData; - ActivityTO activity; + SignalTO signal; uint32_t activationTime; uint16_t detectedByCreatureId; //only the first 16 bits from the creature id CellFunctionUsed cellFunctionUsed; diff --git a/source/EngineGpuKernels/TransmitterProcessor.cuh b/source/EngineGpuKernels/TransmitterProcessor.cuh index 472d0458e..ce3126175 100644 --- a/source/EngineGpuKernels/TransmitterProcessor.cuh +++ b/source/EngineGpuKernels/TransmitterProcessor.cuh @@ -34,12 +34,12 @@ __device__ __inline__ void TransmitterProcessor::process(SimulationData& data, S __device__ __inline__ void TransmitterProcessor::processCell(SimulationData& data, SimulationStatistics& statistics, Cell* cell) { - auto activity = CellFunctionProcessor::calcInputActivity(cell); - CellFunctionProcessor::updateInvocationState(cell, activity); + auto signal = CellFunctionProcessor::calcInputSignal(cell); + CellFunctionProcessor::updateInvocationState(cell, signal); distributeEnergy(data, statistics, cell); - CellFunctionProcessor::setActivity(cell, activity); + CellFunctionProcessor::setSignal(cell, signal); } __device__ __inline__ void TransmitterProcessor::distributeEnergy(SimulationData& data, SimulationStatistics& statistics, Cell* cell) diff --git a/source/EngineImpl/DescriptionConverter.cpp b/source/EngineImpl/DescriptionConverter.cpp index 95c7ba660..89183ba4b 100644 --- a/source/EngineImpl/DescriptionConverter.cpp +++ b/source/EngineImpl/DescriptionConverter.cpp @@ -513,11 +513,11 @@ CellDescription DescriptionConverter::createCellDescription(DataTO const& dataTO } for (int i = 0; i < MAX_CHANNELS; ++i) { - result.activity.channels[i] = cellTO.activity.channels[i]; + result.signal.channels[i] = cellTO.signal.channels[i]; } - result.activity.origin = cellTO.activity.origin; - result.activity.targetX = cellTO.activity.targetX; - result.activity.targetY = cellTO.activity.targetY; + result.signal.origin = cellTO.signal.origin; + result.signal.targetX = cellTO.signal.targetX; + result.signal.targetY = cellTO.signal.targetY; result.activationTime = cellTO.activationTime; return result; } @@ -678,11 +678,11 @@ void DescriptionConverter::addCell( } break; } for (int i = 0; i < MAX_CHANNELS; ++i) { - cellTO.activity.channels[i] = cellDesc.activity.channels[i]; + cellTO.signal.channels[i] = cellDesc.signal.channels[i]; } - cellTO.activity.origin = cellDesc.activity.origin; - cellTO.activity.targetX = cellDesc.activity.targetX; - cellTO.activity.targetY = cellDesc.activity.targetY; + cellTO.signal.origin = cellDesc.signal.origin; + cellTO.signal.targetX = cellDesc.signal.targetX; + cellTO.signal.targetY = cellDesc.signal.targetY; cellTO.activationTime = cellDesc.activationTime; cellTO.numConnections = 0; cellTO.barrier = cellDesc.barrier; diff --git a/source/EngineInterface/CellFunctionConstants.h b/source/EngineInterface/CellFunctionConstants.h index d2269b91d..8faf81e5f 100644 --- a/source/EngineInterface/CellFunctionConstants.h +++ b/source/EngineInterface/CellFunctionConstants.h @@ -171,11 +171,11 @@ enum CellFunctionUsed_ CellFunctionUsed_Yes, }; -using ActivityOrigin = uint8_t; -enum ActivityOrigin_ +using SignalOrigin = uint8_t; +enum SignalOrigin_ { - ActivityOrigin_Unknown, - ActivityOrigin_Sensor + SignalOrigin_Unknown, + SignalOrigin_Sensor }; auto constexpr MaxActivationTime = 256 * 4; \ No newline at end of file diff --git a/source/EngineInterface/Descriptions.h b/source/EngineInterface/Descriptions.h index 629aea8b6..328d354a7 100644 --- a/source/EngineInterface/Descriptions.h +++ b/source/EngineInterface/Descriptions.h @@ -51,17 +51,17 @@ struct ConnectionDescription } }; -struct ActivityDescription +struct SignalDescription { std::vector channels; - ActivityOrigin origin = ActivityOrigin_Unknown; + SignalOrigin origin = SignalOrigin_Unknown; float targetX = 0; float targetY = 0; - ActivityDescription() { channels.resize(MAX_CHANNELS, 0); } - auto operator<=>(ActivityDescription const&) const = default; + SignalDescription() { channels.resize(MAX_CHANNELS, 0); } + auto operator<=>(SignalDescription const&) const = default; - ActivityDescription& setChannels(std::vector const& value) + SignalDescription& setChannels(std::vector const& value) { CHECK(value.size() == MAX_CHANNELS); channels = value; @@ -392,7 +392,7 @@ struct CellDescription std::optional inputExecutionOrderNumber; bool outputBlocked = false; CellFunctionDescription cellFunction; - ActivityDescription activity; + SignalDescription signal; int activationTime = 0; int detectedByCreatureId = 0; //only the first 16 bits from the creature id CellFunctionUsed cellFunctionUsed = CellFunctionUsed_No; @@ -490,18 +490,18 @@ struct CellDescription metadata = value; return *this; } - CellDescription& setActivity(ActivityDescription const& value) + CellDescription& setSignal(SignalDescription const& value) { - activity = value; + signal = value; return *this; } - CellDescription& setActivity(std::vector const& value) + CellDescription& setSignal(std::vector const& value) { CHECK(value.size() == MAX_CHANNELS); - ActivityDescription newActivity; - newActivity.channels = value; - activity = newActivity; + SignalDescription newSignal; + newSignal.channels = value; + signal = newSignal; return *this; } CellDescription& setActivationTime(int value) diff --git a/source/EngineInterface/SimulationParameters.cpp b/source/EngineInterface/SimulationParameters.cpp index 297311a4f..0993ccf16 100644 --- a/source/EngineInterface/SimulationParameters.cpp +++ b/source/EngineInterface/SimulationParameters.cpp @@ -104,7 +104,7 @@ bool SimulationParameters::operator==(SimulationParameters const& other) const if (cellFunctionAttackerColorInhomogeneityFactor[i] != other.cellFunctionAttackerColorInhomogeneityFactor[i]) { return false; } - if (cellFunctionConstructorActivityThreshold[i] != other.cellFunctionConstructorActivityThreshold[i]) { + if (cellFunctionConstructorSignalThreshold[i] != other.cellFunctionConstructorSignalThreshold[i]) { return false; } if (cellFunctionConstructorConnectingCellMaxDistance[i] != other.cellFunctionConstructorConnectingCellMaxDistance[i]) { @@ -182,21 +182,21 @@ bool SimulationParameters::operator==(SimulationParameters const& other) const && cellMaxVelocity == other.cellMaxVelocity && cellMinDistance == other.cellMinDistance && cellMaxForceDecayProb == other.cellMaxForceDecayProb && cellNumExecutionOrderNumbers == other.cellNumExecutionOrderNumbers && radiationProb == other.radiationProb && radiationVelocityMultiplier == other.radiationVelocityMultiplier && radiationVelocityPerturbation == other.radiationVelocityPerturbation - && cellFunctionAttackerActivityThreshold == other.cellFunctionAttackerActivityThreshold + && cellFunctionAttackerSignalThreshold == other.cellFunctionAttackerSignalThreshold && particleTransformationMaxGenomeSize == other.particleTransformationMaxGenomeSize && cellFunctionTransmitterEnergyDistributionSameCreature == other.cellFunctionTransmitterEnergyDistributionSameCreature && particleTransformationAllowed == other.particleTransformationAllowed && particleTransformationRandomCellFunction == other.particleTransformationRandomCellFunction && particleTransformationMaxGenomeSize == other.particleTransformationMaxGenomeSize && cellDeathConsequences == other.cellDeathConsequences - && cellFunctionSensorActivityThreshold == other.cellFunctionSensorActivityThreshold + && cellFunctionSensorSignalThreshold == other.cellFunctionSensorSignalThreshold && cellFunctionMuscleBendingAccelerationThreshold == other.cellFunctionMuscleBendingAccelerationThreshold && cellFunctionConstructorMutationSelfReplication == other.cellFunctionConstructorMutationSelfReplication && cellMaxAgeBalancer == other.cellMaxAgeBalancer && cellMaxAgeBalancerInterval == other.cellMaxAgeBalancerInterval && cellFunctionConstructorMutationPreventDepthIncrease == other.cellFunctionConstructorMutationPreventDepthIncrease && cellFunctionConstructorCheckCompletenessForSelfReplication == other.cellFunctionConstructorCheckCompletenessForSelfReplication && cellFunctionAttackerDestroyCells == other.cellFunctionAttackerDestroyCells - && cellFunctionReconnectorActivityThreshold == other.cellFunctionReconnectorActivityThreshold - && cellFunctionDetonatorActivityThreshold == other.cellFunctionDetonatorActivityThreshold && features == other.features + && cellFunctionReconnectorSignalThreshold == other.cellFunctionReconnectorSignalThreshold + && cellFunctionDetonatorSignalThreshold == other.cellFunctionDetonatorSignalThreshold && features == other.features && highlightedCellFunction == other.highlightedCellFunction && borderlessRendering == other.borderlessRendering && markReferenceDomain == other.markReferenceDomain && gridLines == other.gridLines && externalEnergy == other.externalEnergy && attackVisualization == other.attackVisualization && cellInactiveMaxAgeActivated == other.cellInactiveMaxAgeActivated diff --git a/source/EngineInterface/SimulationParameters.h b/source/EngineInterface/SimulationParameters.h index 3c7b2eb64..b1de444d2 100644 --- a/source/EngineInterface/SimulationParameters.h +++ b/source/EngineInterface/SimulationParameters.h @@ -140,7 +140,7 @@ struct SimulationParameters Infinity::value}; ColorVector cellFunctionConstructorConnectingCellMaxDistance = {1.8f, 1.8f, 1.8f, 1.8f, 1.8f, 1.8f, 1.8f}; - ColorVector cellFunctionConstructorActivityThreshold = {0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f}; + ColorVector cellFunctionConstructorSignalThreshold = {0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f}; bool cellFunctionConstructorCheckCompletenessForSelfReplication = false; ColorMatrix cellFunctionConstructorMutationColorTransitions = { @@ -164,7 +164,7 @@ struct SimulationParameters {3, 3, 3, 3, 3, 3, 3}, {3, 3, 3, 3, 3, 3, 3} }; - float cellFunctionInjectorActivityThreshold = 0.1f; + float cellFunctionInjectorSignalThreshold = 0.1f; ColorVector cellFunctionAttackerRadius = {1.6f, 1.6f, 1.6f, 1.6f, 1.6f, 1.6f, 1.6f}; ColorVector cellFunctionAttackerStrength = {0.05f, 0.05f, 0.05f, 0.05f, 0.05f, 0.05f, 0.05f}; @@ -181,7 +181,7 @@ struct SimulationParameters {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f} }; ColorVector cellFunctionAttackerSensorDetectionFactor = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}; - float cellFunctionAttackerActivityThreshold = 0.1f; + float cellFunctionAttackerSignalThreshold = 0.1f; bool cellFunctionAttackerDestroyCells = false; ColorVector cellFunctionDefenderAgainstAttackerStrength = {1.5f, 1.5f, 1.5f, 1.5f, 1.5f, 1.5f, 1.5f}; @@ -199,14 +199,14 @@ struct SimulationParameters bool cellFunctionMuscleMovementTowardTargetedObject = true; ColorVector cellFunctionSensorRange = {255.0f, 255.0f, 255.0f, 255.0f, 255.0f, 255.0f, 255.0f}; - float cellFunctionSensorActivityThreshold = 0.1f; + float cellFunctionSensorSignalThreshold = 0.1f; ColorVector cellFunctionReconnectorRadius = {2.0f, 2.0f, 2.0f, 2.0f, 2.0f, 2.0f, 2.0f}; - float cellFunctionReconnectorActivityThreshold = 0.1f; + float cellFunctionReconnectorSignalThreshold = 0.1f; ColorVector cellFunctionDetonatorRadius = {10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f}; ColorVector cellFunctionDetonatorChainExplosionProbability = {1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f}; - float cellFunctionDetonatorActivityThreshold = 0.1f; + float cellFunctionDetonatorSignalThreshold = 0.1f; bool legacyCellFunctionMuscleMovementAngleFromSensor = false; diff --git a/source/EngineTests/AttackerTests.cpp b/source/EngineTests/AttackerTests.cpp index 8e9d790dd..f93ae4467 100644 --- a/source/EngineTests/AttackerTests.cpp +++ b/source/EngineTests/AttackerTests.cpp @@ -45,7 +45,7 @@ TEST_F(AttackerTests, nothingFound) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); _simulationFacade->setSimulationData(data); @@ -56,7 +56,7 @@ TEST_F(AttackerTests, nothingFound) EXPECT_EQ(2, actualData.cells.size()); EXPECT_TRUE(approxCompare(getEnergy(data), getEnergy(actualData))); - EXPECT_TRUE(approxCompare(0.0f, actualAttackCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(0.0f, actualAttackCell.signal.channels[0])); } TEST_F(AttackerTests, successNoTransmitter) @@ -76,7 +76,7 @@ TEST_F(AttackerTests, successNoTransmitter) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription() .setId(3) .setPos({9.0f, 10.0f}), @@ -94,7 +94,7 @@ TEST_F(AttackerTests, successNoTransmitter) auto origTargetCell = getCell(data, 3); auto actualTargetCell = getCell(actualData, 3); - EXPECT_TRUE(actualAttackCell.activity.channels[0] > NEAR_ZERO); + EXPECT_TRUE(actualAttackCell.signal.channels[0] > NEAR_ZERO); EXPECT_TRUE(actualAttackCell.energy > origAttackCell.energy + NEAR_ZERO); EXPECT_TRUE(actualTargetCell.energy < origTargetCell.energy - NEAR_ZERO); EXPECT_TRUE(approxCompare(getEnergy(data), getEnergy(actualData))); @@ -117,7 +117,7 @@ TEST_F(AttackerTests, successDistributeToOneTransmitter) .setMaxConnections(2) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription().setId(3).setPos({12.0f, 10.0f}).setMaxConnections(1).setExecutionOrderNumber(1).setCellFunction(TransmitterDescription()), CellDescription().setId(4).setPos({9.0f, 10.0f}), }); @@ -136,7 +136,7 @@ TEST_F(AttackerTests, successDistributeToOneTransmitter) auto origTransmitterCell = getCell(data, 3); auto actualTransmitterCell = getCell(actualData, 3); - EXPECT_TRUE(actualAttackCell.activity.channels[0] > NEAR_ZERO); + EXPECT_TRUE(actualAttackCell.signal.channels[0] > NEAR_ZERO); EXPECT_TRUE(approxCompare(origNerveCell.energy, actualNerveCell.energy)); EXPECT_TRUE(actualTransmitterCell.energy > origTransmitterCell.energy + NEAR_ZERO); EXPECT_TRUE(approxCompare(getEnergy(data), getEnergy(actualData))); @@ -159,7 +159,7 @@ TEST_F(AttackerTests, successDistributeToTwoTransmitters) .setMaxConnections(2) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription().setId(3).setPos({12.0f, 10.0f}).setMaxConnections(1).setExecutionOrderNumber(1).setCellFunction(TransmitterDescription()), CellDescription().setId(4).setPos({11.0f, 9.0f}).setMaxConnections(1).setExecutionOrderNumber(1).setCellFunction(TransmitterDescription()), CellDescription().setId(5).setPos({9.0f, 10.0f}), @@ -178,7 +178,7 @@ TEST_F(AttackerTests, successDistributeToTwoTransmitters) auto origTransmitterCell2 = getCell(data, 4); auto actualTransmitterCell2 = getCell(actualData, 4); - EXPECT_TRUE(actualAttackCell.activity.channels[0] > NEAR_ZERO); + EXPECT_TRUE(actualAttackCell.signal.channels[0] > NEAR_ZERO); EXPECT_TRUE(actualTransmitterCell1.energy > origTransmitterCell1.energy + NEAR_ZERO); EXPECT_TRUE(actualTransmitterCell2.energy > origTransmitterCell2.energy + NEAR_ZERO); EXPECT_TRUE(approxCompare(getEnergy(data), getEnergy(actualData))); @@ -201,7 +201,7 @@ TEST_F(AttackerTests, successDistributeToTwoTransmittersWithDifferentColor) .setMaxConnections(2) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription().setId(3).setPos({12.0f, 10.0f}).setMaxConnections(1).setExecutionOrderNumber(1).setCellFunction(TransmitterDescription()), CellDescription().setId(4).setPos({11.0f, 9.0f}).setMaxConnections(1).setExecutionOrderNumber(1).setCellFunction(TransmitterDescription()).setColor(1), CellDescription().setId(5).setPos({9.0f, 10.0f}), @@ -220,7 +220,7 @@ TEST_F(AttackerTests, successDistributeToTwoTransmittersWithDifferentColor) auto origTransmitterCell2 = getCell(data, 4); auto actualTransmitterCell2 = getCell(actualData, 4); - EXPECT_TRUE(actualAttackCell.activity.channels[0] > NEAR_ZERO); + EXPECT_TRUE(actualAttackCell.signal.channels[0] > NEAR_ZERO); EXPECT_TRUE(actualTransmitterCell1.energy > origTransmitterCell1.energy + NEAR_ZERO); EXPECT_TRUE(actualTransmitterCell2.energy > origTransmitterCell2.energy + NEAR_ZERO); EXPECT_TRUE(approxCompare(getEnergy(data), getEnergy(actualData))); @@ -246,7 +246,7 @@ TEST_F(AttackerTests, successDistributeToTransmitterAndConstructor) .setMaxConnections(2) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription().setId(3).setPos({12.0f, 10.0f}).setMaxConnections(1).setExecutionOrderNumber(1).setCellFunction(TransmitterDescription()), CellDescription() .setId(4) @@ -270,7 +270,7 @@ TEST_F(AttackerTests, successDistributeToTransmitterAndConstructor) auto origConstructorCell = getCell(data, 4); auto actualConstructorCell = getCell(actualData, 4); - EXPECT_TRUE(actualAttackCell.activity.channels[0] > NEAR_ZERO); + EXPECT_TRUE(actualAttackCell.signal.channels[0] > NEAR_ZERO); EXPECT_TRUE(approxCompare(actualTransmitterCell.energy, origTransmitterCell.energy)); EXPECT_TRUE(actualConstructorCell.energy > origConstructorCell.energy + NEAR_ZERO); EXPECT_TRUE(approxCompare(getEnergy(data), getEnergy(actualData))); @@ -293,7 +293,7 @@ TEST_F(AttackerTests, successDistributeToConnectedCells) .setMaxConnections(2) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription().setId(3).setPos({12.0f, 10.0f}).setMaxConnections(1).setExecutionOrderNumber(1).setCellFunction(NerveDescription()), CellDescription().setId(4).setPos({9.0f, 10.0f}), }); @@ -312,7 +312,7 @@ TEST_F(AttackerTests, successDistributeToConnectedCells) auto origNerveCell2 = getCell(data, 3); auto actualNerveCell2 = getCell(actualData, 3); - EXPECT_TRUE(actualAttackCell.activity.channels[0] > NEAR_ZERO); + EXPECT_TRUE(actualAttackCell.signal.channels[0] > NEAR_ZERO); EXPECT_TRUE(actualNerveCell1.energy > origNerveCell1.energy + NEAR_ZERO); EXPECT_TRUE(actualNerveCell2.energy > origNerveCell2.energy + NEAR_ZERO); EXPECT_TRUE(approxCompare(getEnergy(data), getEnergy(actualData))); @@ -335,7 +335,7 @@ TEST_F(AttackerTests, successTwoTargets) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription().setId(3).setPos({9.0f, 10.0f}), CellDescription().setId(4).setPos({9.0f, 11.0f}), }); @@ -355,7 +355,7 @@ TEST_F(AttackerTests, successTwoTargets) auto origTargetCell2 = getCell(data, 4); auto actualTargetCell2 = getCell(actualData, 4); - EXPECT_TRUE(actualAttackCell.activity.channels[0] > NEAR_ZERO); + EXPECT_TRUE(actualAttackCell.signal.channels[0] > NEAR_ZERO); EXPECT_TRUE(actualAttackCell.energy > origAttackCell.energy + NEAR_ZERO); EXPECT_TRUE(actualTargetCell1.energy < origTargetCell1.energy - NEAR_ZERO); EXPECT_TRUE(actualTargetCell2.energy < origTargetCell2.energy - NEAR_ZERO); diff --git a/source/EngineTests/ConstructorTests.cpp b/source/EngineTests/ConstructorTests.cpp index 928cc613d..cfc2b889c 100644 --- a/source/EngineTests/ConstructorTests.cpp +++ b/source/EngineTests/ConstructorTests.cpp @@ -70,7 +70,7 @@ TEST_F(ConstructorTests, noEnergy) EXPECT_EQ(0, actualHostCell.connections.size()); EXPECT_EQ(0, std::get(*actualHostCell.cellFunction).genomeCurrentNodeIndex); EXPECT_TRUE(approxCompare(_parameters.cellNormalEnergy[0] * 2 - 1.0f, actualHostCell.energy)); - EXPECT_TRUE(approxCompare(0.0f, actualHostCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(0.0f, actualHostCell.signal.channels[0])); } TEST_F(ConstructorTests, alreadyFinished) @@ -99,7 +99,7 @@ TEST_F(ConstructorTests, alreadyFinished) auto actualConstructor = std::get(*actualHostCell.cellFunction); EXPECT_EQ(0, actualHostCell.connections.size()); EXPECT_EQ(0, actualConstructor.genomeCurrentNodeIndex); - EXPECT_TRUE(approxCompare(0.0f, actualHostCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(0.0f, actualHostCell.signal.channels[0])); } TEST_F(ConstructorTests, notActivated) @@ -125,10 +125,10 @@ TEST_F(ConstructorTests, notActivated) ASSERT_EQ(1, actualData.cells.size()); auto actualHostCell = getCell(actualData, 1); auto actualConstructor = std::get(*actualHostCell.cellFunction); - EXPECT_TRUE(approxCompare(0.0f, actualHostCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(0.0f, actualHostCell.signal.channels[0])); } -TEST_F(ConstructorTests, manualConstruction_noInputActivity) +TEST_F(ConstructorTests, manualConstruction_noInputSignal) { auto genome = GenomeDescriptionService::get().convertDescriptionToBytes(GenomeDescription().setCells({CellGenomeDescription()})); @@ -152,7 +152,7 @@ TEST_F(ConstructorTests, manualConstruction_noInputActivity) EXPECT_EQ(0, actualHostCell.connections.size()); EXPECT_EQ(0, std::get(*actualHostCell.cellFunction).genomeCurrentNodeIndex); EXPECT_TRUE(approxCompare(_parameters.cellNormalEnergy[0] * 3, actualHostCell.energy)); - EXPECT_TRUE(approxCompare(0.0f, actualHostCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(0.0f, actualHostCell.signal.channels[0])); } TEST_F(ConstructorTests, constructFirstCell_correctCycle) @@ -618,7 +618,7 @@ TEST_F(ConstructorTests, constructFirstCell_noSeparation) EXPECT_EQ(0, actualConstructor.genomeCurrentRepetition); EXPECT_EQ(1, actualConstructor.currentBranch); EXPECT_TRUE(approxCompare(_parameters.cellNormalEnergy[0] * 2, actualHostCell.energy)); - EXPECT_TRUE(approxCompare(1.0f, actualHostCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(1.0f, actualHostCell.signal.channels[0])); EXPECT_EQ(LivingState_Activating, actualConstructedCell.livingState); EXPECT_EQ(1, actualConstructedCell.connections.size()); @@ -724,7 +724,7 @@ TEST_F(ConstructorTests, constructFirstCell_manualConstruction) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}) + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}) }); data.addConnection(1, 2); @@ -766,7 +766,7 @@ TEST_F(ConstructorTests, constructFirstCell_differentAngle1) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); _simulationFacade->setSimulationData(data); @@ -802,7 +802,7 @@ TEST_F(ConstructorTests, constructFirstCell_differentAngle2) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); _simulationFacade->setSimulationData(data); @@ -1379,7 +1379,7 @@ TEST_F(ConstructorTests, constructSecondCell_noSpace) auto actualPrevConstructedCell = getCell(actualData, 2); EXPECT_EQ(1, actualHostCell.connections.size()); - EXPECT_TRUE(approxCompare(0.0f, actualHostCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(0.0f, actualHostCell.signal.channels[0])); ASSERT_EQ(1, actualPrevConstructedCell.connections.size()); auto actualConstructor = std::get(*actualHostCell.cellFunction); EXPECT_EQ(1, actualConstructor.genomeCurrentNodeIndex); @@ -1886,7 +1886,7 @@ TEST_F(ConstructorTests, restartIfNoLastConstructedCellFound) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), }); data.addConnection(1, 2); diff --git a/source/EngineTests/DataTransferTests.cpp b/source/EngineTests/DataTransferTests.cpp index 045fa5543..96571f4a3 100644 --- a/source/EngineTests/DataTransferTests.cpp +++ b/source/EngineTests/DataTransferTests.cpp @@ -36,7 +36,7 @@ TEST_F(DataTransferTests, singleCell) .setConstructionId(3534) .setOutputBlocked(false) .setCellFunction(neuron) - .setActivity({1, 0, -1, 0, 0, 0, 0, 0})); + .setSignal({1, 0, -1, 0, 0, 0, 0, 0})); _simulationFacade->setSimulationData(data); auto actualData = _simulationFacade->getSimulationData(); diff --git a/source/EngineTests/DefenderTests.cpp b/source/EngineTests/DefenderTests.cpp index bb084e486..7d646972e 100644 --- a/source/EngineTests/DefenderTests.cpp +++ b/source/EngineTests/DefenderTests.cpp @@ -48,7 +48,7 @@ TEST_F(DefenderTests, attackerVsAntiAttacker) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription().setPulseMode(1)) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription() .setId(3) .setPos({9.0f, 10.0f}) @@ -75,7 +75,7 @@ TEST_F(DefenderTests, attackerVsAntiAttacker) auto actualTarget = getCell(actualData, 3); EXPECT_TRUE(approxCompare(getEnergy(data), getEnergy(actualData))); - EXPECT_TRUE(actualAttacker.activity.channels[0] > NEAR_ZERO); + EXPECT_TRUE(actualAttacker.signal.channels[0] > NEAR_ZERO); EXPECT_LT(origTarget.energy, actualTarget.energy + 0.1f); } @@ -96,7 +96,7 @@ TEST_F(DefenderTests, attackerVsAntiInjector) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription().setPulseMode(1)) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription().setId(3).setPos({9.0f, 10.0f}).setMaxConnections(2).setExecutionOrderNumber(0).setCellFunction(NerveDescription()), CellDescription() .setId(4) @@ -118,7 +118,7 @@ TEST_F(DefenderTests, attackerVsAntiInjector) auto actualTarget = getCell(actualData, 3); EXPECT_TRUE(approxCompare(getEnergy(data), getEnergy(actualData))); - EXPECT_TRUE(actualAttacker.activity.channels[0] > NEAR_ZERO); + EXPECT_TRUE(actualAttacker.signal.channels[0] > NEAR_ZERO); EXPECT_GT(origTarget.energy, actualTarget.energy + 0.1f); } @@ -141,7 +141,7 @@ TEST_F(DefenderTests, injectorVsAntiAttacker) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription().setPulseMode(1)) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription().setId(3).setPos({9.0f, 10.0f}).setMaxConnections(2).setExecutionOrderNumber(0).setCellFunction(ConstructorDescription()), CellDescription() .setId(4) @@ -169,7 +169,7 @@ TEST_F(DefenderTests, injectorVsAntiAttacker) auto origInjector = getCell(data, 1); auto origInjectorFunc = std::get(*origInjector.cellFunction); - EXPECT_TRUE(approxCompare(1.0f, actualInjector.activity.channels[0])); + EXPECT_TRUE(approxCompare(1.0f, actualInjector.signal.channels[0])); EXPECT_EQ(0, actualInjectorFunc.counter); EXPECT_EQ(origInjectorFunc.genome, actualTargetFunc.genome); } @@ -193,7 +193,7 @@ TEST_F(DefenderTests, injectorVsAntiInjector) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription().setPulseMode(1)) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription().setId(3).setPos({9.0f, 10.0f}).setMaxConnections(2).setExecutionOrderNumber(0).setCellFunction(ConstructorDescription()), CellDescription() .setId(4) @@ -224,7 +224,7 @@ TEST_F(DefenderTests, injectorVsAntiInjector) auto origInjector = getCell(data, 1); auto origInjectorFunc = std::get(*origInjector.cellFunction); - EXPECT_TRUE(approxCompare(1.0f, actualInjector.activity.channels[0])); + EXPECT_TRUE(approxCompare(1.0f, actualInjector.signal.channels[0])); EXPECT_EQ(4, actualInjectorFunc.counter); EXPECT_EQ(origTargetFunc.genome, actualTargetFunc.genome); } diff --git a/source/EngineTests/DetonatorTests.cpp b/source/EngineTests/DetonatorTests.cpp index 1b9528587..ea9206a1d 100644 --- a/source/EngineTests/DetonatorTests.cpp +++ b/source/EngineTests/DetonatorTests.cpp @@ -49,7 +49,7 @@ TEST_F(DetonatorTests, doNothing) EXPECT_EQ(1, actualData.cells.size()); EXPECT_TRUE(approxCompare(getEnergy(data), getEnergy(actualData))); - EXPECT_TRUE(approxCompare(0.0f, actualDetonatorCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(0.0f, actualDetonatorCell.signal.channels[0])); EXPECT_EQ(14, std::get(*actualDetonatorCell.cellFunction).countdown); EXPECT_EQ(DetonatorState_Ready, std::get(*actualDetonatorCell.cellFunction).state); } @@ -71,7 +71,7 @@ TEST_F(DetonatorTests, activateDetonator) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); _simulationFacade->setSimulationData(data); @@ -82,7 +82,7 @@ TEST_F(DetonatorTests, activateDetonator) EXPECT_EQ(2, actualData.cells.size()); EXPECT_TRUE(approxCompare(getEnergy(data), getEnergy(actualData))); - EXPECT_TRUE(approxCompare(1.0f, actualDetonatorCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(1.0f, actualDetonatorCell.signal.channels[0])); EXPECT_EQ(9, std::get(*actualDetonatorCell.cellFunction).countdown); EXPECT_EQ(DetonatorState_Activated, std::get(*actualDetonatorCell.cellFunction).state); } @@ -104,7 +104,7 @@ TEST_F(DetonatorTests, explosion) EXPECT_EQ(2, actualData.cells.size()); EXPECT_TRUE(approxCompare(getEnergy(data), getEnergy(actualData))); - EXPECT_TRUE(approxCompare(0.0f, actualDetonatorCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(0.0f, actualDetonatorCell.signal.channels[0])); EXPECT_EQ(0, std::get(*actualDetonatorCell.cellFunction).countdown); EXPECT_EQ(DetonatorState_Exploded, std::get(*actualDetonatorCell.cellFunction).state); EXPECT_TRUE(Math::length(actualOtherCell.vel) > NEAR_ZERO); diff --git a/source/EngineTests/InjectorTests.cpp b/source/EngineTests/InjectorTests.cpp index 6901b9906..ace2f6d2e 100644 --- a/source/EngineTests/InjectorTests.cpp +++ b/source/EngineTests/InjectorTests.cpp @@ -48,7 +48,7 @@ TEST_F(InjectorTests, nothingFound) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription().setPulseMode(1)) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); _simulationFacade->setSimulationData(data); @@ -61,7 +61,7 @@ TEST_F(InjectorTests, nothingFound) auto actualInjector = std::get(*actualCell.cellFunction); EXPECT_EQ(2, actualData.cells.size()); - EXPECT_TRUE(approxCompare(0.0f, actualCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(0.0f, actualCell.signal.channels[0])); EXPECT_EQ(0, actualInjector.counter); } @@ -84,7 +84,7 @@ TEST_F(InjectorTests, matchButNoInjection) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription().setPulseMode(1)) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription() .setId(3) .setPos({9.0f, 10.0f}) @@ -106,7 +106,7 @@ TEST_F(InjectorTests, matchButNoInjection) auto origTargetConstructor = std::get(*origTargetCell.cellFunction); EXPECT_EQ(3, actualData.cells.size()); - EXPECT_TRUE(approxCompare(1.0f, actualCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(1.0f, actualCell.signal.channels[0])); EXPECT_EQ(1, actualInjector.counter); EXPECT_EQ(origTargetConstructor.genome, actualTargetConstructor.genome); EXPECT_TRUE(actualTargetConstructor.isGenomeInherited()); @@ -131,7 +131,7 @@ TEST_F(InjectorTests, injection) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription().setPulseMode(1)) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription().setId(3).setPos({9.0f, 10.0f}).setMaxConnections(2).setExecutionOrderNumber(0).setCellFunction(ConstructorDescription().setNumInheritedGenomeNodes(1)), }); data.addConnection(1, 2); @@ -150,7 +150,7 @@ TEST_F(InjectorTests, injection) auto origInjector = std::get(*origCell.cellFunction); EXPECT_EQ(3, actualData.cells.size()); - EXPECT_TRUE(approxCompare(1.0f, actualCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(1.0f, actualCell.signal.channels[0])); EXPECT_EQ(0, actualInjector.counter); EXPECT_EQ(origInjector.genome, actualTargetConstructor.genome); EXPECT_FALSE(actualTargetConstructor.isGenomeInherited()); @@ -176,7 +176,7 @@ TEST_F(InjectorTests, injectOnlyEmptyCells_failed) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription().setPulseMode(1)) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription() .setId(3) .setPos({9.0f, 10.0f}) @@ -200,7 +200,7 @@ TEST_F(InjectorTests, injectOnlyEmptyCells_failed) auto origTargetConstructor = std::get(*origTargetCell.cellFunction); EXPECT_EQ(3, actualData.cells.size()); - EXPECT_TRUE(approxCompare(0.0f, actualCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(0.0f, actualCell.signal.channels[0])); EXPECT_EQ(0, actualInjector.counter); EXPECT_EQ(origTargetConstructor.genome, actualTargetConstructor.genome); EXPECT_TRUE(actualTargetConstructor.isGenomeInherited()); @@ -226,7 +226,7 @@ TEST_F(InjectorTests, injectOnlyEmptyCells_success) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription().setPulseMode(1)) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription() .setId(3) .setPos({9.0f, 10.0f}) @@ -260,7 +260,7 @@ TEST_F(InjectorTests, injectOnlyEmptyCells_success) EXPECT_EQ(4, actualData.cells.size()); - EXPECT_TRUE(approxCompare(1.0f, actualCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(1.0f, actualCell.signal.channels[0])); EXPECT_EQ(0, actualInjector.counter); EXPECT_EQ(actualInjector.genome, actualTargetConstructor.genome); EXPECT_EQ(origOtherConstructor.genome, actualOtherConstructor.genome); diff --git a/source/EngineTests/MuscleTests.cpp b/source/EngineTests/MuscleTests.cpp index 6ba21a60d..4a2f47256 100644 --- a/source/EngineTests/MuscleTests.cpp +++ b/source/EngineTests/MuscleTests.cpp @@ -45,7 +45,7 @@ TEST_F(MuscleTests, doNothing) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({0, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({0, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); _simulationFacade->setSimulationData(data); @@ -57,7 +57,7 @@ TEST_F(MuscleTests, doNothing) EXPECT_EQ(2, actualData.cells.size()); EXPECT_TRUE(approxCompare(getEnergy(data), getEnergy(actualData))); - EXPECT_TRUE(approxCompare(0, actualMuscleCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(0, actualMuscleCell.signal.channels[0])); EXPECT_TRUE(approxCompare(actualNerveCell.connections.at(0).distance, actualMuscleCell.connections.at(0).distance)); EXPECT_TRUE(approxCompare(1.0f , actualMuscleCell.connections.at(0).distance)); EXPECT_TRUE(approxCompare(0, actualMuscleCell.vel.x)); @@ -84,7 +84,7 @@ TEST_F(MuscleTests, moveForward) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); _simulationFacade->setSimulationData(data); @@ -96,7 +96,7 @@ TEST_F(MuscleTests, moveForward) EXPECT_EQ(2, actualData.cells.size()); EXPECT_TRUE(approxCompare(getEnergy(data), getEnergy(actualData))); - EXPECT_TRUE(approxCompare(1.0f, actualMuscleCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(1.0f, actualMuscleCell.signal.channels[0])); EXPECT_TRUE(approxCompare(actualNerveCell.connections.at(0).distance, actualMuscleCell.connections.at(0).distance)); EXPECT_TRUE(approxCompare(1.0f, actualMuscleCell.connections.at(0).distance)); EXPECT_TRUE(approxCompare(-_parameters.cellFunctionMuscleMovementAcceleration[0], actualMuscleCell.vel.x)); @@ -123,7 +123,7 @@ TEST_F(MuscleTests, moveBackward) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({-1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({-1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); _simulationFacade->setSimulationData(data); @@ -134,7 +134,7 @@ TEST_F(MuscleTests, moveBackward) auto actualNerveCell = getCell(actualData, 2); EXPECT_TRUE(approxCompare(getEnergy(data), getEnergy(actualData))); - EXPECT_TRUE(approxCompare(-1.0f, actualMuscleCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(-1.0f, actualMuscleCell.signal.channels[0])); EXPECT_TRUE(approxCompare(actualNerveCell.connections.at(0).distance, actualMuscleCell.connections.at(0).distance)); EXPECT_TRUE(approxCompare(1.0f, actualMuscleCell.connections.at(0).distance)); EXPECT_TRUE(approxCompare(_parameters.cellFunctionMuscleMovementAcceleration[0], actualMuscleCell.vel.x)); @@ -161,14 +161,14 @@ TEST_F(MuscleTests, multipleMovementDirections) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription() .setId(3) .setPos({10.0f, 11.0f}) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), }); data.addConnection(1, 2); data.addConnection(1, 3); @@ -179,7 +179,7 @@ TEST_F(MuscleTests, multipleMovementDirections) auto actualData = _simulationFacade->getSimulationData(); auto actualMuscleCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(2.0f, actualMuscleCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(2.0f, actualMuscleCell.signal.channels[0])); EXPECT_TRUE(actualMuscleCell.vel.x < -NEAR_ZERO); EXPECT_TRUE(actualMuscleCell.vel.y < -NEAR_ZERO); } @@ -203,7 +203,7 @@ TEST_F(MuscleTests, expansion) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); _simulationFacade->setSimulationData(data); @@ -214,7 +214,7 @@ TEST_F(MuscleTests, expansion) auto actualNerveCell = getCell(actualData, 2); EXPECT_TRUE(approxCompare(getEnergy(data), getEnergy(actualData))); - EXPECT_TRUE(approxCompare(1.0f, actualMuscleCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(1.0f, actualMuscleCell.signal.channels[0])); EXPECT_TRUE(approxCompare(actualNerveCell.connections.at(0).distance, actualMuscleCell.connections.at(0).distance)); EXPECT_TRUE(approxCompare(smallDistance + _parameters.cellFunctionMuscleContractionExpansionDelta[0], actualMuscleCell.connections.at(0).distance)); EXPECT_TRUE(approxCompare(0, actualMuscleCell.vel.x)); @@ -240,7 +240,7 @@ TEST_F(MuscleTests, expansionNotPossible) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); _simulationFacade->setSimulationData(data); @@ -250,7 +250,7 @@ TEST_F(MuscleTests, expansionNotPossible) auto actualMuscleCell = getCell(actualData, 1); auto actualNerveCell = getCell(actualData, 2); - EXPECT_TRUE(approxCompare(1.0f, actualMuscleCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(1.0f, actualMuscleCell.signal.channels[0])); EXPECT_TRUE(approxCompare(largeDistance, actualMuscleCell.connections.at(0).distance)); } @@ -273,7 +273,7 @@ TEST_F(MuscleTests, contraction) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({-1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({-1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); _simulationFacade->setSimulationData(data); @@ -283,7 +283,7 @@ TEST_F(MuscleTests, contraction) auto actualMuscleCell = getCell(actualData, 1); auto actualNerveCell = getCell(actualData, 2); - EXPECT_TRUE(approxCompare(-1.0f, actualMuscleCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(-1.0f, actualMuscleCell.signal.channels[0])); EXPECT_TRUE(approxCompare(actualNerveCell.connections.at(0).distance, actualMuscleCell.connections.at(0).distance)); EXPECT_TRUE(approxCompare(largeDistance - _parameters.cellFunctionMuscleContractionExpansionDelta[0], actualMuscleCell.connections.at(0).distance)); } @@ -307,14 +307,14 @@ TEST_F(MuscleTests, multipleContraction) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({-1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({-1, 0, 0, 0, 0, 0, 0, 0}), CellDescription() .setId(3) .setPos({10.0f, 10.0f + largeDistance}) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({-1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({-1, 0, 0, 0, 0, 0, 0, 0}), }); data.addConnection(1, 2); data.addConnection(1, 3); @@ -327,7 +327,7 @@ TEST_F(MuscleTests, multipleContraction) auto muscleToNerveConnection1 = getConnection(actualData, 1, 2); auto muscleToNerveConnection2 = getConnection(actualData, 1, 3); - EXPECT_TRUE(approxCompare(-2.0f, actualMuscleCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(-2.0f, actualMuscleCell.signal.channels[0])); EXPECT_TRUE(approxCompare(largeDistance - _parameters.cellFunctionMuscleContractionExpansionDelta[0], muscleToNerveConnection1.distance)); EXPECT_TRUE(approxCompare(largeDistance - _parameters.cellFunctionMuscleContractionExpansionDelta[0], muscleToNerveConnection2.distance)); } @@ -351,7 +351,7 @@ TEST_F(MuscleTests, contractionNotPossible) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({-1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({-1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); _simulationFacade->setSimulationData(data); @@ -361,7 +361,7 @@ TEST_F(MuscleTests, contractionNotPossible) auto actualMuscleCell = getCell(actualData, 1); auto actualNerveCell = getCell(actualData, 2); - EXPECT_TRUE(approxCompare(-1.0f, actualMuscleCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(-1.0f, actualMuscleCell.signal.channels[0])); EXPECT_TRUE(approxCompare(smallDistance, actualMuscleCell.connections.at(0).distance)); } @@ -383,7 +383,7 @@ TEST_F(MuscleTests, bendClockwise) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), }); data.addConnection(1, 2); data.addConnection(2, 3); @@ -398,7 +398,7 @@ TEST_F(MuscleTests, bendClockwise) auto connection2 = getConnection(actualData, 3, 2); EXPECT_TRUE(approxCompare(getEnergy(data), getEnergy(actualData))); - EXPECT_TRUE(approxCompare(1.0f, actualMuscleCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(1.0f, actualMuscleCell.signal.channels[0])); EXPECT_TRUE(approxCompare(1.0f, connection1.distance)); EXPECT_TRUE(approxCompare(1.0f, connection2.distance)); EXPECT_TRUE(approxCompare(180.0f + _parameters.cellFunctionMuscleBendingAngle[0], connection1.angleFromPrevious)); @@ -424,7 +424,7 @@ TEST_F(MuscleTests, bendCounterClockwise) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({-1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({-1, 0, 0, 0, 0, 0, 0, 0}), }); data.addConnection(1, 2); data.addConnection(2, 3); @@ -438,7 +438,7 @@ TEST_F(MuscleTests, bendCounterClockwise) auto connection1 = getConnection(actualData, 2, 3); auto connection2 = getConnection(actualData, 3, 2); - EXPECT_TRUE(approxCompare(-1.0f, actualMuscleCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(-1.0f, actualMuscleCell.signal.channels[0])); EXPECT_TRUE(approxCompare(1.0f, connection1.distance)); EXPECT_TRUE(approxCompare(1.0f, connection2.distance)); EXPECT_TRUE(approxCompare(180.0f - _parameters.cellFunctionMuscleBendingAngle[0], connection1.angleFromPrevious)); diff --git a/source/EngineTests/NerveTests.cpp b/source/EngineTests/NerveTests.cpp index a3e012296..45a593dc9 100644 --- a/source/EngineTests/NerveTests.cpp +++ b/source/EngineTests/NerveTests.cpp @@ -17,8 +17,8 @@ class NerveTests : public IntegrationTestFramework TEST_F(NerveTests, noInput_execution) { - ActivityDescription activity; - activity.channels = {1, 0, -1, 0, 0, 0, 0, 0}; + SignalDescription signal; + signal.channels = {1, 0, -1, 0, 0, 0, 0, 0}; auto data = DataDescription().addCells({ CellDescription() @@ -26,7 +26,7 @@ TEST_F(NerveTests, noInput_execution) .setCellFunction(NerveDescription()) .setMaxConnections(2) .setExecutionOrderNumber(0) - .setActivity(activity), + .setSignal(signal), }); _simulationFacade->setSimulationData(data); @@ -35,13 +35,13 @@ TEST_F(NerveTests, noInput_execution) auto actualData = _simulationFacade->getSimulationData(); auto actualCellById = getCellById(actualData); - EXPECT_EQ(ActivityDescription(), actualCellById.at(1).activity); + EXPECT_EQ(SignalDescription(), actualCellById.at(1).signal); } TEST_F(NerveTests, noInput_noExecution) { - ActivityDescription activity; - activity.channels = {1, 0, -1, 0, 0, 0, 0, 0}; + SignalDescription signal; + signal.channels = {1, 0, -1, 0, 0, 0, 0, 0}; auto data = DataDescription().addCells({ CellDescription() @@ -49,7 +49,7 @@ TEST_F(NerveTests, noInput_noExecution) .setCellFunction(NerveDescription()) .setMaxConnections(2) .setExecutionOrderNumber(1) - .setActivity(activity), + .setSignal(signal), }); _simulationFacade->setSimulationData(data); @@ -58,13 +58,13 @@ TEST_F(NerveTests, noInput_noExecution) auto actualData = _simulationFacade->getSimulationData(); auto actualCellById = getCellById(actualData); - EXPECT_EQ(activity, actualCellById.at(1).activity); + EXPECT_EQ(signal, actualCellById.at(1).signal); } TEST_F(NerveTests, inputBlocked) { - ActivityDescription activity; - activity.channels = {1, 0, -1, 0, 0, 0, 0, 0}; + SignalDescription signal; + signal.channels = {1, 0, -1, 0, 0, 0, 0, 0}; auto data = DataDescription().addCells({ CellDescription() @@ -73,7 +73,7 @@ TEST_F(NerveTests, inputBlocked) .setCellFunction(NerveDescription()) .setMaxConnections(2) .setExecutionOrderNumber(5) - .setActivity(activity), + .setSignal(signal), CellDescription() .setId(2) .setPos({2.0f, 1.0f}) @@ -90,15 +90,15 @@ TEST_F(NerveTests, inputBlocked) auto actualData = _simulationFacade->getSimulationData(); auto actualCellById = getCellById(actualData); - EXPECT_EQ(ActivityDescription(), actualCellById.at(1).activity); - EXPECT_EQ(ActivityDescription(), actualCellById.at(2).activity); + EXPECT_EQ(SignalDescription(), actualCellById.at(1).signal); + EXPECT_EQ(SignalDescription(), actualCellById.at(2).signal); } } TEST_F(NerveTests, outputBlocked) { - ActivityDescription activity; - activity.channels = {1, 0, -1, 0, 0, 0, 0, 0}; + SignalDescription signal; + signal.channels = {1, 0, -1, 0, 0, 0, 0, 0}; auto data = DataDescription().addCells({ CellDescription() @@ -108,7 +108,7 @@ TEST_F(NerveTests, outputBlocked) .setMaxConnections(2) .setExecutionOrderNumber(5) .setOutputBlocked(true) - .setActivity(activity), + .setSignal(signal), CellDescription() .setId(2) .setPos({2.0f, 1.0f}) @@ -126,15 +126,15 @@ TEST_F(NerveTests, outputBlocked) auto actualData = _simulationFacade->getSimulationData(); auto actualCellById = getCellById(actualData); - EXPECT_EQ(ActivityDescription(), actualCellById.at(1).activity); - EXPECT_EQ(ActivityDescription(), actualCellById.at(2).activity); + EXPECT_EQ(SignalDescription(), actualCellById.at(1).signal); + EXPECT_EQ(SignalDescription(), actualCellById.at(2).signal); } } TEST_F(NerveTests, underConstruction1) { - ActivityDescription activity; - activity.channels = {1, 0, -1, 0, 0, 0, 0, 0}; + SignalDescription signal; + signal.channels = {1, 0, -1, 0, 0, 0, 0, 0}; auto data = DataDescription().addCells({ CellDescription() @@ -144,7 +144,7 @@ TEST_F(NerveTests, underConstruction1) .setMaxConnections(2) .setExecutionOrderNumber(5) .setLivingState(LivingState_UnderConstruction) - .setActivity(activity), + .setSignal(signal), CellDescription() .setId(2) .setPos({2.0f, 1.0f}) @@ -162,15 +162,15 @@ TEST_F(NerveTests, underConstruction1) auto actualData = _simulationFacade->getSimulationData(); auto actualCellById = getCellById(actualData); - EXPECT_EQ(ActivityDescription(), actualCellById.at(1).activity); - EXPECT_EQ(ActivityDescription(), actualCellById.at(2).activity); + EXPECT_EQ(SignalDescription(), actualCellById.at(1).signal); + EXPECT_EQ(SignalDescription(), actualCellById.at(2).signal); } } TEST_F(NerveTests, underConstruction2) { - ActivityDescription activity; - activity.channels = {1, 0, -1, 0, 0, 0, 0, 0}; + SignalDescription signal; + signal.channels = {1, 0, -1, 0, 0, 0, 0, 0}; auto data = DataDescription().addCells({ CellDescription() @@ -179,7 +179,7 @@ TEST_F(NerveTests, underConstruction2) .setCellFunction(NerveDescription()) .setMaxConnections(2) .setExecutionOrderNumber(5) - .setActivity(activity), + .setSignal(signal), CellDescription() .setId(2) .setPos({2.0f, 1.0f}) @@ -198,15 +198,15 @@ TEST_F(NerveTests, underConstruction2) auto actualData = _simulationFacade->getSimulationData(); auto actualCellById = getCellById(actualData); - EXPECT_EQ(ActivityDescription(), actualCellById.at(1).activity); - EXPECT_EQ(ActivityDescription(), actualCellById.at(2).activity); + EXPECT_EQ(SignalDescription(), actualCellById.at(1).signal); + EXPECT_EQ(SignalDescription(), actualCellById.at(2).signal); } } TEST_F(NerveTests, transfer) { - ActivityDescription activity; - activity.channels = {1, 0, -1, 0, 0, 0, 0, 0}; + SignalDescription signal; + signal.channels = {1, 0, -1, 0, 0, 0, 0, 0}; auto data = DataDescription().addCells({ CellDescription() @@ -215,7 +215,7 @@ TEST_F(NerveTests, transfer) .setCellFunction(NerveDescription()) .setMaxConnections(2) .setExecutionOrderNumber(5) - .setActivity(activity), + .setSignal(signal), CellDescription() .setId(2) .setPos({2.0f, 1.0f}) @@ -241,9 +241,9 @@ TEST_F(NerveTests, transfer) auto actualData = _simulationFacade->getSimulationData(); auto actualCellById = getCellById(actualData); - EXPECT_EQ(ActivityDescription(), actualCellById.at(1).activity); - EXPECT_EQ(activity, actualCellById.at(2).activity); - EXPECT_EQ(ActivityDescription(), actualCellById.at(3).activity); + EXPECT_EQ(SignalDescription(), actualCellById.at(1).signal); + EXPECT_EQ(signal, actualCellById.at(2).signal); + EXPECT_EQ(SignalDescription(), actualCellById.at(3).signal); } _simulationFacade->calcTimesteps(1); @@ -251,26 +251,26 @@ TEST_F(NerveTests, transfer) auto actualData = _simulationFacade->getSimulationData(); auto actualCellById = getCellById(actualData); - EXPECT_EQ(ActivityDescription(), actualCellById.at(1).activity); - EXPECT_EQ(ActivityDescription(), actualCellById.at(2).activity); - EXPECT_EQ(activity, actualCellById.at(3).activity); + EXPECT_EQ(SignalDescription(), actualCellById.at(1).signal); + EXPECT_EQ(SignalDescription(), actualCellById.at(2).signal); + EXPECT_EQ(signal, actualCellById.at(3).signal); } _simulationFacade->calcTimesteps(1); { auto actualData = _simulationFacade->getSimulationData(); auto actualCellById = getCellById(actualData); - EXPECT_EQ(ActivityDescription(), actualCellById.at(1).activity); - EXPECT_EQ(ActivityDescription(), actualCellById.at(2).activity); - EXPECT_EQ(ActivityDescription(), actualCellById.at(3).activity); + EXPECT_EQ(SignalDescription(), actualCellById.at(1).signal); + EXPECT_EQ(SignalDescription(), actualCellById.at(2).signal); + EXPECT_EQ(SignalDescription(), actualCellById.at(3).signal); } } TEST_F(NerveTests, cycle) { - ActivityDescription activity; - activity.channels = {1, 0, -1, 0, 0, 0, 0, 0}; + SignalDescription signal; + signal.channels = {1, 0, -1, 0, 0, 0, 0, 0}; auto data = DataDescription().addCells( {CellDescription() @@ -301,7 +301,7 @@ TEST_F(NerveTests, cycle) .setMaxConnections(2) .setExecutionOrderNumber(3) .setInputExecutionOrderNumber(2) - .setActivity(activity)}); + .setSignal(signal)}); data.addConnection(1, 2); data.addConnection(2, 3); data.addConnection(3, 4); @@ -314,10 +314,10 @@ TEST_F(NerveTests, cycle) auto actualData = _simulationFacade->getSimulationData(); auto actualCellById = getCellById(actualData); - EXPECT_EQ(activity, actualCellById.at(1).activity); - EXPECT_EQ(ActivityDescription(), actualCellById.at(2).activity); - EXPECT_EQ(ActivityDescription(), actualCellById.at(3).activity); - EXPECT_EQ(ActivityDescription(), actualCellById.at(4).activity); + EXPECT_EQ(signal, actualCellById.at(1).signal); + EXPECT_EQ(SignalDescription(), actualCellById.at(2).signal); + EXPECT_EQ(SignalDescription(), actualCellById.at(3).signal); + EXPECT_EQ(SignalDescription(), actualCellById.at(4).signal); } _simulationFacade->calcTimesteps(1); @@ -325,10 +325,10 @@ TEST_F(NerveTests, cycle) auto actualData = _simulationFacade->getSimulationData(); auto actualCellById = getCellById(actualData); - EXPECT_EQ(ActivityDescription(), actualCellById.at(1).activity); - EXPECT_EQ(activity, actualCellById.at(2).activity); - EXPECT_EQ(ActivityDescription(), actualCellById.at(3).activity); - EXPECT_EQ(ActivityDescription(), actualCellById.at(4).activity); + EXPECT_EQ(SignalDescription(), actualCellById.at(1).signal); + EXPECT_EQ(signal, actualCellById.at(2).signal); + EXPECT_EQ(SignalDescription(), actualCellById.at(3).signal); + EXPECT_EQ(SignalDescription(), actualCellById.at(4).signal); } _simulationFacade->calcTimesteps(1); @@ -336,10 +336,10 @@ TEST_F(NerveTests, cycle) auto actualData = _simulationFacade->getSimulationData(); auto actualCellById = getCellById(actualData); - EXPECT_EQ(ActivityDescription(), actualCellById.at(1).activity); - EXPECT_EQ(ActivityDescription(), actualCellById.at(2).activity); - EXPECT_EQ(activity, actualCellById.at(3).activity); - EXPECT_EQ(ActivityDescription(), actualCellById.at(4).activity); + EXPECT_EQ(SignalDescription(), actualCellById.at(1).signal); + EXPECT_EQ(SignalDescription(), actualCellById.at(2).signal); + EXPECT_EQ(signal, actualCellById.at(3).signal); + EXPECT_EQ(SignalDescription(), actualCellById.at(4).signal); } for (int i = 0; i < 3; ++i) { @@ -349,10 +349,10 @@ TEST_F(NerveTests, cycle) auto actualData = _simulationFacade->getSimulationData(); auto actualCellById = getCellById(actualData); - EXPECT_EQ(ActivityDescription(), actualCellById.at(1).activity); - EXPECT_EQ(ActivityDescription(), actualCellById.at(2).activity); - EXPECT_EQ(ActivityDescription(), actualCellById.at(3).activity); - EXPECT_EQ(activity, actualCellById.at(4).activity); + EXPECT_EQ(SignalDescription(), actualCellById.at(1).signal); + EXPECT_EQ(SignalDescription(), actualCellById.at(2).signal); + EXPECT_EQ(SignalDescription(), actualCellById.at(3).signal); + EXPECT_EQ(signal, actualCellById.at(4).signal); } _simulationFacade->calcTimesteps(1); @@ -360,17 +360,17 @@ TEST_F(NerveTests, cycle) auto actualData = _simulationFacade->getSimulationData(); auto actualCellById = getCellById(actualData); - EXPECT_EQ(activity, actualCellById.at(1).activity); - EXPECT_EQ(ActivityDescription(), actualCellById.at(2).activity); - EXPECT_EQ(ActivityDescription(), actualCellById.at(3).activity); - EXPECT_EQ(ActivityDescription(), actualCellById.at(4).activity); + EXPECT_EQ(signal, actualCellById.at(1).signal); + EXPECT_EQ(SignalDescription(), actualCellById.at(2).signal); + EXPECT_EQ(SignalDescription(), actualCellById.at(3).signal); + EXPECT_EQ(SignalDescription(), actualCellById.at(4).signal); } } TEST_F(NerveTests, fork) { - ActivityDescription activity; - activity.channels = {1, 0, -1, 0, 0, 0, 0, 0}; + SignalDescription signal; + signal.channels = {1, 0, -1, 0, 0, 0, 0, 0}; auto data = DataDescription().addCells({ CellDescription() @@ -386,7 +386,7 @@ TEST_F(NerveTests, fork) .setCellFunction(NerveDescription()) .setMaxConnections(2) .setExecutionOrderNumber(5) - .setActivity(activity), + .setSignal(signal), CellDescription() .setId(3) .setPos({3.0f, 1.0f}) @@ -405,16 +405,16 @@ TEST_F(NerveTests, fork) auto actualData = _simulationFacade->getSimulationData(); auto actualCellById = getCellById(actualData); - EXPECT_EQ(activity, actualCellById.at(1).activity); - EXPECT_EQ(ActivityDescription(), actualCellById.at(2).activity); - EXPECT_EQ(activity, actualCellById.at(3).activity); + EXPECT_EQ(signal, actualCellById.at(1).signal); + EXPECT_EQ(SignalDescription(), actualCellById.at(2).signal); + EXPECT_EQ(signal, actualCellById.at(3).signal); } } TEST_F(NerveTests, noFork) { - ActivityDescription activity; - activity.channels = {1, 0, -1, 0, 0, 0, 0, 0}; + SignalDescription signal; + signal.channels = {1, 0, -1, 0, 0, 0, 0, 0}; auto data = DataDescription().addCells({ CellDescription().setId(1).setPos({1.0f, 1.0f}).setCellFunction(NerveDescription()).setMaxConnections(2).setExecutionOrderNumber(1), @@ -424,7 +424,7 @@ TEST_F(NerveTests, noFork) .setCellFunction(NerveDescription()) .setMaxConnections(2) .setExecutionOrderNumber(5) - .setActivity(activity), + .setSignal(signal), CellDescription() .setId(3) .setPos({3.0f, 1.0f}) @@ -443,18 +443,18 @@ TEST_F(NerveTests, noFork) auto actualData = _simulationFacade->getSimulationData(); auto actualCellById = getCellById(actualData); - EXPECT_EQ(ActivityDescription(), actualCellById.at(1).activity); - EXPECT_EQ(ActivityDescription(), actualCellById.at(2).activity); - EXPECT_EQ(activity, actualCellById.at(3).activity); + EXPECT_EQ(SignalDescription(), actualCellById.at(1).signal); + EXPECT_EQ(SignalDescription(), actualCellById.at(2).signal); + EXPECT_EQ(signal, actualCellById.at(3).signal); } } TEST_F(NerveTests, merge) { - ActivityDescription activity1, activity2, sumActivity; - activity1.channels = {1, 0, -1, 0, 0, 0, 0, 0}; - activity2.channels = {2, 0, 0.5f, 0, 0, 0, 0, 0}; - sumActivity.channels = {3, 0, -0.5f, 0, 0, 0, 0, 0}; + SignalDescription signal1, signal2, sumSignals; + signal1.channels = {1, 0, -1, 0, 0, 0, 0, 0}; + signal2.channels = {2, 0, 0.5f, 0, 0, 0, 0, 0}; + sumSignals.channels = {3, 0, -0.5f, 0, 0, 0, 0, 0}; auto data = DataDescription().addCells({ CellDescription() @@ -463,7 +463,7 @@ TEST_F(NerveTests, merge) .setCellFunction(NerveDescription()) .setMaxConnections(2) .setExecutionOrderNumber(5) - .setActivity(activity1), + .setSignal(signal1), CellDescription() .setId(2) .setPos({2.0f, 1.0f}) @@ -477,7 +477,7 @@ TEST_F(NerveTests, merge) .setCellFunction(NerveDescription()) .setMaxConnections(2) .setExecutionOrderNumber(5) - .setActivity(activity2), + .setSignal(signal2), }); data.addConnection(1, 2); data.addConnection(2, 3); @@ -489,16 +489,16 @@ TEST_F(NerveTests, merge) auto actualData = _simulationFacade->getSimulationData(); auto actualCellById = getCellById(actualData); - EXPECT_EQ(ActivityDescription(), actualCellById.at(1).activity); - EXPECT_EQ(sumActivity, actualCellById.at(2).activity); - EXPECT_EQ(ActivityDescription(), actualCellById.at(3).activity); + EXPECT_EQ(SignalDescription(), actualCellById.at(1).signal); + EXPECT_EQ(sumSignals, actualCellById.at(2).signal); + EXPECT_EQ(SignalDescription(), actualCellById.at(3).signal); } } TEST_F(NerveTests, sameExecutionOrderNumber) { - ActivityDescription activity; - activity.channels = {1, 0, -1, 0, 0, 0, 0, 0}; + SignalDescription signal; + signal.channels = {1, 0, -1, 0, 0, 0, 0, 0}; auto data = DataDescription().addCells({ CellDescription() @@ -507,7 +507,7 @@ TEST_F(NerveTests, sameExecutionOrderNumber) .setCellFunction(NerveDescription()) .setMaxConnections(2) .setExecutionOrderNumber(0) - .setActivity(activity), + .setSignal(signal), CellDescription() .setId(2) .setPos({2.0f, 1.0f}) @@ -525,8 +525,8 @@ TEST_F(NerveTests, sameExecutionOrderNumber) auto actualData = _simulationFacade->getSimulationData(); auto actualCellById = getCellById(actualData); - EXPECT_EQ(ActivityDescription(), actualCellById.at(1).activity); - EXPECT_EQ(ActivityDescription(), actualCellById.at(2).activity); + EXPECT_EQ(SignalDescription(), actualCellById.at(1).signal); + EXPECT_EQ(SignalDescription(), actualCellById.at(2).signal); } } @@ -558,11 +558,11 @@ TEST_F(NerveTests, constantPulse) auto actualData = _simulationFacade->getSimulationData(); auto actualCellById = getCellById(actualData); - ActivityDescription activity; + SignalDescription signal; if (i % 18 == 0) { - activity.channels = {1, 0, 0, 0, 0, 0, 0, 0}; + signal.channels = {1, 0, 0, 0, 0, 0, 0, 0}; } - EXPECT_EQ(activity, actualCellById.at(1).activity); + EXPECT_EQ(signal, actualCellById.at(1).signal); } } @@ -589,7 +589,7 @@ TEST_F(NerveTests, alternatingPulse) _simulationFacade->calcTimesteps(1); { auto actualCellById = getCellById(_simulationFacade->getSimulationData()); - EXPECT_EQ(ActivityDescription().setChannels({1, 0, 0, 0, 0, 0, 0, 0}), actualCellById.at(1).activity); + EXPECT_EQ(SignalDescription().setChannels({1, 0, 0, 0, 0, 0, 0, 0}), actualCellById.at(1).signal); } for (int pulse = 0; pulse < 3; ++pulse) { @@ -597,7 +597,7 @@ TEST_F(NerveTests, alternatingPulse) _simulationFacade->calcTimesteps(1); } auto actualCellById = getCellById(_simulationFacade->getSimulationData()); - EXPECT_EQ(ActivityDescription().setChannels({1, 0, 0, 0, 0, 0, 0, 0}), actualCellById.at(1).activity); + EXPECT_EQ(SignalDescription().setChannels({1, 0, 0, 0, 0, 0, 0, 0}), actualCellById.at(1).signal); } for (int pulse = 0; pulse < 4; ++pulse) { @@ -605,13 +605,13 @@ TEST_F(NerveTests, alternatingPulse) _simulationFacade->calcTimesteps(1); } auto actualCellById = getCellById(_simulationFacade->getSimulationData()); - EXPECT_EQ(ActivityDescription().setChannels({-1, 0, 0, 0, 0, 0, 0, 0}), actualCellById.at(1).activity); + EXPECT_EQ(SignalDescription().setChannels({-1, 0, 0, 0, 0, 0, 0, 0}), actualCellById.at(1).signal); } for (int pulse = 0; pulse < 4; ++pulse) { for (int i = 0; i < 6*3; ++i) { _simulationFacade->calcTimesteps(1); } auto actualCellById = getCellById(_simulationFacade->getSimulationData()); - EXPECT_EQ(ActivityDescription().setChannels({1, 0, 0, 0, 0, 0, 0, 0}), actualCellById.at(1).activity); + EXPECT_EQ(SignalDescription().setChannels({1, 0, 0, 0, 0, 0, 0, 0}), actualCellById.at(1).signal); } } diff --git a/source/EngineTests/NeuronTests.cpp b/source/EngineTests/NeuronTests.cpp index 791995a96..b2cc94b3d 100644 --- a/source/EngineTests/NeuronTests.cpp +++ b/source/EngineTests/NeuronTests.cpp @@ -33,7 +33,7 @@ TEST_F(NeuronTests, bias) auto actualData = _simulationFacade->getSimulationData(); auto actualCellById = getCellById(actualData); - EXPECT_TRUE(approxCompare({0, 0, scaledSigmoid(1), 0, 0, 0, 0, scaledSigmoid(-1)}, actualCellById.at(1).activity.channels)); + EXPECT_TRUE(approxCompare({0, 0, scaledSigmoid(1), 0, 0, 0, 0, scaledSigmoid(-1)}, actualCellById.at(1).signal.channels)); } TEST_F(NeuronTests, weight) @@ -43,8 +43,8 @@ TEST_F(NeuronTests, weight) neuron.weights[2][7] = 0.5f; neuron.weights[5][3] = -3.5f; - ActivityDescription activity; - activity.channels = {0, 0, 0, 1, 0, 0, 0, 0.5f}; + SignalDescription signal; + signal.channels = {0, 0, 0, 1, 0, 0, 0, 0.5f}; auto data = DataDescription().addCells({ CellDescription() @@ -53,7 +53,7 @@ TEST_F(NeuronTests, weight) .setCellFunction(NerveDescription()) .setMaxConnections(2) .setExecutionOrderNumber(5) - .setActivity(activity), + .setSignal(signal), CellDescription().setId(2).setPos({2.0f, 1.0f}).setCellFunction(neuron).setMaxConnections(2).setExecutionOrderNumber(0).setInputExecutionOrderNumber(5), }); data.addConnection(1, 2); @@ -64,7 +64,7 @@ TEST_F(NeuronTests, weight) auto actualData = _simulationFacade->getSimulationData(); auto actualCellById = getCellById(actualData); - EXPECT_TRUE(approxCompare({0, 0, scaledSigmoid(1.0f + 0.5f * 0.5f), 0, 0, scaledSigmoid(-3.5f), 0, 0}, actualCellById.at(2).activity.channels)); + EXPECT_TRUE(approxCompare({0, 0, scaledSigmoid(1.0f + 0.5f * 0.5f), 0, 0, scaledSigmoid(-3.5f), 0, 0}, actualCellById.at(2).signal.channels)); } TEST_F(NeuronTests, activationFunctionBinaryStep) @@ -77,8 +77,8 @@ TEST_F(NeuronTests, activationFunctionBinaryStep) neuron.activationFunctions[5] = NeuronActivationFunction_BinaryStep; - ActivityDescription activity; - activity.channels = {0, 0, 0, 1, 0, 0, 0, 0.5f}; + SignalDescription signal; + signal.channels = {0, 0, 0, 1, 0, 0, 0, 0.5f}; auto data = DataDescription().addCells({ CellDescription() @@ -87,7 +87,7 @@ TEST_F(NeuronTests, activationFunctionBinaryStep) .setCellFunction(NerveDescription()) .setMaxConnections(2) .setExecutionOrderNumber(5) - .setActivity(activity), + .setSignal(signal), CellDescription().setId(2).setPos({2.0f, 1.0f}).setCellFunction(neuron).setMaxConnections(2).setExecutionOrderNumber(0).setInputExecutionOrderNumber(5), }); data.addConnection(1, 2); @@ -98,5 +98,5 @@ TEST_F(NeuronTests, activationFunctionBinaryStep) auto actualData = _simulationFacade->getSimulationData(); auto actualCellById = getCellById(actualData); - EXPECT_TRUE(approxCompare({0, 0, binaryStep(1.0f + 0.5f * 0.5f), 0, 0, binaryStep(-3.5f), 0, 0}, actualCellById.at(2).activity.channels)); + EXPECT_TRUE(approxCompare({0, 0, binaryStep(1.0f + 0.5f * 0.5f), 0, 0, binaryStep(-3.5f), 0, 0}, actualCellById.at(2).signal.channels)); } diff --git a/source/EngineTests/ReconnectorTests.cpp b/source/EngineTests/ReconnectorTests.cpp index a2ea8f0db..2cf1cdb74 100644 --- a/source/EngineTests/ReconnectorTests.cpp +++ b/source/EngineTests/ReconnectorTests.cpp @@ -43,7 +43,7 @@ TEST_F(ReconnectorTests, establishConnection_noRestriction_nothingFound) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); _simulationFacade->setSimulationData(data); @@ -53,9 +53,9 @@ TEST_F(ReconnectorTests, establishConnection_noRestriction_nothingFound) auto actualReconnectorCell = getCell(actualData, 1); EXPECT_EQ(2, actualData.cells.size()); - EXPECT_TRUE(std::abs(actualReconnectorCell.activity.channels[0]) < NEAR_ZERO); + EXPECT_TRUE(std::abs(actualReconnectorCell.signal.channels[0]) < NEAR_ZERO); EXPECT_TRUE(approxCompare(getEnergy(data), getEnergy(actualData))); - EXPECT_TRUE(approxCompare(0.0f, actualReconnectorCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(0.0f, actualReconnectorCell.signal.channels[0])); EXPECT_EQ(1, actualReconnectorCell.connections.size()); } @@ -76,7 +76,7 @@ TEST_F(ReconnectorTests, establishConnection_noRestriction_success) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription().setId(3).setPos({9.0f, 10.0f}), }); data.addConnection(1, 2); @@ -91,7 +91,7 @@ TEST_F(ReconnectorTests, establishConnection_noRestriction_success) auto actualTargetCell = getCell(actualData, 3); - EXPECT_TRUE(actualReconnectorCell.activity.channels[0] > NEAR_ZERO); + EXPECT_TRUE(actualReconnectorCell.signal.channels[0] > NEAR_ZERO); EXPECT_EQ(2, actualReconnectorCell.connections.size()); EXPECT_EQ(1, actualTargetCell.connections.size()); EXPECT_TRUE(hasConnection(actualData, 1, 3)); @@ -115,7 +115,7 @@ TEST_F(ReconnectorTests, establishConnection_restrictToColor_failed) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription().setId(3).setPos({9.0f, 10.0f}), }); data.addConnection(1, 2); @@ -129,7 +129,7 @@ TEST_F(ReconnectorTests, establishConnection_restrictToColor_failed) auto actualReconnectorCell = getCell(actualData, 1); auto actualTargetCell = getCell(actualData, 3); - EXPECT_TRUE(std::abs(actualReconnectorCell.activity.channels[0]) < NEAR_ZERO); + EXPECT_TRUE(std::abs(actualReconnectorCell.signal.channels[0]) < NEAR_ZERO); EXPECT_EQ(1, actualReconnectorCell.connections.size()); EXPECT_EQ(0, actualTargetCell.connections.size()); EXPECT_TRUE(approxCompare(getEnergy(data), getEnergy(actualData))); @@ -152,7 +152,7 @@ TEST_F(ReconnectorTests, establishConnection_restrictToColor_success) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription().setId(3).setPos({9.0f, 10.0f}), }); data.addConnection(1, 2); @@ -167,7 +167,7 @@ TEST_F(ReconnectorTests, establishConnection_restrictToColor_success) auto actualTargetCell = getCell(actualData, 3); - EXPECT_TRUE(actualReconnectorCell.activity.channels[0] > NEAR_ZERO); + EXPECT_TRUE(actualReconnectorCell.signal.channels[0] > NEAR_ZERO); EXPECT_EQ(2, actualReconnectorCell.connections.size()); EXPECT_EQ(1, actualTargetCell.connections.size()); EXPECT_TRUE(hasConnection(actualData, 1, 3)); @@ -192,7 +192,7 @@ TEST_F(ReconnectorTests, establishConnection_restrictToSameMutants_success) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription().setId(3).setPos({9.0f, 10.0f}).setMutationId(5), }); data.addConnection(1, 2); @@ -207,7 +207,7 @@ TEST_F(ReconnectorTests, establishConnection_restrictToSameMutants_success) auto actualTargetCell = getCell(actualData, 3); - EXPECT_TRUE(actualReconnectorCell.activity.channels[0] > NEAR_ZERO); + EXPECT_TRUE(actualReconnectorCell.signal.channels[0] > NEAR_ZERO); EXPECT_EQ(2, actualReconnectorCell.connections.size()); EXPECT_EQ(1, actualTargetCell.connections.size()); EXPECT_TRUE(hasConnection(actualData, 1, 3)); @@ -232,7 +232,7 @@ TEST_F(ReconnectorTests, establishConnection_restrictToSameMutants_failed) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription().setId(3).setPos({9.0f, 10.0f}).setMutationId(4), }); data.addConnection(1, 2); @@ -246,7 +246,7 @@ TEST_F(ReconnectorTests, establishConnection_restrictToSameMutants_failed) auto actualReconnectorCell = getCell(actualData, 1); auto actualTargetCell = getCell(actualData, 3); - EXPECT_TRUE(std::abs(actualReconnectorCell.activity.channels[0]) < NEAR_ZERO); + EXPECT_TRUE(std::abs(actualReconnectorCell.signal.channels[0]) < NEAR_ZERO); EXPECT_EQ(1, actualReconnectorCell.connections.size()); EXPECT_EQ(0, actualTargetCell.connections.size()); } @@ -269,7 +269,7 @@ TEST_F(ReconnectorTests, establishConnection_restrictToOtherMutants_success) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription().setId(3).setPos({9.0f, 10.0f}).setMutationId(4), }); data.addConnection(1, 2); @@ -283,7 +283,7 @@ TEST_F(ReconnectorTests, establishConnection_restrictToOtherMutants_success) auto actualReconnectorCell = getCell(actualData, 1); auto actualTargetCell = getCell(actualData, 3); - EXPECT_TRUE(actualReconnectorCell.activity.channels[0] > NEAR_ZERO); + EXPECT_TRUE(actualReconnectorCell.signal.channels[0] > NEAR_ZERO); EXPECT_EQ(2, actualReconnectorCell.connections.size()); EXPECT_EQ(1, actualTargetCell.connections.size()); EXPECT_TRUE(hasConnection(actualData, 1, 3)); @@ -308,7 +308,7 @@ TEST_F(ReconnectorTests, establishConnection_restrictToOtherMutants_failed_zeroM .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription().setId(3).setPos({9.0f, 10.0f}).setMutationId(0), }); data.addConnection(1, 2); @@ -322,7 +322,7 @@ TEST_F(ReconnectorTests, establishConnection_restrictToOtherMutants_failed_zeroM auto actualReconnectorCell = getCell(actualData, 1); auto actualTargetCell = getCell(actualData, 3); - EXPECT_TRUE(std::abs(actualReconnectorCell.activity.channels[0]) < NEAR_ZERO); + EXPECT_TRUE(std::abs(actualReconnectorCell.signal.channels[0]) < NEAR_ZERO); EXPECT_EQ(1, actualReconnectorCell.connections.size()); EXPECT_EQ(0, actualTargetCell.connections.size()); } @@ -345,7 +345,7 @@ TEST_F(ReconnectorTests, establishConnection_restrictToOtherMutants_failed_respa .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription().setId(3).setPos({9.0f, 10.0f}).setMutationId(1), }); data.addConnection(1, 2); @@ -359,7 +359,7 @@ TEST_F(ReconnectorTests, establishConnection_restrictToOtherMutants_failed_respa auto actualReconnectorCell = getCell(actualData, 1); auto actualTargetCell = getCell(actualData, 3); - EXPECT_TRUE(std::abs(actualReconnectorCell.activity.channels[0]) < NEAR_ZERO); + EXPECT_TRUE(std::abs(actualReconnectorCell.signal.channels[0]) < NEAR_ZERO); EXPECT_EQ(1, actualReconnectorCell.connections.size()); EXPECT_EQ(0, actualTargetCell.connections.size()); } @@ -382,7 +382,7 @@ TEST_F(ReconnectorTests, establishConnection_restrictToOtherMutants_failed_sameM .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription().setId(3).setPos({9.0f, 10.0f}).setMutationId(5), }); data.addConnection(1, 2); @@ -396,7 +396,7 @@ TEST_F(ReconnectorTests, establishConnection_restrictToOtherMutants_failed_sameM auto actualReconnectorCell = getCell(actualData, 1); auto actualTargetCell = getCell(actualData, 3); - EXPECT_TRUE(std::abs(actualReconnectorCell.activity.channels[0]) < NEAR_ZERO); + EXPECT_TRUE(std::abs(actualReconnectorCell.signal.channels[0]) < NEAR_ZERO); EXPECT_EQ(1, actualReconnectorCell.connections.size()); EXPECT_EQ(0, actualTargetCell.connections.size()); } @@ -419,7 +419,7 @@ TEST_F(ReconnectorTests, establishConnection_restrictToZeroMutants_success) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription().setId(3).setPos({9.0f, 10.0f}).setMutationId(0), }); data.addConnection(1, 2); @@ -433,7 +433,7 @@ TEST_F(ReconnectorTests, establishConnection_restrictToZeroMutants_success) auto actualReconnectorCell = getCell(actualData, 1); auto actualTargetCell = getCell(actualData, 3); - EXPECT_TRUE(actualReconnectorCell.activity.channels[0] > NEAR_ZERO); + EXPECT_TRUE(actualReconnectorCell.signal.channels[0] > NEAR_ZERO); EXPECT_EQ(2, actualReconnectorCell.connections.size()); EXPECT_EQ(1, actualTargetCell.connections.size()); EXPECT_TRUE(hasConnection(actualData, 1, 3)); @@ -458,7 +458,7 @@ TEST_F(ReconnectorTests, establishConnection_restrictToZeroMutants_failed) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription().setId(3).setPos({9.0f, 10.0f}).setMutationId(4), }); data.addConnection(1, 2); @@ -472,7 +472,7 @@ TEST_F(ReconnectorTests, establishConnection_restrictToZeroMutants_failed) auto actualReconnectorCell = getCell(actualData, 1); auto actualTargetCell = getCell(actualData, 3); - EXPECT_TRUE(std::abs(actualReconnectorCell.activity.channels[0]) < NEAR_ZERO); + EXPECT_TRUE(std::abs(actualReconnectorCell.signal.channels[0]) < NEAR_ZERO); EXPECT_EQ(1, actualReconnectorCell.connections.size()); EXPECT_EQ(0, actualTargetCell.connections.size()); } @@ -495,7 +495,7 @@ TEST_F(ReconnectorTests, establishConnection_restrictToRespawned_success) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription().setId(3).setPos({9.0f, 10.0f}).setMutationId(1), }); data.addConnection(1, 2); @@ -509,7 +509,7 @@ TEST_F(ReconnectorTests, establishConnection_restrictToRespawned_success) auto actualReconnectorCell = getCell(actualData, 1); auto actualTargetCell = getCell(actualData, 3); - EXPECT_TRUE(actualReconnectorCell.activity.channels[0] > NEAR_ZERO); + EXPECT_TRUE(actualReconnectorCell.signal.channels[0] > NEAR_ZERO); EXPECT_EQ(2, actualReconnectorCell.connections.size()); EXPECT_EQ(1, actualTargetCell.connections.size()); EXPECT_TRUE(hasConnection(actualData, 1, 3)); @@ -534,7 +534,7 @@ TEST_F(ReconnectorTests, establishConnection_restrictToRespawned_failed) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription().setId(3).setPos({9.0f, 10.0f}).setMutationId(0), }); data.addConnection(1, 2); @@ -548,7 +548,7 @@ TEST_F(ReconnectorTests, establishConnection_restrictToRespawned_failed) auto actualReconnectorCell = getCell(actualData, 1); auto actualTargetCell = getCell(actualData, 3); - EXPECT_TRUE(std::abs(actualReconnectorCell.activity.channels[0]) < NEAR_ZERO); + EXPECT_TRUE(std::abs(actualReconnectorCell.signal.channels[0]) < NEAR_ZERO); EXPECT_EQ(1, actualReconnectorCell.connections.size()); EXPECT_EQ(0, actualTargetCell.connections.size()); } @@ -572,7 +572,7 @@ TEST_F(ReconnectorTests, establishConnection_restrictToLessComplexMutants_succes .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription().setId(3).setPos({9.0f, 10.0f}).setMutationId(1).setGenomeComplexity(999.0f), }); data.addConnection(1, 2); @@ -603,7 +603,7 @@ TEST_F(ReconnectorTests, establishConnection_restrictToLessComplexMutants_failed .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription().setId(3).setPos({9.0f, 10.0f}).setMutationId(1).setGenomeComplexity(1001.0f), }); data.addConnection(1, 2); @@ -634,7 +634,7 @@ TEST_F(ReconnectorTests, establishConnection_restrictToMoreComplexMutants_succes .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription().setId(3).setPos({9.0f, 10.0f}).setMutationId(1).setGenomeComplexity(1001.0f), }); data.addConnection(1, 2); @@ -665,7 +665,7 @@ TEST_F(ReconnectorTests, establishConnection_restrictToMoreComplexMutants_failed .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0}), + .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), CellDescription().setId(3).setPos({9.0f, 10.0f}).setMutationId(1).setGenomeComplexity(1000.0f), }); data.addConnection(1, 2); @@ -695,7 +695,7 @@ TEST_F(ReconnectorTests, deleteConnections_success) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({-1, 0, 0, 0, 0, 0, 0, 0}) + .setSignal({-1, 0, 0, 0, 0, 0, 0, 0}) .setCreatureId(1), CellDescription().setId(3).setPos({9.0f, 10.0f}).setMaxConnections(1).setCreatureId(3), CellDescription().setId(4).setPos({9.0f, 11.0f}).setMaxConnections(1).setCreatureId(4), @@ -715,7 +715,7 @@ TEST_F(ReconnectorTests, deleteConnections_success) auto actualTargetCell1 = getCell(actualData, 3); auto actualTargetCell2 = getCell(actualData, 4); - EXPECT_TRUE(actualReconnectorCell.activity.channels[0] > NEAR_ZERO); + EXPECT_TRUE(actualReconnectorCell.signal.channels[0] > NEAR_ZERO); EXPECT_EQ(1, actualReconnectorCell.connections.size()); EXPECT_TRUE(actualTargetCell1.connections.empty()); EXPECT_TRUE(actualTargetCell2.connections.empty()); diff --git a/source/EngineTests/SensorTests.cpp b/source/EngineTests/SensorTests.cpp index b742aa857..c2f3f0a3b 100644 --- a/source/EngineTests/SensorTests.cpp +++ b/source/EngineTests/SensorTests.cpp @@ -25,7 +25,7 @@ class SensorTests : public IntegrationTestFramework ~SensorTests() = default; }; -TEST_F(SensorTests, scanNeighborhood_noActivity) +TEST_F(SensorTests, scanNeighborhood_noSignal) { DataDescription data; data.addCells( @@ -42,7 +42,7 @@ TEST_F(SensorTests, scanNeighborhood_noActivity) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({0, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({0, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); _simulationFacade->setSimulationData(data); @@ -52,7 +52,7 @@ TEST_F(SensorTests, scanNeighborhood_noActivity) auto actualAttackCell = getCell(actualData, 1); EXPECT_EQ(2, actualData.cells.size()); - EXPECT_TRUE(approxCompare(0.0f, actualAttackCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(0.0f, actualAttackCell.signal.channels[0])); } TEST_F(SensorTests, scanNeighborhood_noOtherCell) @@ -72,7 +72,7 @@ TEST_F(SensorTests, scanNeighborhood_noOtherCell) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); _simulationFacade->setSimulationData(data); @@ -81,7 +81,7 @@ TEST_F(SensorTests, scanNeighborhood_noOtherCell) auto actualData = _simulationFacade->getSimulationData(); auto actualAttackCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(0.0f, actualAttackCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(0.0f, actualAttackCell.signal.channels[0])); } TEST_F(SensorTests, scanNeighborhood_densityTooLow) @@ -101,7 +101,7 @@ TEST_F(SensorTests, scanNeighborhood_densityTooLow) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); data.add(DescriptionEditService::get().get().createRect( @@ -113,7 +113,7 @@ TEST_F(SensorTests, scanNeighborhood_densityTooLow) auto actualData = _simulationFacade->getSimulationData(); auto actualAttackCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(0.0f, actualAttackCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(0.0f, actualAttackCell.signal.channels[0])); } TEST_F(SensorTests, scanNeighborhood_wrongColor) @@ -133,7 +133,7 @@ TEST_F(SensorTests, scanNeighborhood_wrongColor) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); data.add(DescriptionEditService::get().createRect(DescriptionEditService::CreateRectParameters().center({10.0f, 100.0f}).width(10).height(10).cellDistance(2.5f))); @@ -144,7 +144,7 @@ TEST_F(SensorTests, scanNeighborhood_wrongColor) auto actualData = _simulationFacade->getSimulationData(); auto actualAttackCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(0.0f, actualAttackCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(0.0f, actualAttackCell.signal.channels[0])); } TEST_F(SensorTests, scanNeighborhood_foundAtFront) @@ -164,7 +164,7 @@ TEST_F(SensorTests, scanNeighborhood_foundAtFront) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); data.add(DescriptionEditService::get().createRect(DescriptionEditService::CreateRectParameters().center({10.0f, 100.0f}).width(16).height(16).cellDistance(0.5f))); @@ -175,12 +175,12 @@ TEST_F(SensorTests, scanNeighborhood_foundAtFront) auto actualData = _simulationFacade->getSimulationData(); auto actualSensorCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(1.0f, actualSensorCell.activity.channels[0])); - EXPECT_TRUE(actualSensorCell.activity.channels[1] > 0.3f); - EXPECT_TRUE(actualSensorCell.activity.channels[2] < 1.0f - 80.0f / 256); - EXPECT_TRUE(actualSensorCell.activity.channels[2] > 1.0f - 105.0f / 256); - EXPECT_TRUE(actualSensorCell.activity.channels[3] > -15.0f / 365); - EXPECT_TRUE(actualSensorCell.activity.channels[3] < 15.0f / 365); + EXPECT_TRUE(approxCompare(1.0f, actualSensorCell.signal.channels[0])); + EXPECT_TRUE(actualSensorCell.signal.channels[1] > 0.3f); + EXPECT_TRUE(actualSensorCell.signal.channels[2] < 1.0f - 80.0f / 256); + EXPECT_TRUE(actualSensorCell.signal.channels[2] > 1.0f - 105.0f / 256); + EXPECT_TRUE(actualSensorCell.signal.channels[3] > -15.0f / 365); + EXPECT_TRUE(actualSensorCell.signal.channels[3] < 15.0f / 365); } TEST_F(SensorTests, scanNeighborhood_foundAtRightHandSide) @@ -203,7 +203,7 @@ TEST_F(SensorTests, scanNeighborhood_foundAtRightHandSide) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); data.add(DescriptionEditService::get().createRect(DescriptionEditService::CreateRectParameters().center({100.0f, 10.0f}).width(16).height(16).cellDistance(0.5f))); @@ -214,12 +214,12 @@ TEST_F(SensorTests, scanNeighborhood_foundAtRightHandSide) auto actualData = _simulationFacade->getSimulationData(); auto actualAttackCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(1.0f, actualAttackCell.activity.channels[0])); - EXPECT_TRUE(actualAttackCell.activity.channels[1] > 0.3f); - EXPECT_TRUE(actualAttackCell.activity.channels[2] < 1.0f - 80.0f / 256); - EXPECT_TRUE(actualAttackCell.activity.channels[2] > 1.0f - 105.0f / 256); - EXPECT_TRUE(actualAttackCell.activity.channels[3] > 70.0f / 365); - EXPECT_TRUE(actualAttackCell.activity.channels[3] < 105.0f / 365); + EXPECT_TRUE(approxCompare(1.0f, actualAttackCell.signal.channels[0])); + EXPECT_TRUE(actualAttackCell.signal.channels[1] > 0.3f); + EXPECT_TRUE(actualAttackCell.signal.channels[2] < 1.0f - 80.0f / 256); + EXPECT_TRUE(actualAttackCell.signal.channels[2] > 1.0f - 105.0f / 256); + EXPECT_TRUE(actualAttackCell.signal.channels[3] > 70.0f / 365); + EXPECT_TRUE(actualAttackCell.signal.channels[3] < 105.0f / 365); } TEST_F(SensorTests, scanNeighborhood_foundAtLeftHandSide) @@ -242,7 +242,7 @@ TEST_F(SensorTests, scanNeighborhood_foundAtLeftHandSide) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); data.add(DescriptionEditService::get().createRect(DescriptionEditService::CreateRectParameters().center({100.0f, 190.0f}).width(16).height(16).cellDistance(0.5f))); @@ -253,12 +253,12 @@ TEST_F(SensorTests, scanNeighborhood_foundAtLeftHandSide) auto actualData = _simulationFacade->getSimulationData(); auto actualAttackCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(1.0f, actualAttackCell.activity.channels[0])); - EXPECT_TRUE(actualAttackCell.activity.channels[1] > 0.3f); - EXPECT_TRUE(actualAttackCell.activity.channels[2] < 1.0f - 80.0f / 256); - EXPECT_TRUE(actualAttackCell.activity.channels[2] > 1.0f - 105.0f / 256); - EXPECT_TRUE(actualAttackCell.activity.channels[3] < -70.0f / 365); - EXPECT_TRUE(actualAttackCell.activity.channels[3] > -105.0f / 365); + EXPECT_TRUE(approxCompare(1.0f, actualAttackCell.signal.channels[0])); + EXPECT_TRUE(actualAttackCell.signal.channels[1] > 0.3f); + EXPECT_TRUE(actualAttackCell.signal.channels[2] < 1.0f - 80.0f / 256); + EXPECT_TRUE(actualAttackCell.signal.channels[2] > 1.0f - 105.0f / 256); + EXPECT_TRUE(actualAttackCell.signal.channels[3] < -70.0f / 365); + EXPECT_TRUE(actualAttackCell.signal.channels[3] > -105.0f / 365); } TEST_F(SensorTests, scanNeighborhood_foundAtBack) @@ -281,7 +281,7 @@ TEST_F(SensorTests, scanNeighborhood_foundAtBack) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); data.add(DescriptionEditService::get().createRect(DescriptionEditService::CreateRectParameters().center({190.0f, 100.0f}).width(16).height(16).cellDistance(0.5f))); @@ -292,11 +292,11 @@ TEST_F(SensorTests, scanNeighborhood_foundAtBack) auto actualData = _simulationFacade->getSimulationData(); auto actualAttackCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(1.0f, actualAttackCell.activity.channels[0])); - EXPECT_TRUE(actualAttackCell.activity.channels[1] > 0.3f); - EXPECT_TRUE(actualAttackCell.activity.channels[2] < 1.0f - 80.0f / 256); - EXPECT_TRUE(actualAttackCell.activity.channels[2] > 1.0f - 105.0f / 256); - EXPECT_TRUE(actualAttackCell.activity.channels[3] < -165.0f / 365 || actualAttackCell.activity.channels[3] > 165.0f / 365); + EXPECT_TRUE(approxCompare(1.0f, actualAttackCell.signal.channels[0])); + EXPECT_TRUE(actualAttackCell.signal.channels[1] > 0.3f); + EXPECT_TRUE(actualAttackCell.signal.channels[2] < 1.0f - 80.0f / 256); + EXPECT_TRUE(actualAttackCell.signal.channels[2] > 1.0f - 105.0f / 256); + EXPECT_TRUE(actualAttackCell.signal.channels[3] < -165.0f / 365 || actualAttackCell.signal.channels[3] > 165.0f / 365); } @@ -320,7 +320,7 @@ TEST_F(SensorTests, scanNeighborhood_twoMasses) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); data.add(DescriptionEditService::get().createRect(DescriptionEditService::CreateRectParameters().center({100.0f, 10.0f}).width(16).height(16).cellDistance(0.8f))); @@ -332,12 +332,12 @@ TEST_F(SensorTests, scanNeighborhood_twoMasses) auto actualData = _simulationFacade->getSimulationData(); auto actualAttackCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(1.0f, actualAttackCell.activity.channels[0])); - EXPECT_TRUE(actualAttackCell.activity.channels[1] > 0.3f); - EXPECT_TRUE(actualAttackCell.activity.channels[2] < 1.0f - 80.0f / 256); - EXPECT_TRUE(actualAttackCell.activity.channels[2] > 1.0f - 105.0f / 256); - EXPECT_TRUE(actualAttackCell.activity.channels[3] > 70.0f / 365); - EXPECT_TRUE(actualAttackCell.activity.channels[3] < 105.0f / 365); + EXPECT_TRUE(approxCompare(1.0f, actualAttackCell.signal.channels[0])); + EXPECT_TRUE(actualAttackCell.signal.channels[1] > 0.3f); + EXPECT_TRUE(actualAttackCell.signal.channels[2] < 1.0f - 80.0f / 256); + EXPECT_TRUE(actualAttackCell.signal.channels[2] > 1.0f - 105.0f / 256); + EXPECT_TRUE(actualAttackCell.signal.channels[3] > 70.0f / 365); + EXPECT_TRUE(actualAttackCell.signal.channels[3] < 105.0f / 365); } TEST_F(SensorTests, scanByAngle_found) @@ -357,7 +357,7 @@ TEST_F(SensorTests, scanByAngle_found) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); data.add(DescriptionEditService::get().createRect(DescriptionEditService::CreateRectParameters().center({100.0f, 190.0f}).width(16).height(16).cellDistance(0.5f))); @@ -368,10 +368,10 @@ TEST_F(SensorTests, scanByAngle_found) auto actualData = _simulationFacade->getSimulationData(); auto actualAttackCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(1.0f, actualAttackCell.activity.channels[0])); - EXPECT_TRUE(actualAttackCell.activity.channels[1] > 0.3f); - EXPECT_TRUE(actualAttackCell.activity.channels[2] > 80.0f / 256); - EXPECT_TRUE(actualAttackCell.activity.channels[2] < 105.0f / 256); + EXPECT_TRUE(approxCompare(1.0f, actualAttackCell.signal.channels[0])); + EXPECT_TRUE(actualAttackCell.signal.channels[1] > 0.3f); + EXPECT_TRUE(actualAttackCell.signal.channels[2] > 80.0f / 256); + EXPECT_TRUE(actualAttackCell.signal.channels[2] < 105.0f / 256); } TEST_F(SensorTests, scanByAngle_wrongAngle) @@ -391,7 +391,7 @@ TEST_F(SensorTests, scanByAngle_wrongAngle) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); data.add(DescriptionEditService::get().createRect(DescriptionEditService::CreateRectParameters().center({100.0f, 190.0f}).width(16).height(16).cellDistance(0.5f))); @@ -402,7 +402,7 @@ TEST_F(SensorTests, scanByAngle_wrongAngle) auto actualData = _simulationFacade->getSimulationData(); auto actualAttackCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(0.0f, actualAttackCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(0.0f, actualAttackCell.signal.channels[0])); } @@ -427,7 +427,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_otherMutant_found) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); data.add(DescriptionEditService::get().createRect( @@ -439,12 +439,12 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_otherMutant_found) auto actualData = _simulationFacade->getSimulationData(); auto actualSensorCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(1.0f, actualSensorCell.activity.channels[0])); - EXPECT_TRUE(actualSensorCell.activity.channels[1] > 0.3f); - EXPECT_TRUE(actualSensorCell.activity.channels[2] < 1.0f - 80.0f / 256); - EXPECT_TRUE(actualSensorCell.activity.channels[2] > 1.0f - 105.0f / 256); - EXPECT_TRUE(actualSensorCell.activity.channels[3] > -15.0f / 365); - EXPECT_TRUE(actualSensorCell.activity.channels[3] < 15.0f / 365); + EXPECT_TRUE(approxCompare(1.0f, actualSensorCell.signal.channels[0])); + EXPECT_TRUE(actualSensorCell.signal.channels[1] > 0.3f); + EXPECT_TRUE(actualSensorCell.signal.channels[2] < 1.0f - 80.0f / 256); + EXPECT_TRUE(actualSensorCell.signal.channels[2] > 1.0f - 105.0f / 256); + EXPECT_TRUE(actualSensorCell.signal.channels[3] > -15.0f / 365); + EXPECT_TRUE(actualSensorCell.signal.channels[3] < 15.0f / 365); } TEST_F(SensorTests, scanNeighborhood_targetedCreature_otherMutant_found_wallBehind) @@ -468,7 +468,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_otherMutant_found_wallBehi .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); //data.add(DescriptionEditService::get().createRect( @@ -483,7 +483,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_otherMutant_found_wallBehi auto actualData = _simulationFacade->getSimulationData(); auto actualSensorCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(1.0f, actualSensorCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(1.0f, actualSensorCell.signal.channels[0])); } TEST_F(SensorTests, scanNeighborhood_targetedCreature_otherMutant_notFound) @@ -507,7 +507,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_otherMutant_notFound) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); data.add(DescriptionEditService::get().createRect( @@ -519,7 +519,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_otherMutant_notFound) auto actualData = _simulationFacade->getSimulationData(); auto actualSensorCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(0.0f, actualSensorCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(0.0f, actualSensorCell.signal.channels[0])); } TEST_F(SensorTests, scanNeighborhood_targetedCreature_otherMutant_notFound_wallInBetween) @@ -543,7 +543,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_otherMutant_notFound_wallI .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); data.add(DescriptionEditService::get().createRect( @@ -558,7 +558,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_otherMutant_notFound_wallI auto actualData = _simulationFacade->getSimulationData(); auto actualSensorCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(0.0f, actualSensorCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(0.0f, actualSensorCell.signal.channels[0])); } TEST_F(SensorTests, scanNeighborhood_targetedCreature_sameMutant_found) @@ -582,7 +582,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_sameMutant_found) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); data.add(DescriptionEditService::get().createRect( @@ -594,7 +594,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_sameMutant_found) auto actualData = _simulationFacade->getSimulationData(); auto actualSensorCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(1.0f, actualSensorCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(1.0f, actualSensorCell.signal.channels[0])); } TEST_F(SensorTests, scanNeighborhood_targetedCreature_sameMutant_notFound) @@ -624,7 +624,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_sameMutant_notFound) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); data.add(DescriptionEditService::get().createRect( @@ -638,7 +638,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_sameMutant_notFound) auto actualData = _simulationFacade->getSimulationData(); auto actualSensorCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(0.0f, actualSensorCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(0.0f, actualSensorCell.signal.channels[0])); } } @@ -663,7 +663,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_zeroMutant_found) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); data.add(DescriptionEditService::get().createRect( @@ -675,7 +675,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_zeroMutant_found) auto actualData = _simulationFacade->getSimulationData(); auto actualSensorCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(1.0f, actualSensorCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(1.0f, actualSensorCell.signal.channels[0])); } TEST_F(SensorTests, scanNeighborhood_targetedCreature_zeroMutant_notFound) @@ -699,7 +699,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_zeroMutant_notFound) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); data.add(DescriptionEditService::get().createRect( @@ -711,7 +711,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_zeroMutant_notFound) auto actualData = _simulationFacade->getSimulationData(); auto actualSensorCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(0.0f, actualSensorCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(0.0f, actualSensorCell.signal.channels[0])); } TEST_F(SensorTests, scanNeighborhood_targetedCreature_respawnedMutant_found) @@ -735,7 +735,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_respawnedMutant_found) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); data.add(DescriptionEditService::get().createRect( @@ -747,7 +747,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_respawnedMutant_found) auto actualData = _simulationFacade->getSimulationData(); auto actualSensorCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(1.0f, actualSensorCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(1.0f, actualSensorCell.signal.channels[0])); } TEST_F(SensorTests, scanNeighborhood_targetedCreature_respawnedMutant_notFound) @@ -771,7 +771,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_respawnedMutant_notFound) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); data.add(DescriptionEditService::get().createRect( @@ -783,7 +783,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_respawnedMutant_notFound) auto actualData = _simulationFacade->getSimulationData(); auto actualSensorCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(0.0f, actualSensorCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(0.0f, actualSensorCell.signal.channels[0])); } TEST_F(SensorTests, scanNeighborhood_targetedCreature_lessComplexMutant_found) @@ -810,7 +810,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_lessComplexMutant_found) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); data.add(DescriptionEditService::get().createRect(DescriptionEditService::CreateRectParameters() @@ -829,7 +829,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_lessComplexMutant_found) auto actualData = _simulationFacade->getSimulationData(); auto actualSensorCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(1.0f, actualSensorCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(1.0f, actualSensorCell.signal.channels[0])); } } @@ -857,7 +857,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_lessComplexMutant_notFound .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); data.add(DescriptionEditService::get().createRect(DescriptionEditService::CreateRectParameters() @@ -876,7 +876,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_lessComplexMutant_notFound auto actualData = _simulationFacade->getSimulationData(); auto actualSensorCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(0.0f, actualSensorCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(0.0f, actualSensorCell.signal.channels[0])); } } @@ -902,7 +902,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_lessComplexMutant_notFound .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); data.add(DescriptionEditService::get().createRect( @@ -914,7 +914,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_lessComplexMutant_notFound auto actualData = _simulationFacade->getSimulationData(); auto actualSensorCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(0.0f, actualSensorCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(0.0f, actualSensorCell.signal.channels[0])); } TEST_F(SensorTests, scanNeighborhood_targetedCreature_lessComplexMutant_notFound_respawnedCell) @@ -939,7 +939,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_lessComplexMutant_notFound .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); data.add(DescriptionEditService::get().createRect( @@ -951,7 +951,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_lessComplexMutant_notFound auto actualData = _simulationFacade->getSimulationData(); auto actualSensorCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(0.0f, actualSensorCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(0.0f, actualSensorCell.signal.channels[0])); } TEST_F(SensorTests, scanNeighborhood_targetedCreature_moreComplexMutant_found) @@ -978,7 +978,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_moreComplexMutant_found) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); data.add(DescriptionEditService::get().createRect(DescriptionEditService::CreateRectParameters() @@ -997,7 +997,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_moreComplexMutant_found) auto actualData = _simulationFacade->getSimulationData(); auto actualSensorCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(1.0f, actualSensorCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(1.0f, actualSensorCell.signal.channels[0])); } } @@ -1025,7 +1025,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_moreComplexMutant_notFound .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); data.add(DescriptionEditService::get().createRect(DescriptionEditService::CreateRectParameters() @@ -1044,7 +1044,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_moreComplexMutant_notFound auto actualData = _simulationFacade->getSimulationData(); auto actualSensorCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(0.0f, actualSensorCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(0.0f, actualSensorCell.signal.channels[0])); } } @@ -1070,7 +1070,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_moreComplexMutant_notFound .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); data.add(DescriptionEditService::get().createRect( @@ -1082,7 +1082,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_moreComplexMutant_notFound auto actualData = _simulationFacade->getSimulationData(); auto actualSensorCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(0.0f, actualSensorCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(0.0f, actualSensorCell.signal.channels[0])); } TEST_F(SensorTests, scanNeighborhood_targetedCreature_moreComplexMutant_notFound_respawnedCell) @@ -1107,7 +1107,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_moreComplexMutant_notFound .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); data.add(DescriptionEditService::get().createRect( @@ -1119,7 +1119,7 @@ TEST_F(SensorTests, scanNeighborhood_targetedCreature_moreComplexMutant_notFound auto actualData = _simulationFacade->getSimulationData(); auto actualSensorCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(0.0f, actualSensorCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(0.0f, actualSensorCell.signal.channels[0])); } TEST_F(SensorTests, scanNeighborhood_minRange_found) @@ -1139,7 +1139,7 @@ TEST_F(SensorTests, scanNeighborhood_minRange_found) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); data.add( @@ -1151,7 +1151,7 @@ TEST_F(SensorTests, scanNeighborhood_minRange_found) auto actualData = _simulationFacade->getSimulationData(); auto actualSensorCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(1.0f, actualSensorCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(1.0f, actualSensorCell.signal.channels[0])); } TEST_F(SensorTests, scanNeighborhood_minRange_notFound) @@ -1171,7 +1171,7 @@ TEST_F(SensorTests, scanNeighborhood_minRange_notFound) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); data.add( @@ -1183,7 +1183,7 @@ TEST_F(SensorTests, scanNeighborhood_minRange_notFound) auto actualData = _simulationFacade->getSimulationData(); auto actualSensorCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(0.0f, actualSensorCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(0.0f, actualSensorCell.signal.channels[0])); } TEST_F(SensorTests, scanNeighborhood_maxRange_found) @@ -1203,7 +1203,7 @@ TEST_F(SensorTests, scanNeighborhood_maxRange_found) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); data.add( @@ -1215,7 +1215,7 @@ TEST_F(SensorTests, scanNeighborhood_maxRange_found) auto actualData = _simulationFacade->getSimulationData(); auto actualSensorCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(1.0f, actualSensorCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(1.0f, actualSensorCell.signal.channels[0])); } TEST_F(SensorTests, scanNeighborhood_maxRange_notFound) @@ -1235,7 +1235,7 @@ TEST_F(SensorTests, scanNeighborhood_maxRange_notFound) .setMaxConnections(1) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity({1, 0, 0, 0, 0, 0, 0, 0})}); + .setSignal({1, 0, 0, 0, 0, 0, 0, 0})}); data.addConnection(1, 2); data.add( @@ -1247,5 +1247,5 @@ TEST_F(SensorTests, scanNeighborhood_maxRange_notFound) auto actualData = _simulationFacade->getSimulationData(); auto actualSensorCell = getCell(actualData, 1); - EXPECT_TRUE(approxCompare(0.0f, actualSensorCell.activity.channels[0])); + EXPECT_TRUE(approxCompare(0.0f, actualSensorCell.signal.channels[0])); } diff --git a/source/EngineTests/TransmitterTests.cpp b/source/EngineTests/TransmitterTests.cpp index e0129abd1..24fc60cd0 100644 --- a/source/EngineTests/TransmitterTests.cpp +++ b/source/EngineTests/TransmitterTests.cpp @@ -66,17 +66,17 @@ TEST_F(TransmitterTests, distributeToOtherTransmitter) auto origNerveCell = getCell(data, 2); auto actualNerveCell = getCell(actualData, 2); - EXPECT_TRUE(approxCompare(0.0f, actualTransmitterCell1.activity.channels[0])); + EXPECT_TRUE(approxCompare(0.0f, actualTransmitterCell1.signal.channels[0])); EXPECT_TRUE(actualTransmitterCell1.energy < origTransmitterCell1.energy - NEAR_ZERO); EXPECT_TRUE(actualTransmitterCell2.energy > origTransmitterCell2.energy + NEAR_ZERO); EXPECT_TRUE(approxCompare(origNerveCell.energy, actualNerveCell.energy)); EXPECT_TRUE(approxCompare(getEnergy(data), getEnergy(actualData))); } -TEST_F(TransmitterTests, distributeToOneOtherTransmitter_forwardActivity) +TEST_F(TransmitterTests, distributeToOneOtherTransmitter_forwardSignal) { - ActivityDescription activity; - activity.setChannels({0.5f, -0.7f, 0, 0, 0, 0, 0, 0}); + SignalDescription signal; + signal.setChannels({0.5f, -0.7f, 0, 0, 0, 0, 0, 0}); DataDescription data; data.addCells({ @@ -94,7 +94,7 @@ TEST_F(TransmitterTests, distributeToOneOtherTransmitter_forwardActivity) .setMaxConnections(2) .setExecutionOrderNumber(5) .setCellFunction(NerveDescription()) - .setActivity(activity), + .setSignal(signal), CellDescription().setId(3).setPos({9.0f, 10.0f}).setMaxConnections(1).setExecutionOrderNumber(1).setCellFunction(TransmitterDescription()), }); data.addConnection(1, 2); @@ -115,7 +115,7 @@ TEST_F(TransmitterTests, distributeToOneOtherTransmitter_forwardActivity) auto actualNerveCell = getCell(actualData, 2); for (int i = 0; i < MAX_CHANNELS; ++i) { - EXPECT_TRUE(approxCompare(activity.channels[i], actualTransmitterCell1.activity.channels[i])); + EXPECT_TRUE(approxCompare(signal.channels[i], actualTransmitterCell1.signal.channels[i])); } EXPECT_TRUE(actualTransmitterCell1.energy < origTransmitterCell1.energy - NEAR_ZERO); EXPECT_TRUE(actualTransmitterCell2.energy > origTransmitterCell2.energy + NEAR_ZERO); diff --git a/source/Gui/GettingStartedWindow.cpp b/source/Gui/GettingStartedWindow.cpp index 2a7620320..6e2dd5599 100644 --- a/source/Gui/GettingStartedWindow.cpp +++ b/source/Gui/GettingStartedWindow.cpp @@ -155,7 +155,7 @@ void GettingStartedWindow::processIntern() drawHeading2("Cell"); ImGui::Text( "Cells are the basic building blocks that make up everything. They can be connected to each others, possibly attached to the background " - "(to model barriers), possess special functions and transport activity values. Additionally, cells have various physical properties, including"); + "(to model barriers), possess special functions and transport signals. Additionally, cells have various physical properties, including"); drawItemText("Position in space"); drawItemText("Velocity"); drawItemText("Internal energy (may be interpreted as its temperature)"); @@ -174,33 +174,33 @@ void GettingStartedWindow::processIntern() drawHeading2("Cell function"); ImGui::Text("It is possible to assign a special function to a cell, which will be executed at regular time intervals. The following functions are " "implemented:"); - drawItemText("Neuron: It equips the cell with a small network of 8 neurons. It processes input gained from the activity states of connected cells and provides an " - "output to other connected cells."); + drawItemText("Neuron: It equips the cell with a small network of 8 neurons. It processes input gained from the signals of connected cells and provides an " + "output signal to other connected cells."); drawItemText( "Transmitter: It distributes energy to other constructors, transmitters or surrounding cells. In particular, it can be used to power active " - "constructors. No activity is required for triggering."); + "constructors. No signal is required for triggering."); drawItemText("Constructor: A constructor can build a cell network based on a built-in genome. The construction is done cell by cell and requires " - "energy. A constructor can either be controlled via activities or become active automatically (default)."); + "energy. A constructor can either be controlled via signals or become active automatically (default)."); drawItemText("Injector: It can infect other constructor cells to inject its own built-in genome."); - drawItemText("Nerve: On the one hand, it transfers activity values from connected input cells and on the other hand, it can optionally generate " - "activity pulses at specific intervals."); + drawItemText("Nerve: On the one hand, it transfers signals from connected input cells and on the other hand, it can optionally generate " + "signals at specific intervals."); drawItemText("Attacker: It attacks surrounding cells from other cell networks by stealing energy from them."); drawItemText("Defender: It reduces the attack strength when another cell in the vicinity performs an attack."); drawItemText("Muscle: When a muscle cell is activated, it can produce either a movement, a bending or a change in length of the cell connection."); drawItemText("Sensor: If activated, it performs a long-range scan for the concentration of cells with a certain color."); drawItemText("Reconnector: Has the ability to dynamically create or destroy connections to other cells with a specified color."); drawItemText( - "Detonator: A cell which can explode by an activity signal. It generates a large amount of kinetic energy for the objects in its surroundings."); + "Detonator: A cell which can explode by a signal. It generates a large amount of kinetic energy for the objects in its surroundings."); ImGui::Spacing(); - drawHeading2("Activity states"); + drawHeading2("Signals"); drawParagraph( - "Cells contain activity states comprising of 8 values, primarily utilized for controlling cell functions and sometimes referred to as channel #0 " + "Cells can produce signals comprising of 8 values, primarily utilized for controlling cell functions and sometimes referred to as channel #0 " "to channel #7. The states are refreshed periodically, specifically when the cell functions are executed. To be more precise, each cell function " "is executed at regular time intervals (every 6 time steps). The 'execution order number' specifies the exact time offset within those intervals."); - drawParagraph("The process for updating the activity states is as follows: Firstly, the states of all connected cells that serve as input (i.e. " - "the connected cells which matches with the input execution number) are summed up. The resulted sum is then employed as input for " - "the cell function, which may potentially alter the values. Subsequently, the outcome is used to update the activity states."); + drawParagraph("The process for updating the values of a signal is as follows: Firstly, the values of all input signals (i.e. " + "signals from connected cells which matches with the input execution number) are summed up. The resulted sum is then employed as input for " + "the cell function, which may potentially alter the values. Subsequently, the outcome is used to generate an output signal."); ImGui::Spacing(); drawHeading2("Cell color"); @@ -328,7 +328,7 @@ void GettingStartedWindow::processIntern() drawHeading2("How does a simple self-replicating organism work?"); drawParagraph("In general, an organism in ALIEN consists of a network of cells where the cells work together by communicating with each other through " - "activity signals."); + "signals."); drawParagraph( "A simple creature first needs a constructor cell that contains its genome and is responsible for self-replication. The constructor cell " "is automatically triggered and generates (as soon as enough energy is available) the cell network of the offspring built cell by cell as described in " @@ -337,11 +337,11 @@ void GettingStartedWindow::processIntern() "Self-replication requires energy, which must be obtained in some way. On the one hand, energy can be acquired by the absorption of " "energy particles flying around. This can be the main source of energy for plant-like species. On the other hand, there is the possibility to utilize " "attacker cells. They can attack cells from other organisms by stealing energy from them. If an attacker cell is part of the creature, it must be " - "explicitly triggered by an activity signal. This signal may come, for example, from another cell equipped with a neural network. The energy " + "explicitly triggered by a signal. This signal may come, for example, from another cell equipped with a neural network. The energy " "obtained by an attacker cell is distributed to nearby constructor or transmitter cells."); - drawParagraph("To perform movements, an organism requires muscle cells. These are also controlled by activity signals. Muscle cells can work in " + drawParagraph("To perform movements, an organism requires muscle cells. These are also controlled by signals. Muscle cells can work in " "various modes: they can bend, contract/expand, or generate an impulse."); - drawParagraph("For the perception of the environment, sensor cells are available. When such a cell is triggered by activity signals, it provide " + drawParagraph("For the perception of the environment, sensor cells are available. When such a cell is triggered by a signal, it provide " "information about the relative position of cell concentrations with respect to a specific color, which can be further processed by e.g. " "cell with neural network."); @@ -372,13 +372,13 @@ void GettingStartedWindow::processIntern() "parameter window. Next, set the amount of energy to be added (for instance, 1M could sustain 10K cells if each cell has 100 energy " "units). The external energy is not added instantly but at a rate that can be specified under 'inflow'."); - drawHeading2("How can I create a cell activity in the first place?"); - drawParagraph("To activate a cell function, an input from a connected cell in the form of non-zero activity states is required. The simplest methods " - "to generate an non-zero activity state are as follows:"); - drawItemText("The most direct approach involves using a nerve cell that generates an activity pulse at regular time intervals. The advantage here is that " + drawHeading2("How can I create a cell signal in the first place?"); + drawParagraph("To activate most cell functions, an input from a connected cell in the form of a signal is required. The simplest methods " + "to generate a signal are as follows:"); + drawItemText("The most direct approach involves using a nerve cell that generates an signal at regular time intervals. The advantage here is that " "you can precisely configure the length of the time intervals."); - drawItemText("Activities can also be generated within a neuron cell using bias values."); - drawParagraph("Additionally, other cells such as constructor cells provide an activity output as soon as they are triggered (automatically)."); + drawItemText("Signals can also be generated within a neuron cell using bias values."); + drawParagraph("Additionally, other cells such as constructor cells provide an output signal as soon as they are triggered (automatically)."); //ImGui::Text("There is a lot to explore. ALIEN features an extensive graph and particle editor in order to build custom worlds with desired " // "environmental structures and machines. A documentation with tutorial-like introductions to various topics can be found at"); diff --git a/source/Gui/HelpStrings.h b/source/Gui/HelpStrings.h index 8996d6216..dc2e6c19d 100644 --- a/source/Gui/HelpStrings.h +++ b/source/Gui/HelpStrings.h @@ -35,8 +35,8 @@ namespace Const "Transmitter cells are designed to transport energy. This is important, for example, to supply constructor cells with energy or to " "support attacked cells. The energy transport works as follows: A part of the excess energy of the own cell and the directly connected " "cells is collected and transferred to other cells in the vicinity. A cell has excess energy when it exceeds a defined normal value (see " - "simulation parameter 'Normal energy' in 'Cell life cycle'). Transmitter cells do not need an activation but they also transport the " - "activity states from input."; + "simulation parameter 'Normal energy' in 'Cell life cycle'). Transmitter cells do not need an activation but they can transport " + "signals received from their input."; std::string const ConstructorTooltip = "A constructor cell builds a cell network according to a contained genome. The construction process takes place cell by " @@ -52,9 +52,9 @@ namespace Const "of the last match (0 = far away, 1 = close)\n\n" ICON_FA_CHEVRON_RIGHT " Output channel #3: angle of the last match"; std::string const NerveTooltip = - "By default, a nerve cell forwards activity states by receiving activity as input from connected cells (and summing it if " - "there are multiple cells) and directly providing it as output to other cells. Independently of this, one can specify " - "that it also generates an activity pulse in channel #0 at regular intervals. This can be used to trigger other sensor cells, " + "By default, a nerve cell forwards signals from connected cells (and summing it up if " + "there are multiple such cells) and thus directly providing it as input to other cells. Independently of this, one can specify " + "that it also generates a signal in channel #0 at regular intervals. This can be used to trigger other sensor cells, " "attacker cells, etc."; std::string const AttackerTooltip = @@ -94,7 +94,7 @@ namespace Const "Cells can possess a specific function that enables them to, for example, perceive their environment, process information, or " "take action. All cell functions have in common that they obtain the input from connected cells whose execution number matches the input " "execution number of the current cell. For this purpose, each channel from #0 to #7 of those cells is summed and the result is written " - "to the channel from #0 to #7 of the current cell. In particular, if there is only one input cell, its activity is simply forwarded. After " + "to the channel from #0 to #7 of the current cell. In particular, if there is only one input cell, its signal is simply forwarded. After " "the execution of a cell function, some channels will be then overriden by the output of the corresponding cell function.\n\nIMPORTANT: If " "you choose a cell function, this tooltip will be updated to provide more specific information. "; @@ -121,13 +121,12 @@ namespace Const std::string const GenomeInputExecutionNumberTooltip = "A functioning organism requires cells to collaborate. This can involve sensor cells that perceive the environment, neuron cells that " - "process information, muscle cells that perform movements, and so on. These various cell functions often require input and produce an " - "output. Both input and output are based on the cell's activity states. The process for updating is performed in two steps:\n\n1) When a " - "cell function is executed, the activity states are first updated. This involves reading the activity states of all connected cells " - "whose 'execution number' matches the specified 'input execution number', summing them up, and then setting the result to the " - "activity states for the considered cell.\n\n2) The cell function is executed and can use the cell's activity states as input. " - "The output is used to update the activity states again.\n\nSetting an 'input execution number' is optional. If none is set, the cell can " - "receive no input."; + "process information, muscle cells that perform movements, and so on. These various cell functions often require input signals and produce " + "output signals. The process for updating a cell signal is performed in two steps:\n\n1) When a " + "cell function is executed, an input signal will firstly be calculated. This involves reading the signals of all connected cells " + "whose 'execution number' matches the specified 'input execution number' and summing their values up.\n\n2) The cell function is executed and can use " + "the calculated signal as input. The cell then provides an output in form of an output signal.\n\nSetting an 'input execution number' is optional. If " + "none is set, the cell can receive no input signals."; std::string const GenomeBlockOutputTooltip = "Activating this toggle, the cell's output can be locked, preventing any other cell from utilizing it as input."; @@ -164,8 +163,8 @@ namespace Const std::string const GenomeConstructorActivationModeTooltip = "There are 2 modes available for controlling constructor cells:\n\n" ICON_FA_CHEVRON_RIGHT " Manual: The construction process is only triggered when " - "there is activity in channel #0.\n\n" ICON_FA_CHEVRON_RIGHT " Automatic: The construction process is automatically triggered at regular intervals. " - "Activity in channel #0 is not necessary.\n\n In both cases, if there is not enough energy available for the cell being " + "there is signal in channel #0.\n\n" ICON_FA_CHEVRON_RIGHT " Automatic: The construction process is automatically triggered at regular intervals. " + "Signal in channel #0 is not necessary.\n\n In both cases, if there is not enough energy available for the cell being " "created, the construction process will pause until the next triggering."; std::string const GenomeConstructorIntervalTooltip = @@ -194,7 +193,7 @@ namespace Const std::string const GenomeSensorScanAngleTooltip = "The angle in which direction the scanning process should take place can be determined here. An angle of 0 means that the " - "scan will be performed in the direction derived from the input cell (the cell from which the activity input originates) " + "scan will be performed in the direction derived from the input cell (the cell from which the input signal originates) " "towards the sensor cell."; std::string const GenomeSensorScanColorTooltip = "Restricts the sensor so that it only scans cells with a certain color."; @@ -216,15 +215,15 @@ namespace Const std::string const GenomeSensorMinRangeTooltip = "If activated, the sensor detects only objects with a distance equal or greater than the specified value."; std::string const GenomeSensorMaxRangeTooltip = "If activated, the sensor detects only objects with a distance equal or less than the specified value."; - std::string const GenomeNerveGeneratePulsesTooltip = "If enabled, an activity pulse in channel #0 will be generated at regular time intervals."; + std::string const GenomeNerveGeneratePulsesTooltip = "If enabled, a signal in channel #0 will be generated at regular time intervals."; std::string const GenomeNervePulseIntervalTooltip = "The intervals between two pulses can be set here. It is specified in cycles, which corresponds to 6 time steps each."; std::string const GenomeNerveAlternatingPulsesTooltip = "By default, the generated pulses consist of a positive value in channel #0. When 'Alternating pulses' is enabled, the " - "sign of this value alternates at specific time intervals. This can be used, for example, to easily create activity " - "signals for back-and-forth movements or bending in muscle cells."; + "sign of this value alternates at specific time intervals. This can be used, for example, to easily create signals for back-and-forth movements or " + "bending in muscle cells."; std::string const GenomeNervePulsesPerPhaseTooltip = "This value indicates the number of pulses until the sign will be changed in channel #0."; diff --git a/source/Gui/InspectorWindow.cpp b/source/Gui/InspectorWindow.cpp index 6423763f4..1ca932b71 100644 --- a/source/Gui/InspectorWindow.cpp +++ b/source/Gui/InspectorWindow.cpp @@ -30,7 +30,7 @@ namespace auto const CellFunctionTextWidth = 195.0f; auto const CellFunctionDefenderWidth = 100.0f; auto const CellFunctionBaseTabTextWidth = 150.0f; - auto const ActivityTextWidth = 130.0f; + auto const SignalTextWidth = 130.0f; auto const GenomeTabTextWidth = 195.0f; auto const ParticleContentTextWidth = 80.0f; @@ -290,11 +290,11 @@ void _InspectorWindow::processCellFunctionTab(CellDescription& cell) ImGui::TreePop(); } } - if (ImGui::TreeNodeEx("Activity states", TreeNodeFlags)) { + if (ImGui::TreeNodeEx("Signals", TreeNodeFlags)) { int index = 0; - for (auto& channel : cell.activity.channels) { + for (auto& channel : cell.signal.channels) { AlienImGui::InputFloat( - AlienImGui::InputFloatParameters().name("Channel #" + std::to_string(index)).format("%.3f").step(0.1f).textWidth(ActivityTextWidth), + AlienImGui::InputFloatParameters().name("Channel #" + std::to_string(index)).format("%.3f").step(0.1f).textWidth(SignalTextWidth), channel); ++index; } diff --git a/source/PersisterInterface/AuxiliaryDataParserService.cpp b/source/PersisterInterface/AuxiliaryDataParserService.cpp index 125209dc4..4907c369c 100644 --- a/source/PersisterInterface/AuxiliaryDataParserService.cpp +++ b/source/PersisterInterface/AuxiliaryDataParserService.cpp @@ -315,8 +315,8 @@ namespace parserTask); ParameterParser::encodeDecode( tree, - parameters.cellFunctionConstructorActivityThreshold, - defaultParameters.cellFunctionConstructorActivityThreshold, + parameters.cellFunctionConstructorSignalThreshold, + defaultParameters.cellFunctionConstructorSignalThreshold, "simulation parameters.cell.function.constructor.activity threshold", parserTask); ParameterParser::encodeDecode( @@ -462,8 +462,8 @@ namespace parserTask); ParameterParser::encodeDecode( tree, - parameters.cellFunctionAttackerActivityThreshold, - defaultParameters.cellFunctionAttackerActivityThreshold, + parameters.cellFunctionAttackerSignalThreshold, + defaultParameters.cellFunctionAttackerSignalThreshold, "simulation parameters.cell.function.attacker.activity threshold", parserTask); ParameterParser::encodeDecode( @@ -619,8 +619,8 @@ namespace parserTask); ParameterParser::encodeDecode( tree, - parameters.cellFunctionSensorActivityThreshold, - defaultParameters.cellFunctionSensorActivityThreshold, + parameters.cellFunctionSensorSignalThreshold, + defaultParameters.cellFunctionSensorSignalThreshold, "simulation parameters.cell.function.sensor.activity threshold", parserTask); @@ -632,8 +632,8 @@ namespace parserTask); ParameterParser::encodeDecode( tree, - parameters.cellFunctionReconnectorActivityThreshold, - defaultParameters.cellFunctionReconnectorActivityThreshold, + parameters.cellFunctionReconnectorSignalThreshold, + defaultParameters.cellFunctionReconnectorSignalThreshold, "simulation parameters.cell.function.reconnector.activity threshold", parserTask); @@ -651,8 +651,8 @@ namespace parserTask); ParameterParser::encodeDecode( tree, - parameters.cellFunctionDetonatorActivityThreshold, - defaultParameters.cellFunctionDetonatorActivityThreshold, + parameters.cellFunctionDetonatorSignalThreshold, + defaultParameters.cellFunctionDetonatorSignalThreshold, "simulation parameters.cell.function.detonator.activity threshold", parserTask); diff --git a/source/PersisterInterface/SerializerService.cpp b/source/PersisterInterface/SerializerService.cpp index 232564130..0e3611350 100644 --- a/source/PersisterInterface/SerializerService.cpp +++ b/source/PersisterInterface/SerializerService.cpp @@ -124,9 +124,9 @@ namespace auto constexpr Id_Cell_GenomeComplexity = 17; //auto constexpr Id_Cell_AncestorMutationId = 18; auto constexpr Id_Cell_DetectedByCreatureId = 19; - auto constexpr Id_Cell_Activity_Origin = 20; - auto constexpr Id_Cell_Activity_TargetX = 21; - auto constexpr Id_Cell_Activity_TargetY = 22; + auto constexpr Id_Cell_Signal_Origin = 20; + auto constexpr Id_Cell_Signal_TargetX = 21; + auto constexpr Id_Cell_Signal_TargetY = 22; auto constexpr Id_Neuron_ActivationFunctions = 0; @@ -540,11 +540,11 @@ namespace cereal } template - void loadSave(SerializationTask task, Archive& ar, ActivityDescription& data) + void loadSave(SerializationTask task, Archive& ar, SignalDescription& data) { ar(data.channels); } - SPLIT_SERIALIZATION(ActivityDescription) + SPLIT_SERIALIZATION(SignalDescription) template void loadSave(SerializationTask task, Archive& ar, NeuronDescription& data) @@ -804,12 +804,12 @@ namespace cereal loadSave(task, auxiliaries, Id_Cell_GenomeComplexity, data.genomeComplexity, defaultObject.genomeComplexity); loadSave(task, auxiliaries, Id_Cell_DetectedByCreatureId, data.detectedByCreatureId, defaultObject.detectedByCreatureId); loadSave(task, auxiliaries, Id_Cell_CellFunctionUsed, data.cellFunctionUsed, defaultObject.cellFunctionUsed); - loadSave(task, auxiliaries, Id_Cell_Activity_Origin, data.activity.origin, defaultObject.activity.origin); - loadSave(task, auxiliaries, Id_Cell_Activity_TargetX, data.activity.targetX, defaultObject.activity.targetX); - loadSave(task, auxiliaries, Id_Cell_Activity_TargetY, data.activity.targetY, defaultObject.activity.targetY); + loadSave(task, auxiliaries, Id_Cell_Signal_Origin, data.signal.origin, defaultObject.signal.origin); + loadSave(task, auxiliaries, Id_Cell_Signal_TargetX, data.signal.targetX, defaultObject.signal.targetX); + loadSave(task, auxiliaries, Id_Cell_Signal_TargetY, data.signal.targetY, defaultObject.signal.targetY); processLoadSaveMap(task, ar, auxiliaries); - ar(data.id, data.connections, data.pos, data.vel, data.energy, data.maxConnections, data.cellFunction, data.activity, data.metadata); + ar(data.id, data.connections, data.pos, data.vel, data.energy, data.maxConnections, data.cellFunction, data.signal, data.metadata); //compatibility with older versions //>>>