Skip to content

Instantly share code, notes, and snippets.

@jezinka

jezinka/Board.groovy Secret

Created Oct 17, 2018
Embed
What would you like to do?
boolean removePairsCandidates(Cell cell, Cell[] cells) {
boolean theSameRecord = false
boolean change = false
Cell twinCell
cells.each {
if (it != cell && it.candidates == cell.candidates) {
theSameRecord = true
twinCell = it
}
}
if (theSameRecord) {
cells.findAll {
it != cell && it != twinCell && it.candidates
}.each { otherCell ->
cell.candidates.each { value ->
if (otherCell.candidates.contains(value)) {
otherCell.candidates -= value
change = true
}
}
}
}
return change
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment