public byte popFirstValueForCell(int li, int co) {
if (isCellFilled(li, co))
return 0;
for (byte v = 1; v <= 9; v++) {
if (isCellValuePossible(li, co, v) && !isCellValueScreened(li, co, v)) {
return v;
} else {
System.out.println("GridShadow.popFirstValueForCell() value "+v+" is screened in cell "+li+","+co);
}
}
return 0;
}
public boolean setCellValueAt(int li, int co, byte value) {
System.out.println("GridShadow.setCellValueAt(" + li + "," + co + "=>"
+ value + ")");
cellFlags[offset + 9 * li + co] &= ~MASK_FOR_CURRENT_VALUE;
cellFlags[offset + 9 * li + co] |= FLAG_CELL_READ_ONLY | value;
// ligne
for (int c = 0; c < 9; c++) {
if (c != co) {
if (!isCellFilled(li, c) && isCellValuePossible(li, c, value)) {
unsetCellValuePossible(li, c, value);
setCellValueScreened(li, c, value);
if (getNumberOfPossibleValues(li, c) == 0) {
/* DEAD END */
return true;
}
}
}
}
2011, October, 7
Autre code avec prettyprint (prettify)
By Sylvain on 2011, October, 7, at 00:44
2011, October, 6
Code using Prettify
By Sylvain on 2011, October, 6, at 19:15
package net.jankenpoi.sudokuki.ui.swing;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.Icon;
import javax.swing.JFrame;
@SuppressWarnings("serial")
public class AboutAction extends AbstractAction {
private JFrame parent;
public AboutAction(JFrame parent, SwingGrid grid, String string, Icon iconHelpAbout,
String desc, Integer mnemonic) {
this.parent = parent;
}
@Override
public void actionPerformed(ActionEvent e) {
AboutDialog dlg = new AboutDialog(parent);
dlg.setVisible(true);
}
}
2011, October, 4
Welcome! ようこそ!Bienvenue !
By Sylvain on 2011, October, 4, at 22:30
Welcome! ようこそ!Bienvenue !