no compilation error, but the world cant't be constructed and it tells me that an infinite loop may exist.
public class ChessWorld extends GWorld
{
static {
// Initialize the world
GWorld.setWidth(8);
GWorld.setHeight(4);
GWorld.setCellSize(67);
}
/**
* Constructor for objects of class TestWorld.
*
*/
public ChessWorld() {
initialize();
}
/**
* Initialize the world
*/
public void initialize() {
initializeFirstLineByWhileLoop();
}
/**
* (Completed in the skeleton code)
* Remove all the chess pieces
*/
private void removeAllChessPieces() {
GWorld.removeObjectsFromWorld( GWorld.getAllObjects("Chess") );
}
public void initializeFirstLineByWhileLoop() {
int width = GWorld.width();
int i = 0;
while (i < width) {
Chess newChess = new Chess();
GWorld.addOneObject(newChess, i, 0);
i = i + 1;
}
}
}

