I'm working on a sudoku solver in javafx and I need to show the algorithm solving. My board is a bunch of buttons laid out in a 9x9 grid and the user enters the puzzle and I solve it.
The solving works fine but I cannot get the algorithm to run. This is what I have but whenever I run the program the window stops responding and I have to terminate the window and get an interrupted by signal 2: SIGINT
.
private void loop(Sequence s) {
long currentTime = System.currentTimeMillis();
long lastTime = System.currentTimeMillis();
int x = s.getX();
int y = s.getY();
String n = Integer.toString(s.getNum());
Button button = buttons.get(x).get(y);
boolean isFinished = true;
while(isFinished) {
if(currentTime > lastTime + 400){
button.setText(n);
isFinished = false;
} else {
currentTime = System.currentTimeMillis();
}
}
public void show(){
for (Sequence s : sequences){
loop(s);
}
}