I'm developing the memory game in javascript (based on this tutorial: http://www.developphp.com/view.php?tid=1393 ), and now i need to calculate a fair score, based on these conditions: - The game consists of 4x4 cards (that means there are 16 cards) therefore, it takes at the very least 8 attempts (every 2 cards flipped counts as an attempt) - The game has a count down timer of 45 seconds
So, in short, the best final score will have: - 8 attempts, ~10 seconds ellapsed time, 0 cards left to find. For every further attempt, elapsed time or/and cards left, the score will be decreased
How can i accomplish something like this?
Below, is the code i have written so far:
nrTries =8;
time = 35;
tilesLeft = 0;
function calcScore(){
var triesBonus = (nrTries * 700) / 8;
var timeBonus = ((45 - time) == 0) ? 10 : (45 - time);
//timeBonus = (timeBonus*500) / 10;
console.log((triesBonus+'|'+timeBonus));
//score += score - ((tilesLeft / 2)*6);
//return score;
}
//console.log(calcScore());
calcScore();
Thanks in advance!