@@ -60,10 +60,11 @@ public void addThief(int thiefID) {
6060 for (int i = 0 ; i < N_THIEVES_PER_PARTY ; i ++) {
6161 if (thieves [i ] == null ) {
6262 thieves [i ] = new Mapping (thiefID , 0 );
63- //logger(this, "Added Ordinary " + thiefID);
6463 break ;
6564 }
6665 }
66+
67+
6768 }
6869
6970 /**
@@ -82,11 +83,11 @@ public Museum.Room getRoom() {
8283 * @param room Room object
8384 */
8485 public void setRoom (Museum .Room room ) {
85- logger (this , "Was given room " + room );
86- //GenericIO.writelnString(room + " has distance " + room.getDistance() + " and paintings " + room.getPaintings());
8786 this .room = room ;
8887 room .setAssaultPartyID (id );
8988 inRoom = 0 ;
89+ repos .setDistanceToRoom (room .getID (), room .getDistance ());
90+
9091
9192 }
9293
@@ -99,7 +100,7 @@ public void resetAssaultParty() {
99100 nextThiefID = -1 ;
100101 for (int i = 0 ; i < N_THIEVES_PER_PARTY ; i ++)
101102 thieves [i ] = null ;
102- //logger(this, "RESETED!");
103+
103104 }
104105
105106 /**
@@ -130,7 +131,6 @@ public synchronized void sendAssaultParty() {
130131 MasterThief masterThief = (MasterThief ) Thread .currentThread ();
131132 masterThief .setActiveAssaultParties (masterThief .getActiveAssaultParties () + 1 );
132133 masterThief .setPartyActive (id , true );
133- logger (this , "PARTY SENT" );
134134 begin = true ;
135135 notifyAll ();
136136
@@ -182,6 +182,7 @@ private boolean sleep(int thiefID) {
182182 public synchronized void crawlIn () {
183183 OrdinaryThief ordinaryThief = (OrdinaryThief ) Thread .currentThread ();
184184 ordinaryThief .setThiefState (OrdinaryThiefStates .CRAWLING_INWARDS );
185+ repos .setOrdinaryThiefState (ordinaryThief .getThiefID (), OrdinaryThiefStates .CRAWLING_INWARDS );
185186 int thiefID = ordinaryThief .getThiefID ();
186187
187188 if (nextThiefID == -1 ) {
@@ -202,13 +203,10 @@ public synchronized void crawlIn() {
202203 //GenericIO.writelnString(getThiefPosition(thiefID)+"is the position of thief "+thiefID);
203204 } while (crawl (ordinaryThief , 0 , room .getDistance ()));
204205
206+ repos .setDistance (room .getDistance ());
205207 ordinaryThief .setThiefState (OrdinaryThiefStates .AT_A_ROOM );
206- //GenericIO.writelnString(getThiefPosition(ordinaryThief.getThiefID())+"is the position of thief "+ordinaryThief.getThiefID());
207208 repos .setOrdinaryThiefState (thiefID , OrdinaryThiefStates .AT_A_ROOM );
208- //repos.setOrdinaryThiefRoomID(thiefID, room.getID());
209- loggerCrawl (ordinaryThief , "ARRIVED AT " + room );
210- //repos.setAssaultPartyID(id);
211- //repos.setOrdinaryThiefAssaultPartyID(thiefID, id);
209+ repos .setOrdinaryThiefAssaultPartyID (thiefID , id );
212210 }
213211
214212 /**
@@ -235,7 +233,6 @@ public synchronized void crawlOut() {
235233 getThief (thiefID ).isAtGoal (false );
236234 ordinaryThief .setThiefState (OrdinaryThiefStates .COLLECTION_SITE );
237235 repos .setOrdinaryThiefState (thiefID , OrdinaryThiefStates .COLLECTION_SITE );
238- loggerCrawl (ordinaryThief , "ARRIVED AT COLLECTION SITE" );
239236 }
240237
241238 /**
@@ -256,7 +253,7 @@ private boolean crawl(OrdinaryThief ordinaryThief, int beginning, int goal) {
256253
257254 // wake up next thief
258255 nextThiefID = getNextThief (thiefID , backwards );
259- //GenericIO.writelnString("Next Thief: " + nextThiefID);
256+
260257
261258 notifyAll ();
262259
@@ -315,6 +312,7 @@ private void updateThiefPosition(int thiefID, int move, boolean backwards) {
315312 int newPos = !backwards ? thiefPos + move : thiefPos - move ;
316313 repos .setOrdinaryThiefPosition (thiefID , newPos );
317314 setThiefPosition (thiefID , newPos );
315+ repos .setOrdinaryThiefPosition (thiefID , newPos );
318316 }
319317
320318 /**
@@ -347,7 +345,6 @@ private boolean checkOverlay(int beginning, int goal) {
347345 int currentPos = thieves [i ].getPosition ();
348346 int nextPos = thieves [j ].getPosition ();
349347 if (currentPos != beginning && currentPos != goal && currentPos == nextPos ) {
350- //GenericIO.writelnString("OVERLAY");
351348 return true ;
352349 }
353350 }
@@ -443,7 +440,6 @@ private void printPositions() {
443440 for (int i = 0 ; i < N_THIEVES_PER_PARTY ; i ++) {
444441 print .append (thieves [i ].getPosition ()).append (" " );
445442 }
446- //GenericIO.writelnString(print);
447443 }
448444
449445 /**
0 commit comments