/** * Stab the spy, move back to original postion, minus on live. Clear the spy off the current * position on the map. */ public void stabSpy() { int oldRow = spy.getRow(); int oldCol = spy.getCol(); spy.getStabbed(); // Game end if the spy reach 0 live. int spyLives = spy.getLives(); if (spyLives == 0) { gameEndStatus = 2; } // Bring the spy back to the original postion. if (!(map[8][0] instanceof Spy)) { map[oldRow][oldCol] = new Square(debug, oldRow, oldCol); } map[8][0] = spy; spy.setRow(8); spy.setCol(0); // Delete old ninja locations from the occupied array. Iterator<Square> iterator = occupiedLocations.iterator(); while (iterator.hasNext()) { Square loc = iterator.next(); if (isNinja(loc)) { iterator.remove(); } } assignNinjas(false); }