LoginSignup
5
1

More than 3 years have passed since last update.

SATySFiでカルノー図

Last updated at Posted at 2019-08-11

レポートに載せる必要があってTeXとかで作ろうとしたけど良い感じのを見つけられなかったので結局SATySFiで書いた。
こんなんが

let-math \dc = ${\dontcare} in
{
  \karnaugh-map(${xy})(${zw}) [
    ${| 1   | 0   | 0   | 1   |};
    ${| 1   | 1   | 0   | 1   |};
    ${| \dc | \dc | \dc | \dc |};
    ${| 1   | 0   | \dc | \dc |};
  ] [
    Karnaugh.box  (0, 1);
    Karnaugh.tall (3, 0);
  ];
}
{
  \karnaugh-map(${AB})(${C}) [
    ${| 1 | 1 | 0 | 1 |};
    ${| 1 | 0 | 0 | 0 |};
  ] [
    Karnaugh.slim (0, 0);
    Karnaugh.flat (0, 0);
    Karnaugh.flat (3, 0);
  ];
}

こんなんになる

example.png

(囲み枠のマージンがそれぞれ変わるようになっていないので線が重なって見にくい。)

方法

SATySFiの表組では、表の内容のほかに、各行/列の境界の座標を受け取って表の罫線を返す関数を指定できる。その関数として、カルノー図の囲み枠(?)を返すものを渡すことで表内に囲み枠を描けるので、頑張ってカルノー図が書けるようになった。Karnaugh.box等はそのような関数を作る関数である。


リポジトリです→ https://github.com/takagiy/satysfi-karnaugh

5
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
1