/************************************************************* * results.js.php * * Code to display results to the user. * * Author: Yuechen Zhao * Last Modified: Dianna Hu - July 17, 2013 * * © Copyright 2013 Intelligent and Interactive Systems * Group, Harvard University. * For questions about this file and permission to use * the code, contact us at info@labinthewild.org *************************************************************/ function prettyTime(resp_time) { var display_time; if(resp_time > 1000) { display_time = resp_time / 1000 + " seconds"; } else { display_time = resp_time + " milliseconds"; } return display_time; } var cheetah_time = 800; // function to display results function results(exp_results) { $$$("ajax_working").style.display = 'none'; hideNextButton(); var titles = { "cheetah": "You were a cheetah!", "antelope": "You were an antelope!", "jackrabbit": "You were a jackrabbit!", "gazelle": "You were a gazelle!", "zebra": "You were a zebra!", "tiger": "You were a tiger!", "elephant": "You were an elephant!", "tortoise": "You were a tortoise..." } var resp_time = Math.round(exp_results["overall_avg_resp_time"]); var display_time = prettyTime(resp_time); var correct_percentage = Math.round((exp_results["correct_change_detections"] + exp_results["focal_detection_trials"]) * 100 / exp_results["exp_trial_count"]); // Add a little note saying how much faster they need to be to be a // cheetah var until_cheetah = ""; if(resp_time > cheetah_time) { until_cheetah = 'You could have been a cheetah if you were ' + prettyTime(resp_time - cheetah_time) + ' faster! '; } // Add a little note/joke if the user was really slow var slowness_message = ""; if(exp_results["animal"] == "tortoise") { slowness_message = 'Maybe you should get some coffee... '; } var html = "

" + titles[exp_results["animal"]] + "

" + "

" + "

" + "" + "



" + until_cheetah + 'On average, your response time for noticing changes was ' + display_time + ' among the ones you got correct. ' + slowness_message + 'For your accuracy, you got ' + correct_percentage + '% correct.' + "

"; html += "

" + 'This experiment was first introduced in Boduroglu, A., Shah, P., & Nisbett, R. E. (2009). Cultural differences in allocation of attention in visual information processing. Journal of Cross-Cultural Psychology, 40(3), 349-360.' + "

" + 'In the original experiment, the authors demonstrated that East Asians were more accurate than Americans in noticing which of the four colored squares changed color when their positions shifted to cover a wider area. Conversely, Americans were better at noticing changes at the center of the screen, for instance, when the cross changes into a square. We\'re hoping to extend this finding with more participants in more countries.' + "

" window.onbeforeunload = null; $("#results").html(html); showSlide("results"); showFooter(["Where in the world should you have a meal?", "What is your thinking style?"]); }