diff --git a/src/Cycle.c b/src/Cycle.c
index b762d1bb..e2900214 100755
--- a/src/Cycle.c
+++ b/src/Cycle.c
@@ -154,7 +154,7 @@ void Cycle_PopEvents(Event *selectionArray, double *selectionPriority, int *sele
//{Event (a &/ b)!, Event a.} |- Event b! Truth_Deduction
//if Truth_Expectation(a) >= ANTICIPATION_THRESHOLD else
//{Event (a &/ b)!} |- Event a! Truth_StructuralDeduction
-bool Cycle_GoalSequenceDecomposition(Event *selectedGoal, double selectedGoalPriority, int layer)
+bool Cycle_GoalSequenceDecomposition(Event *selectedGoal, double selectedGoalPriority, int layer, long currentTime)
{
//1. Extract potential subgoals
if(!Narsese_copulaEquals(selectedGoal->term.atoms[0], SEQUENCE)) //left-nested sequence
@@ -276,7 +276,7 @@ static void Cycle_ProcessAndInferGoalEvents(long currentTime, int layer)
Event *goal = &selectedGoals[i];
IN_DEBUG( fputs("selected goal ", stdout); Narsese_PrintTerm(&goal->term); puts(""); )
//if goal is a sequence, overwrite with first deduced non-fulfilled element
- if(Cycle_GoalSequenceDecomposition(goal, selectedGoalsPriority[i], layer)) //the goal was a sequence which leaded to a subgoal derivation
+ if(Cycle_GoalSequenceDecomposition(goal, selectedGoalsPriority[i], layer, currentTime)) //the goal was a sequence which leaded to a subgoal derivation
{
continue;
}
@@ -340,7 +340,7 @@ static void Cycle_ProcessAndInferGoalEvents(long currentTime, int layer)
}
//Reinforce temporal implication link between a's and b's concept (via temporal induction)
-static Implication Cycle_ReinforceLink(Event *a, Event *b)
+static Implication Cycle_ReinforceLink(Event *a, Event *b, long currentTime)
{
if(a->type != EVENT_TYPE_BELIEF || b->type != EVENT_TYPE_BELIEF)
{
@@ -416,7 +416,7 @@ void Cycle_ProcessBeliefEvents(long currentTime)
//so now derive it
if(success5)
{
- Cycle_ReinforceLink(&seq_op_cur, &postcondition); //<(A &/ op) =/> B>
+ Cycle_ReinforceLink(&seq_op_cur, &postcondition, currentTime); //<(A &/ op) =/> B>
}
}
}
@@ -445,10 +445,10 @@ void Cycle_ProcessBeliefEvents(long currentTime)
{
if(!op_id && !op_id2)
{
- Cycle_ReinforceLink(&c->belief_spike, &postcondition); // B>, B>
+ Cycle_ReinforceLink(&c->belief_spike, &postcondition, currentTime); // B>, B>
if(c->belief_spike.occurrenceTime == postcondition.occurrenceTime)
{
- Cycle_ReinforceLink(&postcondition, &c->belief_spike); // A>
+ Cycle_ReinforceLink(&postcondition, &c->belief_spike, currentTime); // A>
}
}
int sequence_len = 0;
diff --git a/src/Decision.c b/src/Decision.c
index c7d0235c..8ae0c475 100755
--- a/src/Decision.c
+++ b/src/Decision.c
@@ -284,7 +284,7 @@ static Decision Decision_MotorBabbling()
return decision;
}
-static Decision Decision_ConsiderNegativeOutcomes(Decision decision)
+static Decision Decision_ConsiderNegativeOutcomes(Decision decision, long currentTime)
{
Event OpGoalImmediateOutcomes = {0};
//1. discount decision based on negative outcomes via revision
@@ -386,7 +386,7 @@ static Decision Decision_ConsiderImplication(long currentTime, Event *goal, Impl
i++;
}
}
- return Decision_ConsiderNegativeOutcomes(decision);
+ return Decision_ConsiderNegativeOutcomes(decision, currentTime);
}
Decision Decision_BestCandidate(Concept *goalconcept, Event *goal, long currentTime)
diff --git a/src/Decision.h b/src/Decision.h
index 292eba8f..2eb1edf6 100755
--- a/src/Decision.h
+++ b/src/Decision.h
@@ -51,7 +51,6 @@
#include
#include
#include "Memory.h"
-#include "NAR.h"
#include "Config.h"
//Parameters//
diff --git a/src/NAR.c b/src/NAR.c
index 6352b413..66530787 100755
--- a/src/NAR.c
+++ b/src/NAR.c
@@ -24,7 +24,7 @@
#include "NAR.h"
-long currentTime = 1;
+static long currentTime = 1; //This needs to be private to encourage the design of "pass in parameters rather than using global variables"
static bool initialized = false;
static int op_k = 0;
double QUESTION_PRIMING = QUESTION_PRIMING_INITIAL;
diff --git a/src/NAR.h b/src/NAR.h
index cec1acd2..9c26d6b4 100755
--- a/src/NAR.h
+++ b/src/NAR.h
@@ -41,7 +41,6 @@
//Parameters//
//----------//
#define NAR_DEFAULT_TRUTH ((Truth) { .frequency = NAR_DEFAULT_FREQUENCY, .confidence = NAR_DEFAULT_CONFIDENCE })
-extern long currentTime;
extern double QUESTION_PRIMING;
//Callback function types//