Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Commit

Permalink
intro proofs vertical case working
Browse files Browse the repository at this point in the history
  • Loading branch information
mwittels committed Jul 10, 2012
1 parent 99d4689 commit 6316168
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 11 deletions.
4 changes: 2 additions & 2 deletions exercises/geometry_proofs_1.html
Expand Up @@ -397,12 +397,12 @@
<div class="instruction"> <div class="instruction">
Fill in the blanks in this proof that <var> FINISHED </var>. Fill in the blanks in this proof that <var> FINISHED </var>.
</div> </div>
<div class="guess">[outputKnownProof()]</div> <div class="guess">1</div>
<div class="validator-function"> <div class="validator-function">
return FILL_BLANKS_NUM==0; return FILL_BLANKS_NUM==0;
</div> </div>
<div class="show-guess"> <div class="show-guess">

return outputKnownProof();
</div> </div>
</div> </div>
<div class="hints"> <div class="hints">
Expand Down
24 changes: 17 additions & 7 deletions exercises/geometry_proofs_intro.html
Expand Up @@ -160,17 +160,19 @@
return; return;
} }


var verifyTriangles = verifyStatementArgs(thing1+"="+thing2, reason, "triangle congruence"); var verifyTriangles = thing1.length === 3 && thing2.length === 3 ? verifyStatementArgs(thing1+"="+thing2, reason, "triangle congruence") : false;
var verifyAngles = verifyStatementArgs(thing1+"="+thing2, reason, "angle equality"); var verifyAngles = thing1.length === 3 && thing2.length === 3 ? verifyStatementArgs(thing1+"="+thing2, reason, "angle equality") : false;
var verifySegments = verifyStatementArgs(thing1+"="+thing2, reason, "segment equality"); var verifySegments = thing1.length === 2 && thing2.length === 2 ? verifyStatementArgs(thing1+"="+thing2, reason, "segment equality") : false;


if(verifyTriangles === true || verifyAngles === true || verifySegments === true){ if(verifyTriangles === true || verifyAngles === true || verifySegments === true){
$(".statements").html(outputKnownProof()); $(".statements").html(outputKnownProof());
_.each($(".statements code"), function(tag){ $.tmpl.type.code()(tag); }); _.each($(".statements code"), function(tag){ $.tmpl.type.code()(tag); });
console.log("thinks statement is true"); console.log("thinks statement is true " + reason);
$("#thing1").val(""); $("#thing1").val("");
$("#thing2").val(""); $("#thing2").val("");
$("#reason").val(""); $("#reason").val("");
$("#symbol1").html("");
$("#symbol2").html("");
if(userProofDone === true){ if(userProofDone === true){
$(".nextStatement").hide(); $(".nextStatement").hide();
$("#hint").attr("disabled", true); $("#hint").attr("disabled", true);
Expand All @@ -193,8 +195,16 @@
$("#symbol1").html(" \\triangle "); $("#symbol1").html(" \\triangle ");
$("#symbol2").html(" \\triangle "); $("#symbol2").html(" \\triangle ");
} }
$("#symbol1").html(" \\angle "); else if(curVal === "vertical angles" || curVal === "alternate angles"){
$("#symbol1").html(" \\angle ");
$("#symbol2").html(" \\angle ");
}
else{
$("#symbol1").html("");
$("#symbol2").html("");
}
$.tmpl.type.code()($("#symbol1")[0]); $.tmpl.type.code()($("#symbol1")[0]);
$.tmpl.type.code()($("#symbol2")[0]);
$(".nextStatement input").keyup(); $(".nextStatement input").keyup();
}); });


Expand Down Expand Up @@ -239,12 +249,12 @@
<div class="instruction"> <div class="instruction">
When you enter the next statement in the proof, and a valid reason, that statement will be added to the proof. When you're done, hit check answer. When you enter the next statement in the proof, and a valid reason, that statement will be added to the proof. When you're done, hit check answer.
</div> </div>
<div class="guess">[knownEqualities]</div> <div class="guess">1</div>
<div class="validator-function"> <div class="validator-function">
return isProofDone(); return isProofDone();
</div> </div>
<div class="show-guess"> <div class="show-guess">

return knownEqualities;
</div> </div>
</div> </div>
<div class="hints"> <div class="hints">
Expand Down
12 changes: 10 additions & 2 deletions utils/proofs.js
Expand Up @@ -197,6 +197,7 @@ function verifyStatement() {
} }


function verifyStatementArgs(statement, reason, category) { function verifyStatementArgs(statement, reason, category) {
console.log("verifyStatementArgs with ", statement, reason, category);
if (userProofDone) { if (userProofDone) {
//return false; //return false;
} }
Expand Down Expand Up @@ -240,6 +241,9 @@ function verifyStatementArgs(statement, reason, category) {
else if (triangle1Permutation != triangle2Permutation) { else if (triangle1Permutation != triangle2Permutation) {
return false; return false;
} }
else if (eqIn([triangle1, triangle2], knownEqualities)){
return "that's already in the proof!";
}
else { else {
toReturn = checkTriangleCongruent(triangle1, triangle2, reason); toReturn = checkTriangleCongruent(triangle1, triangle2, reason);
} }
Expand All @@ -260,7 +264,9 @@ function verifyStatementArgs(statement, reason, category) {
if (ang1 == null || ang2 == null) { if (ang1 == null || ang2 == null) {
return "those angles aren't in this figure..."; return "those angles aren't in this figure...";
} }

else if (eqIn([ang1, ang2], knownEqualities)){
return "that's already in the proof!";
}
else { else {
toReturn = checkAngEqual(ang1, ang2, reason); toReturn = checkAngEqual(ang1, ang2, reason);
} }
Expand All @@ -283,7 +289,9 @@ function verifyStatementArgs(statement, reason, category) {
if (seg1 == null || seg2 == null) { if (seg1 == null || seg2 == null) {
return "those segments aren't in this figure..."; return "those segments aren't in this figure...";
} }

else if (eqIn([seg1, seg2], knownEqualities)){
return "that's already in the proof!";
}
else { else {
toReturn = checkSegEqual(seg1, seg2, reason); toReturn = checkSegEqual(seg1, seg2, reason);
} }
Expand Down

0 comments on commit 6316168

Please sign in to comment.