moved into dedicated folder

This commit is contained in:
Maxime Vorwerk
2024-10-03 15:39:31 +02:00
parent fde087dec7
commit c716f3c774
4 changed files with 0 additions and 0 deletions

29
python/cell.py Normal file
View File

@@ -0,0 +1,29 @@
class cell:
row = []
col = []
square = []
candidates = []
is_set = False
n = -1
def __init__(self, n):
self.candidates = [1,2,3,4,5,6,7,8,9]
self.n = n
def set(self, n):
assert n in self.candidates
self.candidates = [n]
self._prune(n)
self.is_set = True
def _prune(self, n):
for c in self.row:
if n in c.candidates:
c.candidates.remove(n)
for c in self.col:
if n in c.candidates:
c.candidates.remove(n)
for c in self.square:
if n in c.candidates:
c.candidates.remove(n)