import java.util.Iterator; public class ComputerPlayer extends Player{ public ComputerPlayer(String playerName, GamePiece p){ super(playerName, p); } @Override public void takeTurn(Board board) { // iterate through board positions, trying each one // until this player successfully places the game piece // on the board Iterator iter = board.iterator(); while (iter.hasNext()) { BoardPosition pos = iter.next(); if (board.setPiece(gamePiece, pos)) { return; } } } }