Skip to content
Ad-Master edited this page Sep 5, 2014 · 1 revision

Found a 148 line (664 tokens) duplication in the following files: Starting at line 19 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\OldLogic.java Starting at line 17 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\LogicPatryk.java

public OldLogic(GameController gameController) {
	this.gameController = gameController;
	maxSlots = gameController.getBoard().getSlots();
	maxRows = gameController.getBoard().getRows();
}

/**
 * Sprawdzenie ułożenia 4 w 4 wariantach
 * 
 * @return true jeżeli gracz wygrał
 */
public boolean checkIfWin() {
	hasWinner = false;
	columnWin(human);
	rowWin(human);
	diagonalWin1(human);
	diagonalWin2(human);
	return hasWinner;
}

/**
 * Funkcja sprawdza stan gry czy jest remis
 * 
 * @param doneMoves
 *            - wykonane ruchy
 * @return zwraca true jeżeli jest remis(wszystkie sloty pełne)
 */

public boolean checkIfDraw(int doneMoves) {
	if (doneMoves == gameController.getBoard().getTotalSpots()) {
		gameController.setResult(ResultState.Draw);
		return true;
	}
	return false;
}

/**
 * Sprawdź czy wygrał PC
 * 
 * @return true jeżeli wygrał
 */
public boolean checkIfWinPC() {
	columnWin(cpu);
	rowWin(cpu);
	diagonalWin1(cpu);
	diagonalWin2(cpu);
	return cpuWin;
}

/**
 * Sprawdzenie wyniku gry
 * 
 * @param doneMoves
 *            wykonane ruchy
 * @return true jeżeli win lub draw
 */
public boolean checkResult(int doneMoves) {
	checkIfWin();
	checkIfDraw(doneMoves);
	if (gameController.getResult() == ResultState.NoWin)
		return false;
	return true;
}

private void columnWin(String playerType) {
	for (int row = 0; row < maxRows; row++) { // slot\kolumna
		for (int slot = 0; slot < maxSlots - 3; slot++) {
			token = gameController.getHoleState(row, slot);
			if (token != HoleState.EMPTY
					&& token == gameController.getHoleState(row, slot + 1)
					&& token == gameController.getHoleState(row, slot + 2)
					&& token == gameController.getHoleState(row, slot + 3)) {
				setPlayerWon(playerType);
			}
		}
	}
}

// potem zamienić za warunki
// private boolean checkNextHole(int row, int slot) {
// return token == gameController.getHoleState(row, slot);
// }

private void diagonalWin1(String playerType) {
	for (int row = 0; row < maxRows - 3; row++) { // skos /
		for (int slot = 0; slot < maxSlots - 3; slot++) {
			token = gameController.getBoard().getHoleState(row, slot);
			if (token != HoleState.EMPTY
					&& token == gameController.getHoleState(row + 1,
							slot + 1)
					&& token == gameController.getHoleState(row + 2,
							slot + 2)
					&& token == gameController.getHoleState(row + 3,
							slot + 3))
				setPlayerWon(playerType);
		}
	}
}

private void diagonalWin2(String playerType) {
	for (int row = maxRows - 1; row >= 3; row--) { // skos \
		for (int slot = 0; slot < maxSlots - 3; slot++) {
			HoleState token = gameController.getHoleState(row, slot);
			if (token != HoleState.EMPTY
					&& token == gameController.getHoleState(row - 1,
							slot + 1)
					&& token == gameController.getHoleState(row - 2,
							slot + 2)
					&& token == gameController.getHoleState(row - 3,
							slot + 3))
				setPlayerWon(playerType);
		}
	}
}

private void rowWin(String playerType) {
	for (int slot = 0; slot < maxSlots; slot++) { // wiersz
		for (int row = 0; row < maxRows - 3; row++) {
			token = gameController.getBoard().getHoleState(row, slot);
			if (token != HoleState.EMPTY
					&& token == gameController.getHoleState(row + 1, slot)
					&& token == gameController.getHoleState(row + 2, slot)
					&& token == gameController.getHoleState(row + 3, slot))
				setPlayerWon(playerType);
		}
	}
}

private void setPlayerWon(String playerType) {
	if (playerType == cpu) {
		cpuWin = true;
		return;
	}
	if (token == HoleState.PLAYER1) {
		gameController.setResult(ResultState.Player1Win);
	} else if (token == HoleState.PLAYER2) {
		gameController.setResult(ResultState.Player2Win);
	}
}

public boolean getCPUwin() {
	return cpuWin;
}

public void setCPUwin(boolean CPUwin) {
	this.cpuWin = CPUwin;
}

}

Found a 124 line (541 tokens) duplication in the following files: Starting at line 13 of C:\Users\Łukasz\git\AtremProject\atrem\src\test\StretchIcon.java Starting at line 13 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\swing\StretchIcon.java

public class StretchIcon extends ImageIcon {

/**
 * Serial
 */
private static final long serialVersionUID = 8654204823969367762L;
protected boolean proportionate = true;

public StretchIcon(byte[] imageData) {
	super(imageData);
}

public StretchIcon(byte[] imageData, boolean proportionate) {
	super(imageData);
	this.proportionate = proportionate;
}

public StretchIcon(byte[] imageData, String description) {
	super(imageData, description);
}

public StretchIcon(byte[] imageData, String description,
		boolean proportionate) {
	super(imageData, description);
	this.proportionate = proportionate;
}

public StretchIcon(Image image) {
	super(image);
}

public StretchIcon(Image image, boolean proportionate) {
	super(image);
	this.proportionate = proportionate;
}

public StretchIcon(Image image, String description) {
	super(image, description);
}

public StretchIcon(Image image, String description, boolean proportionate) {
	super(image, description);
	this.proportionate = proportionate;
}

public StretchIcon(String filename) {
	super(filename);
}

public StretchIcon(String filename, boolean proportionate) {
	super(filename);
	this.proportionate = proportionate;
}

public StretchIcon(String filename, String description) {
	super(filename, description);
}

public StretchIcon(String filename, String description,
		boolean proportionate) {
	super(filename, description);
	this.proportionate = proportionate;
}

public StretchIcon(URL location) {
	super(location);
}

public StretchIcon(URL location, boolean proportionate) {
	super(location);
	this.proportionate = proportionate;
}

public StretchIcon(URL location, String description) {
	super(location, description);
}

public StretchIcon(URL location, String description, boolean proportionate) {
	super(location, description);
	this.proportionate = proportionate;
}

@Override
public synchronized void paintIcon(Component c, Graphics g, int x, int y) {
	Image image = getImage();
	if (image == null) {
		return;
	}

	Insets insets = ((Container) c).getInsets();
	x = insets.left;
	y = insets.top;
	int w = c.getWidth() - x - insets.right;
	int h = c.getHeight() - y - insets.bottom;

	if (proportionate) {
		int iw = image.getWidth(c);
		int ih = image.getHeight(c);

		if (iw * h < ih * w) {
			iw = (h * iw) / ih;
			x += (w - iw) / 2;
			w = iw;
		} else {
			ih = (w * ih) / iw;
			y += (h - ih) / 2;
			h = ih;
		}
	}

	ImageObserver io = getImageObserver();
	g.drawImage(image, x, y, w, h, io == null ? c : io);
}

@Override
public int getIconWidth() {
	return 0;
}

@Override
public int getIconHeight() {
	return 0;
}

}

Found a 97 line (503 tokens) duplication in the following files: Starting at line 53 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\OldLogic.java Starting at line 51 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\CopyOfLogic.java Starting at line 50 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\LogicPatryk.java

}

/**
 * Sprawdź czy wygrał PC
 * 
 * @return true jeżeli wygrał
 */
public boolean checkIfWinPC() {
	columnWin(cpu);
	rowWin(cpu);
	diagonalWin1(cpu);
	diagonalWin2(cpu);
	return cpuWin;
}

/**
 * Sprawdzenie wyniku gry
 * 
 * @param doneMoves
 *            wykonane ruchy
 * @return true jeżeli win lub draw
 */
public boolean checkResult(int doneMoves) {
	checkIfWin();
	checkIfDraw(doneMoves);
	if (gameController.getResult() == ResultState.NoWin)
		return false;
	return true;
}

private void columnWin(String playerType) {
	for (int row = 0; row < maxRows; row++) { // slot\kolumna
		for (int slot = 0; slot < maxSlots - 3; slot++) {
			token = gameController.getHoleState(row, slot);
			if (token != HoleState.EMPTY
					&& token == gameController.getHoleState(row, slot + 1)
					&& token == gameController.getHoleState(row, slot + 2)
					&& token == gameController.getHoleState(row, slot + 3)) {
				setPlayerWon(playerType);
			}
		}
	}
}

// potem zamienić za warunki
// private boolean checkNextHole(int row, int slot) {
// return token == gameController.getHoleState(row, slot);
// }

private void diagonalWin1(String playerType) {
	for (int row = 0; row < maxRows - 3; row++) { // skos /
		for (int slot = 0; slot < maxSlots - 3; slot++) {
			token = gameController.getBoard().getHoleState(row, slot);
			if (token != HoleState.EMPTY
					&& token == gameController.getHoleState(row + 1,
							slot + 1)
					&& token == gameController.getHoleState(row + 2,
							slot + 2)
					&& token == gameController.getHoleState(row + 3,
							slot + 3))
				setPlayerWon(playerType);
		}
	}
}

private void diagonalWin2(String playerType) {
	for (int row = maxRows - 1; row >= 3; row--) { // skos \
		for (int slot = 0; slot < maxSlots - 3; slot++) {
			HoleState token = gameController.getHoleState(row, slot);
			if (token != HoleState.EMPTY
					&& token == gameController.getHoleState(row - 1,
							slot + 1)
					&& token == gameController.getHoleState(row - 2,
							slot + 2)
					&& token == gameController.getHoleState(row - 3,
							slot + 3))
				setPlayerWon(playerType);
		}
	}
}

private void rowWin(String playerType) {
	for (int slot = 0; slot < maxSlots; slot++) { // wiersz
		for (int row = 0; row < maxRows - 3; row++) {
			token = gameController.getBoard().getHoleState(row, slot);
			if (token != HoleState.EMPTY
					&& token == gameController.getHoleState(row + 1, slot)
					&& token == gameController.getHoleState(row + 2, slot)
					&& token == gameController.getHoleState(row + 3, slot))
				setPlayerWon(playerType);
		}
	}
}

private void setPlayerWon(String playerType) {
	if (playerType == cpu) {
		cpuWin = true;

===================================================================== Found a 11 line (92 tokens) duplication in the following files: Starting at line 27 of C:\Users\Łukasz\git\AtremProject\atrem\src\test\Panel.java Starting at line 43 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\CopyofSwingBoard.java

	for (int tempSlot = 0; tempSlot < slots; tempSlot++) {
		button[tempSlot] = new JButton("" + (tempSlot + 1));
		add(button[tempSlot]);

		button[tempSlot].addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent TokenPlaced) {
				Object s = TokenPlaced.getSource();
				for (int tempSlot = 0; tempSlot < slots; tempSlot++) {
					if (s == button[tempSlot]) {
						chosenSlot = tempSlot;

===================================================================== Found a 13 line (70 tokens) duplication in the following files: Starting at line 13 of C:\Users\Łukasz\git\AtremProject\atrem\src\test\BetterLogic.java Starting at line 19 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\CopyOfLogic.java

public BetterLogic(GameController gameController) {
	this.gameController = gameController;
	maxSlots = gameController.getBoard().getSlots();
	maxRows = gameController.getBoard().getRows();
}

public boolean checkIfDraw(int doneMoves) {
	if (doneMoves == gameController.getBoard().getTotalSpots()) {
		gameController.setResult(ResultState.Draw);
		return true;
	}
	return false;
}

===================================================================== Found a 13 line (69 tokens) duplication in the following files: Starting at line 87 of C:\Users\Łukasz\git\AtremProject\atrem\src\test\BetterLogic.java Starting at line 72 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\Logic.java

	if (getAddedNumbersOfNeighbours(row, slot, 1, 1) > 3)
		return true;
	return false;
}

private int getAddedNumbersOfNeighbours(int row, int slot, int i, int j) {
	return countNeighboursInOneDirection(row, slot, i, j)
			+ countNeighboursInOneDirection(row, slot, -i, -j);
}

public int countNeighboursInOneDirection(int row, int slot, int i, int j) {

	if ((gameController.getHoleState(row + i, slot + j) == gameController

===================================================================== Found a 19 line (68 tokens) duplication in the following files: Starting at line 43 of C:\Users\Łukasz\git\AtremProject\atrem\src\test\Panel.java Starting at line 57 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\CopyofSwingBoard.java

					}
				}
			}
		});
	}
	/**
	 * rowsy z slotsami zamienione miejscami na potrzebe jlabela
	 */
	for (int tempRow = 0; tempRow < rows; tempRow++) {
		for (int tempSlot = 0; tempSlot < slots; tempSlot++) {
			// Plansza[tempRow][tempSlot] = new JLabel("" + tempRow + ", "
			// + tempSlot);
			Plansza[tempRow][tempSlot] = new JLabel();
			add(Plansza[tempRow][tempSlot]);
			// iconResource.setLabelH((int) Plansza[tempRow][tempSlot]
			// .getSize().getHeight());
			// iconResource.setLabelW((int) Plansza[tempRow][tempSlot]
			// .getSize().getWidth());
			Plansza[tempRow][tempSlot].setIcon(iconResource.get(0));

===================================================================== Found a 14 line (68 tokens) duplication in the following files: Starting at line 131 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\player\ai\MediumPC.java Starting at line 77 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\player\ai\EasyPC.java

}

@Override
public void endOfGame(ResultState resultGame) {
	if (resultGame == ResultState.Player1Win)
		informationBoxes.winMessage(playerAttributes.getName());
	if (resultGame == ResultState.Player2Win)
		informationBoxes.winMessage(gameController.getPlayer2().getName());
	if (resultGame == ResultState.Draw)
		informationBoxes.drawMessage();
}

@Override
public String getName() {

===================================================================== Found a 21 line (64 tokens) duplication in the following files: Starting at line 225 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\swing\SwingPresenter.java Starting at line 141 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\player\ai\MediumPC.java

}

@Override
public String getName() {
	return playerAttributes.getName();
}

@Override
public void setName(String name) {
	playerAttributes.setName(name);
}

@Override
public PlayerId getPlayerId() {
	return playerAttributes.getPlayerId();
}

@Override
public void setGamecontroller(GameController gamecontroller) {
	this.gameController = gamecontroller;
}

===================================================================== Found a 9 line (57 tokens) duplication in the following files: Starting at line 29 of C:\Users\Łukasz\git\AtremProject\atrem\src\test\Panel.java Starting at line 45 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\CopyofSwingBoard.java Starting at line 43 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\swing\GameBoard.java

		add(button[tempSlot]);

		button[tempSlot].addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent TokenPlaced) {
				Object s = TokenPlaced.getSource();
				for (int tempSlot = 0; tempSlot < slots; tempSlot++) {
					if (s == button[tempSlot]) {
						chosenSlot = tempSlot;

===================================================================== Found a 6 line (56 tokens) duplication in the following files: Starting at line 27 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\Logic.java Starting at line 61 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\Logic.java

public boolean checkIfWinPC(int row, int slot) {
	if (checkIfThereIsAFour(row, slot, 1, 1)
			|| checkIfThereIsAFour(row, slot, -1, 1)
			|| checkIfThereIsAFour(row, slot, 1, 0)
			|| checkIfThereIsAFour(row, slot, 0, 1))
		return cpuWin = true;

===================================================================== Found a 11 line (50 tokens) duplication in the following files: Starting at line 274 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\DialogSettingsBox.java Starting at line 130 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\swing\DialogSettingsBox.java

		setRows(Integer.parseInt(TxtRows.getText()));
	} catch (NumberFormatException e) {
		JOptionPane.showMessageDialog(dialog,
				"Wpisz poprawną wartość pola!");
		return false;
	}

	if (getSlots() < 4 || getRows() < 4) {
		JOptionPane.showMessageDialog(dialog, "Sloty i Wiersze > 4!");
		return false;
	}

===================================================================== Found a 18 line (48 tokens) duplication in the following files: Starting at line 37 of C:\Users\Łukasz\git\AtremProject\atrem\src\test\ResourceLoader.java Starting at line 51 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\swing\ResourceLoader.java

}

public int getLabelH() {
	return labelH;
}

public void setLabelH(int labelH) {
	this.labelH = labelH;
}

public int getLabelW() {
	return labelW;
}

public void setLabelW(int labelW) {
	this.labelW = labelW;
}

}

Found a 6 line (44 tokens) duplication in the following files: Starting at line 390 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\swing\DialogSettingsBox.java Starting at line 402 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\swing\DialogSettingsBox.java

	plTypeBox1.addActionListener(new ActionListener() {
		@SuppressWarnings("unchecked")
		@Override
		public void actionPerformed(ActionEvent e) {
			JComboBox<String> item = (JComboBox<String>) e.getSource();
			disableGameTypeBoxes(item, 1);

===================================================================== Found a 13 line (43 tokens) duplication in the following files: Starting at line 360 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\DialogSettingsBox.java Starting at line 823 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\swing\DialogSettingsBox.java

}

public void setPl2Name(String pl2Name) {
	this.pl2Name = pl2Name;
}

public void setRows(int rows) {
	this.rows = rows;
}

public void setSlots(int slots) {
	this.slots = slots;
}

===================================================================== Found a 7 line (41 tokens) duplication in the following files: Starting at line 61 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\player\ai\MediumPC.java Starting at line 79 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\player\ai\MediumPC.java

	for (int i = 0; i < board.getSlots(); i++) {// tu mamy x
		simulatedRow = simulatedGo(i);// a tu y
		if (simulatedRow == -1)
			continue;
		else {

			board.setHoleState(simulatedRow, i,

===================================================================== Found a 9 line (40 tokens) duplication in the following files: Starting at line 105 of C:\Users\Łukasz\git\AtremProject\atrem\src\test\BetterLogic.java Starting at line 92 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\Logic.java

}

private boolean checkIfHoleExists(int row, int slot) {
	if (row < 0 || slot < 0 || row >= maxRows || slot >= maxSlots) {
		return false;
	} else {
		return true;
	}
}

===================================================================== Found a 24 line (40 tokens) duplication in the following files: Starting at line 37 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\OldLogic.java Starting at line 23 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\CopyOfLogic.java Starting at line 35 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\LogicPatryk.java

}

/**
 * Funkcja sprawdza stan gry czy jest remis
 * 
 * @param doneMoves
 *            - wykonane ruchy
 * @return zwraca true jeżeli jest remis(wszystkie sloty pełne)
 */

public boolean checkIfDraw(int doneMoves) {
	if (doneMoves == gameController.getBoard().getTotalSpots()) {
		gameController.setResult(ResultState.Draw);
		return true;
	}
	return false;
}

/**
 * Sprawdź czy wygrał PC
 * 
 * @return true jeżeli wygrał
 */
public boolean checkIfWinPC() {

===================================================================== Found a 14 line (40 tokens) duplication in the following files: Starting at line 47 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\OldLogic.java Starting at line 44 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\LogicPatryk.java Starting at line 19 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\Logic.java

public boolean checkIfDraw(int doneMoves) {
	if (doneMoves == gameController.getBoard().getTotalSpots()) {
		gameController.setResult(ResultState.Draw);
		return true;
	}
	return false;
}

/**
 * Sprawdź czy wygrał PC
 * 
 * @return true jeżeli wygrał
 */
public boolean checkIfWinPC() {

===================================================================== Found a 7 line (39 tokens) duplication in the following files: Starting at line 151 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\OldLogic.java Starting at line 148 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\CopyOfLogic.java Starting at line 148 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\LogicPatryk.java

	}
	if (token == HoleState.PLAYER1) {
		gameController.setResult(ResultState.Player1Win);
	} else if (token == HoleState.PLAYER2) {
		gameController.setResult(ResultState.Player2Win);
	}
}

===================================================================== Found a 9 line (38 tokens) duplication in the following files: Starting at line 17 of C:\Users\Łukasz\git\AtremProject\atrem\src\test\BetterLogic.java Starting at line 37 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\OldLogic.java Starting at line 35 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\LogicPatryk.java

}

public boolean checkIfDraw(int doneMoves) {
	if (doneMoves == gameController.getBoard().getTotalSpots()) {
		gameController.setResult(ResultState.Draw);
		return true;
	}
	return false;
}

===================================================================== Found a 14 line (38 tokens) duplication in the following files: Starting at line 32 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\CopyOfLogic.java Starting at line 19 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\Logic.java

public boolean checkIfDraw(int doneMoves) {
	if (doneMoves == gameController.getBoard().getTotalSpots()) {
		gameController.setResult(ResultState.Draw);
		return true;
	}
	return false;
}

/**
 * Sprawdzenie ułożenia 4 w 4 wariantach
 * 
 * @return true jeżeli gracz wygrał
 */
public boolean checkIfWin() {

===================================================================== Found a 7 line (36 tokens) duplication in the following files: Starting at line 19 of C:\Users\Łukasz\git\AtremProject\atrem\src\test\BetterLogic.java Starting at line 19 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\Logic.java

public boolean checkIfDraw(int doneMoves) {
	if (doneMoves == gameController.getBoard().getTotalSpots()) {
		gameController.setResult(ResultState.Draw);
		return true;
	}
	return false;
}

===================================================================== Found a 5 line (36 tokens) duplication in the following files: Starting at line 104 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\OldLogic.java Starting at line 136 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\OldLogic.java Starting at line 102 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\CopyOfLogic.java Starting at line 134 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\CopyOfLogic.java Starting at line 101 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\LogicPatryk.java Starting at line 133 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\LogicPatryk.java

		for (int slot = 0; slot < maxSlots - 3; slot++) {
			token = gameController.getBoard().getHoleState(row, slot);
			if (token != HoleState.EMPTY
					&& token == gameController.getHoleState(row + 1,
							slot + 1)

===================================================================== Found a 7 line (35 tokens) duplication in the following files: Starting at line 13 of C:\Users\Łukasz\git\AtremProject\atrem\src\test\BetterLogic.java Starting at line 19 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\OldLogic.java Starting at line 19 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\CopyOfLogic.java Starting at line 17 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\LogicPatryk.java

public BetterLogic(GameController gameController) {
	this.gameController = gameController;
	maxSlots = gameController.getBoard().getSlots();
	maxRows = gameController.getBoard().getRows();
}

public boolean checkIfDraw(int doneMoves) {

===================================================================== Found a 7 line (35 tokens) duplication in the following files: Starting at line 746 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\swing\DialogSettingsBox.java Starting at line 763 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\swing\DialogSettingsBox.java

									Short.MAX_VALUE).addContainerGap())
			.addGroup(
					layout.createParallelGroup(
							GroupLayout.Alignment.LEADING).addGroup(
							layout.createSequentialGroup()
									.addContainerGap()
									.addComponent(jTabbedPane)

===================================================================== Found a 7 line (35 tokens) duplication in the following files: Starting at line 91 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\player\ai\MediumPC.java Starting at line 101 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\player\ai\MediumPC.java

		}
	}
	for (int i = 0; i < board.getSlots(); i++) {
		simulatedRow = simulatedGo(i);// a tu y
		if (simulatedRow == -1)
			continue;
		if (simulatedRow == board.getLastRow() // sprawdzanei ten sam level

===================================================================== Found a 12 line (35 tokens) duplication in the following files: Starting at line 140 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\player\ai\MediumPC.java Starting at line 30 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\player\ai\EasyPC.java

		informationBoxes.drawMessage();
}

@Override
public String getName() {
	return playerAttributes.getName();
}

@Override
public void setName(String name) {
	playerAttributes.setName(name);
}

===================================================================== Found a 15 line (35 tokens) duplication in the following files: Starting at line 93 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\board\Board.java Starting at line 10 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\LastMove.java

}

public int getLastSlot() {
	return lastSlot;
}

public void setLastSlot(int lastSlot) {
	this.lastSlot = lastSlot;
}

public int getLastRow() {
	return lastRow;
}

public void setLastSpot(int lastRow) {

===================================================================== Found a 14 line (34 tokens) duplication in the following files: Starting at line 234 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\swing\SwingPresenter.java Starting at line 50 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\console\PlayerConsole.java

	playerAttributes.setName(name);
}

@Override
public PlayerId getPlayerId() {
	return playerAttributes.getPlayerId();
}

@Override
public void setGamecontroller(GameController gamecontroller) {
	this.gameController = gamecontroller;
}

public int getPoints() {

===================================================================== Found a 5 line (34 tokens) duplication in the following files: Starting at line 23 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\player\ai\EasyPC.java Starting at line 31 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\console\PlayerConsole.java

public EasyPC(GameController gameController, String name, PlayerId playerId) {
	this.gameController = gameController;
	playerAttributes = new PlayerAttributes();
	playerAttributes.setName(name);
	playerAttributes.setPlayerId(playerId);

===================================================================== Found a 5 line (33 tokens) duplication in the following files: Starting at line 13 of C:\Users\Łukasz\git\AtremProject\atrem\src\test\BetterLogic.java Starting at line 19 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\OldLogic.java Starting at line 19 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\CopyOfLogic.java Starting at line 17 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\LogicPatryk.java Starting at line 12 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\Logic.java

public BetterLogic(GameController gameController) {
	this.gameController = gameController;
	maxSlots = gameController.getBoard().getSlots();
	maxRows = gameController.getBoard().getRows();
}

===================================================================== Found a 10 line (33 tokens) duplication in the following files: Starting at line 10 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\OldLogic.java Starting at line 10 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\CopyOfLogic.java Starting at line 8 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\LogicPatryk.java

public class OldLogic { private int maxRows; private int maxSlots; private GameController gameController; private HoleState token; private boolean hasWinner = false; private boolean cpuWin = false; private String human = "human", cpu = "cpu";

public OldLogic(GameController gameController) {

===================================================================== Found a 11 line (33 tokens) duplication in the following files: Starting at line 225 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\swing\SwingPresenter.java Starting at line 31 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\player\ai\EasyPC.java

}

@Override
public String getName() {
	return playerAttributes.getName();
}

@Override
public void setName(String name) {
	playerAttributes.setName(name);
}

===================================================================== Found a 6 line (33 tokens) duplication in the following files: Starting at line 77 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\player\ai\MediumPC.java Starting at line 91 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\player\ai\MediumPC.java Starting at line 101 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\player\ai\MediumPC.java

		}
	}
	for (int i = 0; i < board.getSlots(); i++) {
		simulatedRow = simulatedGo(i);// a tu y
		if (simulatedRow == -1)
			continue;

===================================================================== Found a 12 line (33 tokens) duplication in the following files: Starting at line 150 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\player\ai\MediumPC.java Starting at line 50 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\console\PlayerConsole.java

	playerAttributes.setName(name);
}

@Override
public PlayerId getPlayerId() {
	return playerAttributes.getPlayerId();
}

@Override
public void setGamecontroller(GameController gamecontroller) {
	this.gameController = gamecontroller;
}

===================================================================== Found a 6 line (33 tokens) duplication in the following files: Starting at line 23 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\console\KeyHandler.java Starting at line 41 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\console\KeyHandler.java

public int getInt() {
	@SuppressWarnings("resource")
	Scanner input = new Scanner(System.in);
	while (true) {
		if (input.hasNextInt()) {
			int inputInt = input.nextInt();

===================================================================== Found a 11 line (31 tokens) duplication in the following files: Starting at line 99 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\swing\GameBoard.java Starting at line 109 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\GameConfig.java

	this.slots = slots;
}

public void setRows(int rows) {
	this.rows = rows;
}

public void setSlots(int slots) {
	this.slots = slots;
}

}

Found a 11 line (31 tokens) duplication in the following files: Starting at line 827 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\swing\DialogSettingsBox.java Starting at line 198 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\GameFactory.java

}

public void setRows(int rows) {
	this.rows = rows;
}

public void setSlots(int slots) {
	this.slots = slots;
}

public String getPl1Type() {

===================================================================== Found a 4 line (31 tokens) duplication in the following files: Starting at line 61 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\player\ai\MediumPC.java Starting at line 93 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\player\ai\MediumPC.java Starting at line 103 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\player\ai\MediumPC.java

	for (int i = 0; i < board.getSlots(); i++) {// tu mamy x
		simulatedRow = simulatedGo(i);// a tu y
		if (simulatedRow == -1)
			continue;

===================================================================== Found a 10 line (30 tokens) duplication in the following files: Starting at line 364 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\DialogSettingsBox.java Starting at line 100 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\swing\GameBoard.java Starting at line 110 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\GameConfig.java

}

public void setRows(int rows) {
	this.rows = rows;
}

public void setSlots(int slots) {
	this.slots = slots;
}

}

Found a 2 line (29 tokens) duplication in the following files: Starting at line 27 of C:\Users\Łukasz\git\AtremProject\atrem\src\test\Panel.java Starting at line 43 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\CopyofSwingBoard.java Starting at line 42 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\swing\GameBoard.java

	for (int tempSlot = 0; tempSlot < slots; tempSlot++) {
		button[tempSlot] = new JButton("" + (tempSlot + 1));

===================================================================== Found a 15 line (29 tokens) duplication in the following files: Starting at line 332 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\DialogSettingsBox.java Starting at line 799 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\swing\DialogSettingsBox.java

}

public String getPl2Name() {
	return pl2Name;
}

public int getRows() {
	return rows;
}

public int getSlots() {
	return slots;
}

public boolean isCPU() {

===================================================================== Found a 9 line (29 tokens) duplication in the following files: Starting at line 364 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\DialogSettingsBox.java Starting at line 198 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\GameFactory.java

}

public void setRows(int rows) {
	this.rows = rows;
}

public void setSlots(int slots) {
	this.slots = slots;
}

===================================================================== Found a 9 line (29 tokens) duplication in the following files: Starting at line 100 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\swing\GameBoard.java Starting at line 827 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\swing\DialogSettingsBox.java Starting at line 110 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\GameConfig.java

}

public void setRows(int rows) {
	this.rows = rows;
}

public void setSlots(int slots) {
	this.slots = slots;
}

===================================================================== Found a 4 line (27 tokens) duplication in the following files: Starting at line 97 of C:\Users\Łukasz\git\AtremProject\atrem\src\test\BetterLogic.java Starting at line 84 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\Logic.java

public int countNeighboursInOneDirection(int row, int slot, int i, int j) {

	if ((gameController.getHoleState(row + i, slot + j) == gameController
			.getHoleState(row, slot))

===================================================================== Found a 2 line (26 tokens) duplication in the following files: Starting at line 51 of C:\Users\Łukasz\git\AtremProject\atrem\src\test\Panel.java Starting at line 65 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\CopyofSwingBoard.java Starting at line 66 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\swing\GameBoard.java

	for (int tempRow = 0; tempRow < rows; tempRow++) {
		for (int tempSlot = 0; tempSlot < slots; tempSlot++) {

===================================================================== Found a 11 line (26 tokens) duplication in the following files: Starting at line 156 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\OldLogic.java Starting at line 153 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\LogicPatryk.java Starting at line 99 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\Logic.java

	}
}

public boolean getCPUwin() {
	return cpuWin;
}

public void setCPUwin(boolean CPUwin) {
	this.cpuWin = CPUwin;
}

}

Found a 6 line (26 tokens) duplication in the following files: Starting at line 738 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\swing\DialogSettingsBox.java Starting at line 747 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\swing\DialogSettingsBox.java Starting at line 765 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\swing\DialogSettingsBox.java

	layout.setHorizontalGroup(layout
			.createParallelGroup(GroupLayout.Alignment.LEADING)
			.addGroup(
					layout.createSequentialGroup()
							.addContainerGap()
							.addComponent(buttonPanel,

===================================================================== Found a 7 line (26 tokens) duplication in the following files: Starting at line 120 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\player\ai\MediumPC.java Starting at line 73 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\console\PlayerConsole.java

}

@Override
public void yourTurn() {
	executor.execute(new Runnable() {
		@Override
		public void run() {

===================================================================== Found a 4 line (26 tokens) duplication in the following files: Starting at line 60 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\console\KeyHandler.java Starting at line 67 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\console\KeyHandler.java

public String getString() {
	@SuppressWarnings("resource")
	Scanner input = new Scanner(System.in);
	String string = input.next();

===================================================================== Found a 3 line (25 tokens) duplication in the following files: Starting at line 86 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\OldLogic.java Starting at line 121 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\OldLogic.java Starting at line 84 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\CopyOfLogic.java Starting at line 119 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\zclasstempbacups\CopyOfLogic.java Starting at line 83 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\LogicPatryk.java Starting at line 118 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\LogicPatryk.java

			token = gameController.getHoleState(row, slot);
			if (token != HoleState.EMPTY
					&& token == gameController.getHoleState(row, slot + 1)

===================================================================== Found a 7 line (25 tokens) duplication in the following files: Starting at line 562 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\swing\DialogSettingsBox.java Starting at line 591 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\swing\DialogSettingsBox.java

													.addComponent(jLabel6))
									.addGap(18, 18, 18)
									.addGroup(
											playerSetPanelLayout
													.createParallelGroup(
															GroupLayout.Alignment.LEADING)
													.addGroup(

===================================================================== Found a 9 line (25 tokens) duplication in the following files: Starting at line 563 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\swing\DialogSettingsBox.java Starting at line 624 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\swing\DialogSettingsBox.java

									.addGap(18, 18, 18)
									.addGroup(
											playerSetPanelLayout
													.createParallelGroup(
															GroupLayout.Alignment.LEADING)
													.addGroup(
															playerSetPanelLayout
																	.createSequentialGroup()
																	.addComponent(

===================================================================== Found a 7 line (25 tokens) duplication in the following files: Starting at line 68 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\player\ai\MediumPC.java Starting at line 84 of C:\Users\Łukasz\git\AtremProject\atrem\src\atrem\connect4\game\player\ai\MediumPC.java

					playerAttributes.getPlayerId());

			if (logic.checkIfWinPC(simulatedRow, i)) {// wiem ze mozna
														// lepiej
				board.cleanSpot(simulatedRow, i);
				return i;
			} else {
Clone this wiki locally