This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install z3-solver | |
from z3 import Int, Solver, And, sat, If, Sum, Or | |
from typing import List, Tuple | |
width = 8 # Number of columns | |
height = 8 # Number of rows | |
# Matrix of integers (0 if grass, 1 if tent), using integer so we can use Sum to count them | |
X = [[Int(f"x_{i+1}_{j+1}") for j in range(width)] for i in range(height)] |