Calculates a Karnaugh map (K-map) for a boolean expression. It supports 2, 3, or 4 variables and returns a 2D array representing the K-map with cells as 0 or 1.
Parameters
input: string
The boolean expression to map
variables: string[]
An array of variable names (order matters)
Returns (boolean|0|1)[][]
Example
// For a 3-variable expression constkmap = Chalkboard.bool.Karnaugh("x & !y | z", ["x", "y", "z"]);
Calculates a Karnaugh map (K-map) for a boolean expression. It supports 2, 3, or 4 variables and returns a 2D array representing the K-map with cells as 0 or 1.