Commit 7f41f2e7 authored by Malte Heithoff's avatar Malte Heithoff
Browse files

Bug with test

parent 7bfc64ed
Pipeline #117631 failed with stages
in 9 minutes and 44 seconds
package de.rwth.pacman.heithoff2.BFS;
import de.rwth.pacman.heithoff2.BFS.single.*;
// Pacman.WALL = 0;
// Pacman.BISCUIT = 1;
// Pacman.EMPTY = 2;
// Pacman.BLOCK = 3;
// Pacman.PILL = 4;
// check whether the current tile is safe and then calculate the next tile position
component BFSSingle {
ports
in Q(0m: 20m) ghostX[4],
in Q(1m: 23m) ghostY[4],
in Z(0 : 1 : 3) ghostDirection[4],
in B ghostEatable[4],
in Z^{22,19} map,
in Q(0m: 20m) currentX,
in Q(1m: 23m) currentY,
in Q(0m: 20m) oldX,
in Q(1m: 23m) oldY,
in B oldSafe,
in B oldSafeFound,
in Z oldDirection,
out Q(0m: 20m) newX,
out Q(1m: 23m) newY,
out B safeFound,
out B safe,
out Z newDirection;
// sadly this doesnt work, due to some bugs in emam2wasm. Concept is still correct
// should get fixed, soon
instance ControlFlow control;
instance ReenterMap reenterMap;
instance SearchFinished searchFinished;
instance SafePosition safePosition;
instance CalcNewPosition calcNewPosition;
connect currentX -> reenterMap.currentX;
connect currentY -> reenterMap.currentY;
connect oldX -> reenterMap.oldX;
connect oldY -> reenterMap.oldY;
connect reenterMap.newCurrentX -> searchFinished.currentX, safePosition.currentX, calcNewPosition.currentX, control.currentX;
connect reenterMap.newCurrentY -> searchFinished.currentY, safePosition.currentY, calcNewPosition.currentY, control.currentY;
connect map -> searchFinished.map, calcNewPosition.map;
connect oldSafe -> searchFinished.oldSafe;
connect oldSafeFound -> searchFinished.oldSafeFound;
connect ghostX[:] -> safePosition.ghostX[:];
connect ghostY[:] -> safePosition.ghostY[:];
connect ghostDirection[:] -> safePosition.ghostDirection[:];
connect ghostEatable[:] -> safePosition.ghostEatable[:];
connect oldDirection -> safePosition.oldDirection, control.oldDirection;
connect reenterMap.newOldX -> calcNewPosition.oldX;
connect reenterMap.newOldY -> calcNewPosition.oldY;
connect searchFinished.finished -> calcNewPosition.searchFinished;
connect safePosition.safe -> calcNewPosition.positionIsSafe;
connect searchFinished.finished -> control.searchFinished;
connect searchFinished.safe -> control.safeFromSearchFinished;
connect searchFinished.safeFound -> control.safeFoundFromSearchFinished;
connect safePosition.safe -> control.positionIsSafe;
connect calcNewPosition.safeFound -> control.safeFoundFromNewPosition;
connect calcNewPosition.newX -> control.newXFromNewPosition;
connect calcNewPosition.newY -> control.newYFromNewPosition;
connect calcNewPosition.newDirection -> control.newDirectionFromNewPosition;
connect control.newX -> newX;
connect control.newY -> newY;
connect control.safeFound -> safeFound;
connect control.safe -> safe;
connect control.newDirection -> newDirection;
// implementation Math {
// // reenter the map
// if currentX < 2
// currentX = 18;
// oldX = 19;
// elseif currentX > 18
// currentX = 2;
// oldX = 1;
// end
// newDirection = oldDirection;
// newX = currentX;
// newY = currentY;
// Z currentTile = map(currentY, currentX);
// if (currentTile == 0) || (currentTile == 3) // begin within a wall-tile, nothing to check
// safeFound = 1;
// safe = 1;
// elseif (oldSafeFound == 1) || (oldSafe == 0) // already at an intersection or a ghost was found
// safeFound = oldSafeFound;
// safe = oldSafe;
// else
// safe = 1;
// safeFound = 0;
// // check whether the current tile is safe
// for i = 1:4
// Z xG = round(ghostX(i) + 1);
// Z yG = round(ghostY(i) + 1);
// if (abs(xG - currentX) < 1) && (abs(yG - currentY) < 1) && (ghostEatable(i) == 0) && (ghostDirection(i) != oldDirection)
// safe = 0;
// end
// end
// if (safe == 1)
// // check for intersection or calculate the next tile
// Z^{1,4} xOffSet = [0,0,-1,1];
// Z^{1,4} yOffSet = [-1,1,0,0];
// Z newPathsFound = 0;
// for i = 0:3
// Z indexY = 1;
// Z indexX = i + 1;
// Z xOff = xOffSet(indexY, indexX);
// Z yOff = yOffSet(indexY, indexX);
// Q xT = currentX + xOff;
// Q yT = currentY + yOff;
// if (abs(xT - (oldX)) >= 1) || (abs(yT - (oldY)) >= 1)
// Z nextTile = map(yT, xT);
// if (nextTile != 0) && (nextTile != 3) // a non-blocking tile was found
// newPathsFound = newPathsFound + 1;
// newX = xT;
// newY = yT;
// newDirection = i;
// if newPathsFound > 1
// safeFound = 1;
// newX = currentX;
// newY = currentY;
// end
// end
// end
// end
// end
// end
// }
}
\ No newline at end of file
package de.rwth.pacman.heithoff2.BFS;
import de.rwth.pacman.heithoff2.BFS.start.StartValues;
// search along the current path whether there are ghosts facing to pacman
// bfssingle1 is given the start values which then calculates the next coordinates
// for bffsingle2
// the path ends when an intersection is reached
// then check again whether the surrounding tiles are safe
component BFSearch{
ports
in Q(0m: 20m) ghostX[4],
in Q(1m: 23m) ghostY[4],
in Q(0m: 20m) pacManX,
in Q(1m: 23m) pacManY,
in Z(0 : 1 : 3) ghostDirection[4],
in B ghostEatable[4],
in Z^{22,19} map,
in Q(0m: 20m) startX,
in Q(1m: 23m) startY,
in Z startDirection,
// out B safeFound,
// out Q newX,
// out Q newY,
// out B oldSafe,
out B safe;
instance StartValues start;
instance BFSSingle bfssingle1;
instance BFSSingle bfssingle2;
instance BFSSingle bfssingle3;
instance BFSSingle bfssingle4;
instance BFSSingle bfssingle5;
instance BFSSingle bfssingle6;
instance BFSSingle bfssingle7;
instance BFSSingle bfssingle8;
instance BFSSingle bfssingle9;
instance BFSSingle bfssingl9;
instance EndSafe endSafe;
connect pacManX -> bfssingle1.oldX;
connect pacManY -> bfssingle1.oldY;
connect startX -> bfssingle1.currentX, bfssingle2.oldX;
connect startY -> bfssingle1.currentY, bfssingle2.oldY;
connect start.startSafe -> bfssingle1.oldSafe;
connect start.startSafeFound -> bfssingle1.oldSafeFound;
connect startDirection -> bfssingle1.oldDirection;
// connect bfssingl9.newX -> newX;
// connect bfssingl9.newY -> newY;
// connect bfssingl9.safe -> oldSafe;
// connect bfssingl9.safeFound -> safeFound;
connect bfssingle1.newX -> bfssingle2.currentX, bfssingle3.oldX;
connect bfssingle1.newY -> bfssingle2.currentY, bfssingle3.oldY;
connect bfssingle1.safe -> bfssingle2.oldSafe;
connect bfssingle1.safeFound -> bfssingle2.oldSafeFound;
connect bfssingle1.newDirection -> bfssingle2.oldDirection;
connect bfssingle2.newX -> bfssingle3.currentX, bfssingle4.oldX;
connect bfssingle2.newY -> bfssingle3.currentY, bfssingle4.oldY;
connect bfssingle2.safe -> bfssingle3.oldSafe;
connect bfssingle2.safeFound -> bfssingle3.oldSafeFound;
connect bfssingle2.newDirection -> bfssingle3.oldDirection;
connect bfssingle3.newX -> bfssingle4.currentX, bfssingle5.oldX;
connect bfssingle3.newY -> bfssingle4.currentY, bfssingle5.oldY;
connect bfssingle3.safe -> bfssingle4.oldSafe;
connect bfssingle3.safeFound -> bfssingle4.oldSafeFound;
connect bfssingle3.newDirection -> bfssingle4.oldDirection;
connect bfssingle4.newX -> bfssingle5.currentX, bfssingle6.oldX;
connect bfssingle4.newY -> bfssingle5.currentY, bfssingle6.oldY;
connect bfssingle4.safe -> bfssingle5.oldSafe;
connect bfssingle4.safeFound -> bfssingle5.oldSafeFound;
connect bfssingle4.newDirection -> bfssingle5.oldDirection;
connect bfssingle5.newX -> bfssingle6.currentX, bfssingle7.oldX;
connect bfssingle5.newY -> bfssingle6.currentY, bfssingle7.oldY;
connect bfssingle5.safe -> bfssingle6.oldSafe;
connect bfssingle5.safeFound -> bfssingle6.oldSafeFound;
connect bfssingle5.newDirection -> bfssingle6.oldDirection;
connect bfssingle6.newX -> bfssingle7.currentX, bfssingle8.oldX;
connect bfssingle6.newY -> bfssingle7.currentY, bfssingle8.oldY;
connect bfssingle6.safe -> bfssingle7.oldSafe;
connect bfssingle6.safeFound -> bfssingle7.oldSafeFound;
connect bfssingle6.newDirection -> bfssingle7.oldDirection;
connect bfssingle7.newX -> bfssingle8.currentX, bfssingle9.oldX;
connect bfssingle7.newY -> bfssingle8.currentY, bfssingle9.oldY;
connect bfssingle7.safe -> bfssingle8.oldSafe;
connect bfssingle7.safeFound -> bfssingle8.oldSafeFound;
connect bfssingle7.newDirection -> bfssingle8.oldDirection;
connect bfssingle8.newX -> bfssingle9.currentX, bfssingl9.oldX;
connect bfssingle8.newY -> bfssingle9.currentY, bfssingl9.oldY;
connect bfssingle8.safe -> bfssingle9.oldSafe;
connect bfssingle8.safeFound -> bfssingle9.oldSafeFound;
connect bfssingle8.newDirection -> bfssingle9.oldDirection;
connect bfssingle9.newX -> bfssingl9.currentX;
connect bfssingle9.newY -> bfssingl9.currentY;
connect bfssingle9.safe -> bfssingl9.oldSafe;
connect bfssingle9.safeFound -> bfssingl9.oldSafeFound;
connect bfssingle9.newDirection -> bfssingl9.oldDirection;
connect bfssingl9.newX -> endSafe.currentX;
connect bfssingl9.newY -> endSafe.currentY;
connect bfssingl9.safe -> endSafe.oldSafe;
connect bfssingl9.safeFound -> endSafe.oldSafeFound;
connect bfssingl9.newDirection -> endSafe.oldDirection;
connect endSafe.safe -> safe;
connect ghostX[:] -> bfssingle1.ghostX[:];
connect ghostX[:] -> bfssingle2.ghostX[:];
connect ghostX[:] -> bfssingle3.ghostX[:];
connect ghostX[:] -> bfssingle4.ghostX[:];
connect ghostX[:] -> bfssingle5.ghostX[:];
connect ghostX[:] -> bfssingle6.ghostX[:];
connect ghostX[:] -> bfssingle7.ghostX[:];
connect ghostX[:] -> bfssingle8.ghostX[:];
connect ghostX[:] -> bfssingle9.ghostX[:];
connect ghostX[:] -> bfssingl9.ghostX[:];
connect ghostX[:] -> endSafe.ghostX[:];
connect ghostY[:] -> bfssingle1.ghostY[:];
connect ghostY[:] -> bfssingle2.ghostY[:];
connect ghostY[:] -> bfssingle3.ghostY[:];
connect ghostY[:] -> bfssingle4.ghostY[:];
connect ghostY[:] -> bfssingle5.ghostY[:];
connect ghostY[:] -> bfssingle6.ghostY[:];
connect ghostY[:] -> bfssingle7.ghostY[:];
connect ghostY[:] -> bfssingle8.ghostY[:];
connect ghostY[:] -> bfssingle9.ghostY[:];
connect ghostY[:] -> bfssingl9.ghostY[:];
connect ghostY[:] -> endSafe.ghostY[:];
connect ghostDirection[:] -> bfssingle1.ghostDirection[:];
connect ghostDirection[:] -> bfssingle2.ghostDirection[:];
connect ghostDirection[:] -> bfssingle3.ghostDirection[:];
connect ghostDirection[:] -> bfssingle4.ghostDirection[:];
connect ghostDirection[:] -> bfssingle5.ghostDirection[:];
connect ghostDirection[:] -> bfssingle6.ghostDirection[:];
connect ghostDirection[:] -> bfssingle7.ghostDirection[:];
connect ghostDirection[:] -> bfssingle8.ghostDirection[:];
connect ghostDirection[:] -> bfssingle9.ghostDirection[:];
connect ghostDirection[:] -> bfssingl9.ghostDirection[:];
connect ghostDirection[:] -> endSafe.ghostDirection[:];
connect ghostEatable[:] -> bfssingle1.ghostEatable[:];
connect ghostEatable[:] -> bfssingle2.ghostEatable[:];
connect ghostEatable[:] -> bfssingle3.ghostEatable[:];
connect ghostEatable[:] -> bfssingle4.ghostEatable[:];
connect ghostEatable[:] -> bfssingle5.ghostEatable[:];
connect ghostEatable[:] -> bfssingle6.ghostEatable[:];
connect ghostEatable[:] -> bfssingle7.ghostEatable[:];
connect ghostEatable[:] -> bfssingle8.ghostEatable[:];
connect ghostEatable[:] -> bfssingle9.ghostEatable[:];
connect ghostEatable[:] -> bfssingl9.ghostEatable[:];
connect ghostEatable[:] -> endSafe.ghostEatable[:];
connect map -> bfssingle1.map;
connect map -> bfssingle2.map;
connect map -> bfssingle3.map;
connect map -> bfssingle4.map;
connect map -> bfssingle5.map;
connect map -> bfssingle6.map;
connect map -> bfssingle7.map;
connect map -> bfssingle8.map;
connect map -> bfssingle9.map;
connect map -> bfssingl9.map;
}
\ No newline at end of file
package de.rwth.pacman.heithoff2.BFS;
// check whether the surrounding tiles are safe
component EndSafe {
ports
in Q(0m: 20m) currentX,
in Q(1m: 23m) currentY,
in Q(0m: 20m) ghostX[4],
in Q(1m: 23m) ghostY[4],
in Z(0 : 1 : 3) ghostDirection[4],
in B ghostEatable[4],
in B oldSafe,
in B oldSafeFound,
in Z oldDirection,
out B safe;
implementation Math {
Z^{1,4} xOffSet = [0,0,-1,1];
Z^{1,4} yOffSet = [-1,1,0,0];
safe = 1;
if oldSafe
for i = 1:4
if (ghostEatable(i) == 0)
Z xG = round(ghostX(i) + 1);
Z yG = round(ghostY(i) + 1);
Z xC = currentX;
Z yC = currentY;
if (xG == xC) && (yG == yC)
safe = 0;
end
for j = 1:4
xC = currentX + xOffSet(1,j);
yC = currentY + yOffSet(1,j);
if (xG == xC) && (yG == yC) && (ghostEatable(i) == 0) && (ghostDirection(i) != j)
safe = 0;
end
end
end
end
else
safe = 0;
end
}
}
\ No newline at end of file
package de.rwth.pacman.heithoff2.BFS;
import de.rwth.pacman.heithoff2.BFS.start.*;
// check whether the four directions are safe to go
// a directions is not safe to go if there is a ghost on its path
component Paths {
ports
in Q(0m: 20m) ghostX[4],
in Q(1m: 23m) ghostY[4],
in Z(0 : 1 : 3) ghostDirection[4],
in B ghostEatable[4],
in Q(0m: 20m) pacManX,
in Q(1m: 23m) pacManY,
in Z^{22,19} map,
out B topSafe,
out B bottomSafe,
out B leftSafe,
out B rightSafe;
instance BFSearch searchLeft;
instance BFSearch searchRight;
instance BFSearch searchTop;
instance BFSearch searchBottom;
instance StartLeft startLeft;
instance StartRight startRight;
instance StartTop startTop;
instance StartBottom startBottom;
connect pacManX -> startLeft.pacManX, startRight.pacManX, startTop.pacManX, startBottom.pacManX;
connect pacManY -> startLeft.pacManY, startRight.pacManY, startTop.pacManY, startBottom.pacManY;
connect ghostX[:] -> searchLeft.ghostX[:], searchRight.ghostX[:], searchTop.ghostX[:], searchBottom.ghostX[:];
connect ghostY[:] -> searchLeft.ghostY[:], searchRight.ghostY[:], searchTop.ghostY[:], searchBottom.ghostY[:];
connect ghostDirection[:] -> searchLeft.ghostDirection[:], searchRight.ghostDirection[:], searchTop.ghostDirection[:], searchBottom.ghostDirection[:];
connect ghostEatable[:] -> searchLeft.ghostEatable[:], searchRight.ghostEatable[:], searchTop.ghostEatable[:], searchBottom.ghostEatable[:];
connect map -> searchLeft.map, searchRight.map, searchTop.map, searchBottom.map;
connect pacManX -> searchLeft.pacManX, searchRight.pacManX, searchTop.pacManX, searchBottom.pacManX;
connect pacManY -> searchLeft.pacManY, searchRight.pacManY, searchTop.pacManY, searchBottom.pacManY;
connect startLeft.startX -> searchLeft.startX;
connect startLeft.startY -> searchLeft.startY;
connect startLeft.startD -> searchLeft.startDirection;
connect startRight.startX -> searchRight.startX;
connect startRight.startY -> searchRight.startY;
connect startRight.startD -> searchRight.startDirection;
connect startTop.startX -> searchTop.startX;
connect startTop.startY -> searchTop.startY;
connect startTop.startD -> searchTop.startDirection;
connect startBottom.startX -> searchBottom.startX;
connect startBottom.startY -> searchBottom.startY;
connect startBottom.startD -> searchBottom.startDirection;
connect searchLeft.safe -> leftSafe;
connect searchRight.safe -> rightSafe;
connect searchTop.safe -> topSafe;
connect searchBottom.safe -> bottomSafe;
}
\ No newline at end of file
#ifndef DE_RWTH_PACMAN_PACMANWRAPPER_CONTROLLER_SAFEPATHS_SEARCHLEFT
#define DE_RWTH_PACMAN_PACMANWRAPPER_CONTROLLER_SAFEPATHS_SEARCHLEFT
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#include "armadillo"
#include "de_rwth_pacman_pacManWrapper_controller_safePaths_searchLeft_start.h"
#include "de_rwth_pacman_pacManWrapper_controller_safePaths_searchLeft_bfssingle1.h"
#include "de_rwth_pacman_pacManWrapper_controller_safePaths_searchLeft_bfssingle2.h"
#include "de_rwth_pacman_pacManWrapper_controller_safePaths_searchLeft_bfssingle3.h"
#include "de_rwth_pacman_pacManWrapper_controller_safePaths_searchLeft_bfssingle4.h"
#include "de_rwth_pacman_pacManWrapper_controller_safePaths_searchLeft_bfssingle5.h"
#include "de_rwth_pacman_pacManWrapper_controller_safePaths_searchLeft_bfssingle6.h"
#include "de_rwth_pacman_pacManWrapper_controller_safePaths_searchLeft_bfssingle7.h"
#include "de_rwth_pacman_pacManWrapper_controller_safePaths_searchLeft_bfssingle8.h"
#include "de_rwth_pacman_pacManWrapper_controller_safePaths_searchLeft_bfssingle9.h"
#include "de_rwth_pacman_pacManWrapper_controller_safePaths_searchLeft_bfssingl9.h"
#include "de_rwth_pacman_pacManWrapper_controller_safePaths_searchLeft_endSafe.h"
using namespace arma;
class de_rwth_pacman_pacManWrapper_controller_safePaths_searchLeft{
public:
double ghostX[4];
double ghostY[4];
double pacManX;
double pacManY;
int ghostDirection[4];
bool ghostEatable[4];
imat map;
double startX;
double startY;
int startDirection;
bool safe;
de_rwth_pacman_pacManWrapper_controller_safePaths_searchLeft_start start;
de_rwth_pacman_pacManWrapper_controller_safePaths_searchLeft_bfssingle1 bfssingle1;
de_rwth_pacman_pacManWrapper_controller_safePaths_searchLeft_bfssingle2 bfssingle2;
de_rwth_pacman_pacManWrapper_controller_safePaths_searchLeft_bfssingle3 bfssingle3;
de_rwth_pacman_pacManWrapper_controller_safePaths_searchLeft_bfssingle4 bfssingle4;
de_rwth_pacman_pacManWrapper_controller_safePaths_searchLeft_bfssingle5 bfssingle5;
de_rwth_pacman_pacManWrapper_controller_safePaths_searchLeft_bfssingle6 bfssingle6;
de_rwth_pacman_pacManWrapper_controller_safePaths_searchLeft_bfssingle7 bfssingle7;
de_rwth_pacman_pacManWrapper_controller_safePaths_searchLeft_bfssingle8 bfssingle8;
de_rwth_pacman_pacManWrapper_controller_safePaths_searchLeft_bfssingle9 bfssingle9;
de_rwth_pacman_pacManWrapper_controller_safePaths_searchLeft_bfssingl9 bfssingl9;
de_rwth_pacman_pacManWrapper_controller_safePaths_searchLeft_endSafe endSafe;
void init()
{
map=imat(22,19);
start.init();
bfssingle1.init();
bfssingle2.init();
bfssingle3.init();
bfssingle4.init();
bfssingle5.init();
bfssingle6.init();
bfssingle7.init();
bfssingle8.init();
bfssingle9.init();
bfssingl9.init();
endSafe.init();
}
void execute()
{
start.execute();
endSafe.currentX = bfssingl9.newX;
endSafe.currentY = bfssingl9.newY;
endSafe.oldSafe = bfssingl9.safe;
endSafe.oldSafeFound = bfssingl9.safeFound;
endSafe.oldDirection = bfssingl9.newDirection;
endSafe.ghostX[0] = ghostX[0];
endSafe.ghostX[1] = ghostX[1];
endSafe.ghostX[2] = ghostX[2];
endSafe.ghostX[3] = ghostX[3];
endSafe.ghostY[0] = ghostY[0];
endSafe.ghostY[1] = ghostY[1];
endSafe.ghostY[2] = ghostY[2];
endSafe.ghostY[3] = ghostY[3];
endSafe.ghostDirection[0] = ghostDirection[0];
endSafe.ghostDirection[1] = ghostDirection[1];
endSafe.ghostDirection[2] = ghostDirection[2];
endSafe.ghostDirection[3] = ghostDirection[3];
endSafe.ghostEatable[0] = ghostEatable[0];
endSafe.ghostEatable[1] = ghostEatable[1];
endSafe.ghostEatable[2] = ghostEatable[2];
endSafe.ghostEatable[3] = ghostEatable[3];
endSafe.execute();
bfssingle1.oldX = pacManX;
bfssingle1.oldY = pacManY;
bfssingle1.currentX = startX;
bfssingle1.currentY = startY;
bfssingle1.oldSafe = start.startSafe;
bfssingle1.oldSafeFound = start.startSafeFound;
bfssingle1.oldDirection = startDirection;
bfssingle1.ghostX[0] = ghostX[0];
bfssingle1.ghostX[1] = ghostX[1];
bfssingle1.ghostX[2] = ghostX[2];
bfssingle1.ghostX[3] = ghostX[3];
bfssingle1.ghostY[0] = ghostY[0];
bfssingle1.ghostY[1] = ghostY[1];
bfssingle1.ghostY[2] = ghostY[2];
bfssingle1.ghostY[3] = ghostY[3];
bfssingle1.ghostDirection[0] = ghostDirection[0];
bfssingle1.ghostDirection[1] = ghostDirection[1];
bfssingle1.ghostDirection[2] = ghostDirection[2];
bfssingle1.ghostDirection[3] = ghostDirection[3];
bfssingle1.ghostEatable[0] = ghostEatable[0];
bfssingle1.ghostEatable[1] = ghostEatable[1];
bfssingle1.ghostEatable[2] = ghostEatable[2];
bfssingle1.ghostEatable[3] = ghostEatable[3];
bfssingle1.map = map;
bfssingle1.execute();
bfssingle2.oldX = startX;
bfssingle2.oldY = startY;
bfssingle2.currentX = bfssingle1.newX;
bfssingle2.currentY = bfssingle1.newY;
bfssingle2.oldSafe = bfssingle1.safe;
bfssingle2.oldSafeFound = bfssingle1.safeFound;
bfssingle2.oldDirection = bfssingle1.newDirection;