class HiddenSingleStrategy implements Strategy { static getTests() { [ new Test( '0' * 9 + '000200000' + '0' * 9 + '000060000' + '0' * 9 + '000080000' + '0' * 9 * 2 + '000002000', { def cell = it.getCell(5, 5) cell.isKnown() && cell.value == 2 } ) ] } /* * This can only play one at a time, and then it has to let the * GameRulesStrategy have a go to flush out changes */ boolean play(Board board) { for (h in board.houses) { for (n in 1..9) { def cells = h.findAll { ! it.isKnown() && it.hasMark(n) } if (cells.size() == 1) { // we found a hidden single cells[0].setValue(n, this) return true } } } false } }