On the Subject of Karnaugh Map

“Wait, is that the guy from the thermodynamix lore?”

  • The module shows a screen, 5x5 grid and 6 buttons: 1, 2, 3, 4, D, S.
  • To solve this module, you need to submit a logical expression represented by the given Karnaugh map; a 4x4 matrix filled with “0”s, “1”s and “*”s. Logical expressions consist of variables. standard variables are 1, 2, 3 and 4, and inverted variables are 1, 2, 3, 4.
  • To input a standard variable, press one of the corresponding buttons. To input an inverted variable press the corresponding button twice.
  • To input “+”, press the S button. To submit your logical expression, press the “S” button twice.
  • Press the “D” button to delete your last input.

How to calculate the logical expression:

  • Let’s call any rectangle on the matrix with both sides’ lengths being a power of 2 (1, 2 or 4) a group.
  • Find a group that covers at least one “1”, but does not cover any “0”s.
  • To calculate the logical expression’s part related to the observed group, input the common variables of all the group’s cells. To find the common variables:
    • Take the variables of one cell (for example, for B2 (view on the next page) they are 1234).
    • Take another cell from the group and compare their variables. Remove from consideration all variables, which are present in both standard and inverted states.
    • Keep comparing previously remaining variables with the variables related to the rest of the group’s cells. Upon examining new cells do not add a variable in either form, if it was previously removed from consideration.
  • Examine a few groups that cover all “1”s on the map and concatenate their expressions with a “+” sign to get the final logical expression (for example, 13+234).

Keep in mind:

  • The module can generate up to four “1”s and/or four “0”s on the map.
  • Groups can wrap around the map.
  • The module does not check the submitted expression for optimisation (meaning you can submit any valid expression).
  • Groups cannot consist of “*”s only.
  • A cell (containing “*” or “1”) can be used by multiple groups.
  • If there are no “1”s on the map, you have to submit “false”. To do so, press “S” when the screen is empty.
  • If there are no “0”s on the map, one of the solutions is to submit “true” for the entire map (to do so you have to submit an expression that covers the entire map. For example, 1+1 (you can use any variable, not only “1”s)).

Examples:

: For 1234 and 1234 common variables are 123.
Orange: Groups can overlap.
: Groups can wrap around the map.
: It is not a valid group, because one of the sides’ lengths is not a power of 2.
Orange: Groups cannot contain “0”s.
: Groups cannot consist of “*”s only.