Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix std() function and message texts. #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions scripts/bread.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,9 @@ function std(arr){
mean /= arr.length;
var stdval = 0;
for (var i =0; i<arr.length;i++){
stdval += pow((arr[i]-mean),2)
stdval += (arr[i]-mean)**2 / arr.length
}
return sqrt(stdval);

return stdval**0.5;
}

//Update the canvas look by overlaying the cutting board over the slicing lines. then update the message response in accordance to a 'eveness' score calculated using standard deviation of the areas of all the regions.
Expand Down Expand Up @@ -519,7 +518,10 @@ function check_and_update_board(){
var randomNum = round(random(0,paMessages5_1.length-1));
$("#messageResponse").text(paMessages5_1[randomNum]);
}

else {
var randomNum = round(random(0,paMessages4.length-1));
$("#messageResponse").text(paMessages4[randomNum]);
}
}
}

Expand Down