Skip to content

Instantly share code, notes, and snippets.

View sykhro's full-sized avatar

Erin sykhro

View GitHub Profile
# 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)]