Added a Diagonal constraint.
[pseudoku.git] / pseudoku / __init__.py
1 from grid import Grid
2 from grid.cellgroup import Diagonal
3 import render.text
4
5 def main():
6 grid = Grid.from_string("""
7 3...2...7
8 ...3.1...
9 ..6...4..
10 89.....54
11 4...5...8
12 61.....32
13 ..8...2..
14 ...5.9...
15 1...6...9
16 """)
17
18 grid.add_constraint(Diagonal(grid, direction='down', offset=0))
19 grid.add_constraint(Diagonal(grid, direction='up', offset=0))
20
21 r = render.text.AsciiArtGridRenderer()
22 print r.render_grid(grid)
23
24 grid.solve()
25
26 print r.render_grid(grid)