Commit 730f2e2d authored by au593919's avatar au593919
Browse files

mean movement time displays when game is over

parent 82608e4c
......@@ -17,11 +17,11 @@ var mt = 0 //movement time
var width
var distance
var widths = [10, 30, 50]
var distances = [-200, 300, -400, 450, 250, -300]
var distances = [150, 150, 150, 300, 300, 300, 450, 450, 450]
var startedAtresetBox = true //trial starts at left box
var completedCombinations = [] //array including all combinations completed
var counter = -1
var numberOfConditions = 6 //number of total conditions
var numberOfConditions = 9 //number of total conditions
function calculateHitrate(points, numberOfRounds) {
return points / numberOfRounds * 100
......@@ -75,11 +75,11 @@ function generateHorizontalMolePosition() {
//get indices for calibration phase
function getFixedIndices() {
let indices = []
indices.push(indexToGetCalibrationWidth, indexToGetCalibrationDistance)
completedCombinations.push([indexToGetCalibrationWidth, indexToGetCalibrationDistance])
if (indexToGetCalibrationWidth > 2) {
indexToGetCalibrationWidth = 0
}
indices.push(indexToGetCalibrationWidth, indexToGetCalibrationDistance)
completedCombinations.push([indexToGetCalibrationWidth, indexToGetCalibrationDistance])
indexToGetCalibrationWidth += 1
indexToGetCalibrationDistance += 1
return indices
......@@ -107,7 +107,7 @@ function quitExperiment() {
moleBox.remove()
resetBox.remove()
document.getElementById("roundDisplay").innerHTML = "Final score: " + points
document.getElementById("pointsDisplay").innerHTML = "Hitrate: " + calculateHitrate(points, 60) + "%"
document.getElementById("pointsDisplay").innerHTML = "Your hitrate was: " + calculateHitrate(points, 60) + "% and you mean movement time used was: " + meanTime + " milliseconds"
}
//check if condition is already completed. If so, true is returned, i.e. combination will not be tested again.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment