...
 
Commits (1)
......@@ -350,7 +350,7 @@ namespace TRC
{
std::list<Entity*> u;
std::string *n;
char c[3];
char c[4];
friend class System;
......@@ -361,6 +361,7 @@ namespace TRC
apply(init);
c[0] = c[1];
c[2] = c[0];
c[3] = c[0];
}
public:
......@@ -368,7 +369,7 @@ namespace TRC
Connection(const char *s)
{
n = new std::string(s);
c[0] = c[1] = c[2] = NC;
c[0] = c[1] = c[2] = c[3] = NC;
}
~Connection()
......@@ -383,16 +384,22 @@ namespace TRC
void prepare()
{
c[3] = c[2];
c[2] = c[1];
c[1] = c[0];
}
bool transition(char before, char now)
{
if(c[1]==now && c[2]==before) return true;
if(c[2]==now && c[3]==before) return true;
return false;
}
int read_past()
{
return c[3];
}
int read()
{
return c[2];
......
#include <TRCMath.hpp>
#undef DEBUG
//#undef DEBUG
#include <time.h>
#include <stdio.h>
......@@ -78,7 +78,7 @@ class World : public Entity
counter = 0;
}
void step() // test cases
void step() // World works backwards - read outputs and write inputs
{
Wire<9> vec; // temporary vector
vec[8] = io(i_output+0).read();
......