仕様
繰り返し何度も計算ができること
小数点付きの数を使用できること
加減乗除が可能なこと
不正な入力を行っても、再起動なしに通常の計算に復帰できること
void setup() {
size(500,1300);
}
void draw() {
fill(255);
rect(0, 0, 500, 60);// 計算過程と計算結果の表示
strokeJoin(MITER);
rect(80, 100, 80, 120); // 1
strokeJoin(BEVEL);
rect(200, 100, 80, 120); // 2
strokeJoin(ROUND);
rect(320, 100, 80, 120); //3
strokeJoin(MITER);
rect(80, 300, 80, 120); //4
strokeJoin(BEVEL);
rect(200, 300, 80, 120); //5
strokeJoin(ROUND);
rect(320, 300, 80, 120); //6
strokeJoin(MITER);
rect(80, 500, 80, 120); //7
strokeJoin(BEVEL);
rect(200, 500, 80, 120); //8
strokeJoin(ROUND);
rect(320,500, 80, 120); //9
strokeJoin(MITER);
rect(80, 700, 80, 120); //+
strokeJoin(BEVEL);
rect(200, 700, 80, 120); //-
strokeJoin(ROUND);
rect(320, 700, 80, 120); //*
strokeJoin(MITER);
rect(80, 900, 80, 120); // /
strokeJoin(BEVEL);
rect(200, 900, 80, 120); //.
strokeJoin(ROUND);
rect(320, 900, 80, 120); //=
strokeJoin(MITER);
rect(80, 1100, 80, 120); //reset
strokeJoin(BEVEL);
rect(200, 1100, 80, 120); //(
strokeJoin(ROUND);
rect(320,1100, 80, 120); //)
}
矩形の中心に演算子と数字を文字として埋めてマウスでクリックするとそれらが計算過程として出るようにしたいです
つまり、矩形の中心に文字(数字や演算子)を入れる、それらをクリックして推せるようにする
文脈自由文法で計算する、エラーが起きないようするといったことが知りたいです
これを文脈自由文法または状態遷移図を用いたアルゴリズムで作成したいです
どうすればいいでしょうか
あなたの回答
tips
プレビュー