Observations
diff --git a/experiment/simulation/js/euclidean-division.js b/experiment/simulation/js/euclidean-division.js
index ca8de3a..49a5b5d 100644
--- a/experiment/simulation/js/euclidean-division.js
+++ b/experiment/simulation/js/euclidean-division.js
@@ -5,28 +5,28 @@ const mField4 = document.getElementById("m-field-4");
const mField5 = document.getElementById("m-field-5");
function confirm1() {
-
const obs1 = document.getElementById("observations1");
const inp1 = mField1.value;
+ const inp2 = mField2.value;
+ const inp3 = mField3.value;
+ const inp4 = mField4.value;
- if (inp1.length == 0) {
+ if (inp1.length == "0" || inp2.length == "0" || inp3.length == "0" || inp4.length == "0") {
obs1.innerHTML = "Enter the answer."
obs1.style.color = "black";
}
- else if (inp1 == "x^2+x" || inp1 == "x+x^2") {
- obs1.innerHTML = "
Correct Answer!!!";
+ else if ((inp1 == "x^2+1" || inp1 == "1+x^2") && inp2 == "1" && (inp3 == "x^2+x" || inp3 == "x+x^2") && (inp4 == "x+x^2" || inp4 == "x^2+x")) {
+ obs1.innerHTML = "
Correct Answer!!! Fill the next row";
obs1.style.color = "green";
document.getElementById("submit1").setAttribute("disabled", true);
document.getElementById("submit2").removeAttribute("disabled");
-
mField1.setAttribute("disabled", true);
- mField2.removeAttribute("disabled");
- mField3.removeAttribute("disabled");
- mField4.removeAttribute("disabled");
+ mField2.setAttribute("disabled", true);
+ mField3.setAttribute("disabled", true);
+ mField4.setAttribute("disabled", true);
mField5.removeAttribute("disabled");
-
}
else {
@@ -38,24 +38,24 @@ function confirm1() {
obs1.innerHTML = "
Wrong Answer :(";
}
}
-
}
function confirm2() {
+
const obs1 = document.getElementById("observations1");
- const inp2 = mField2.value;
- const inp3 = mField3.value;
- const inp4 = mField4.value;
const inp5 = mField5.value;
- if (inp2.length == "0" || inp3.length == "0" || inp4.length == "0" || inp5.length == "0") {
+ if (inp5.length == 0) {
obs1.innerHTML = "Enter the answer."
obs1.style.color = "black";
}
- else if ((inp2 == "x^2+1" || inp2 == "1+x^2") && inp3 == "1" && (inp4 == "x^2+x" || inp4 == "x+x^2") && (inp5 == "1+x" || inp5 == "x+1")) {
- obs1.innerHTML = "
Correct Answer!!! The GCD is x
2+1";
+ else if (inp5 == "x+1" || inp5 == "1+x") {
+ obs1.innerHTML = "
Correct Answer!!! The GCD is x
2+1";
obs1.style.color = "green";
+
+ mField5.setAttribute("disabled", true);
+ document.getElementById("submit2").setAttribute("disabled", true);
}
else {
@@ -67,11 +67,13 @@ function confirm2() {
obs1.innerHTML = "
Wrong Answer :(";
}
}
+
}
+
// Second Example
const mathField1 = document.getElementById("math-field-1");
const mathField2 = document.getElementById("math-field-2");
@@ -85,27 +87,32 @@ const mathField9 = document.getElementById("math-field-9");
function check1() {
-
const obs2 = document.getElementById("observations2");
const inp1 = mathField1.value;
+ const inp2 = mathField2.value;
+ const inp3 = mathField3.value;
+ const inp4 = mathField4.value;
- if (inp1.length == 0) {
- obs2.innerHTML = "Enter the answer."
+ if (inp1.length == "0" || inp2.length == "0" || inp3.length == "0" || inp4.length == "0") {
+ obs2.innerHTML = "Enter all the fields."
obs2.style.color = "black";
}
-
- else if (inp1 === "x^3") {
- obs2.innerHTML = "
Correct Answer!!!";
+ else if ((inp1 == "x^2+1" || inp1 == "1+x^2") && inp2 == "1" && inp3 == "x^3" && inp4 == "x^3") {
obs2.style.color = "green";
+ obs2.innerHTML = "
Correct Answer!!! Fill the next row";
document.getElementById("sub1").setAttribute("disabled", true);
document.getElementById("sub2").removeAttribute("disabled");
mathField1.setAttribute("disabled", true);
- mathField2.removeAttribute("disabled");
- mathField3.removeAttribute("disabled");
- mathField4.removeAttribute("disabled");
+ mathField2.setAttribute("disabled", true);
+ mathField3.setAttribute("disabled", true);
+ mathField4.setAttribute("disabled", true);
+
mathField5.removeAttribute("disabled");
+ mathField6.removeAttribute("disabled");
+ mathField7.removeAttribute("disabled");
+ mathField8.removeAttribute("disabled");
}
else {
@@ -117,40 +124,36 @@ function check1() {
obs2.innerHTML = "
Wrong Answer :(";
}
}
-
}
function check2() {
const obs2 = document.getElementById("observations2");
- const inp2 = mathField2.value;
- const inp3 = mathField3.value;
- const inp4 = mathField4.value;
const inp5 = mathField5.value;
+ const inp6 = mathField6.value;
+ const inp7 = mathField7.value;
+ const inp8 = mathField8.value;
- if (inp2.length == "0" || inp3.length == "0" || inp4.length == "0" || inp5.length == "0") {
+ if (inp5.length == "0" || inp6.length == "0" || inp7.length == "0" || inp8.length == "0") {
obs2.innerHTML = "Enter all the fields."
obs2.style.color = "black";
}
- else if ((inp2 == "x^2+1" || inp2 == "1+x^2") && inp3 == "1" && inp4 == "x^3" && inp5 == "x") {
- obs2.style.color = "green";
- if (obs2.innerHTML == "
Correct Answer!!!") {
- obs2.innerHTML = "
Correct Again!!!";
- }
- else {
- obs2.innerHTML = "
Correct Answer!!!";
+ else if ((inp5 == "x+1" || inp5 == "1+x") && inp6 == "x" && (inp7 == "1+x^4" || inp7 == "x^4+1") && inp8 == "x") {
+ if(obs2.innerHTML == "
Correct Answer!!! Fill the next row") {
+ obs2.innerHTML = "
Correct Again!!! Fill the next row";
+ obs2.style.color = "green";
}
-
+ else{
+ obs2.innerHTML = "
Correct Answer!!! Fill the next row";
+ obs2.style.color = "green";
+ }
document.getElementById("sub2").setAttribute("disabled", true);
document.getElementById("sub3").removeAttribute("disabled");
- mathField2.setAttribute("disabled", true);
- mathField3.setAttribute("disabled", true);
- mathField4.setAttribute("disabled", true);
mathField5.setAttribute("disabled", true);
+ mathField6.setAttribute("disabled", true);
+ mathField7.setAttribute("disabled", true);
+ mathField8.setAttribute("disabled", true);
- mathField6.removeAttribute("disabled");
- mathField7.removeAttribute("disabled");
- mathField8.removeAttribute("disabled");
mathField9.removeAttribute("disabled");
}
@@ -166,20 +169,20 @@ function check2() {
}
function check3() {
+
const obs2 = document.getElementById("observations2");
- const inp6 = mathField6.value;
- const inp7 = mathField7.value;
- const inp8 = mathField8.value;
const inp9 = mathField9.value;
- if (inp6.length == "0" || inp7.length == "0" || inp8.length == "0" || inp9.length == "0") {
- obs2.innerHTML = "Enter all the fields."
+ if (inp9.length == 0) {
+ obs2.innerHTML = "Enter the answer."
obs2.style.color = "black";
}
- else if ((inp6 == "x+1" || inp6 == "1+x") && inp7 == "x" && (inp8 == "1+x^4" || inp8 == "x^4+1") && (inp9 == "x+1" || inp9 == "1+x")) {
+
+ else if (inp9 === "1+x" || inp9 === "x+1") {
obs2.innerHTML = "
Correct Answer!!! The GCD is 1+x";
obs2.style.color = "green";
-
+ document.getElementById("sub3").setAttribute("disabled", true);
+ mathField9.setAttribute("disabled", true);
}
else {
@@ -191,6 +194,7 @@ function check3() {
obs2.innerHTML = "
Wrong Answer :(";
}
}
+
}
function page1() {
@@ -205,9 +209,9 @@ function page1() {
obs1.innerHTML = "";
mField1.removeAttribute("disabled");
- mField2.setAttribute("disabled", true);
- mField3.setAttribute("disabled", true);
- mField4.setAttribute("disabled", true);
+ mField2.removeAttribute("disabled");
+ mField3.removeAttribute("disabled");
+ mField4.removeAttribute("disabled");
mField5.setAttribute("disabled", true);
@@ -230,9 +234,9 @@ function page2() {
obs2.innerHTML = "";
mathField1.removeAttribute("disabled");
- mathField2.setAttribute("disabled", true);
- mathField3.setAttribute("disabled", true);
- mathField4.setAttribute("disabled", true);
+ mathField2.removeAttribute("disabled");
+ mathField3.removeAttribute("disabled");
+ mathField4.removeAttribute("disabled");
mathField5.setAttribute("disabled", true);
mathField6.setAttribute("disabled", true);
mathField7.setAttribute("disabled", true);