Game Development Reference
In-Depth Information
if (match >= matchesNeeded) {
pass = true;
break;
}
}
else {
match = 0;
}
}
score = pass ? score : 0;
return score;
}
Scoring.getFullHouse = function () {
var pass = false;
var score = 0;
if (this.dice[0] == this.dice[1] && this.dice[1] != this.dice[2] &&
this.dice[2] == this.dice[3] && this.dice[3] == this.dice[4]) {
pass = true;
}
else if (this.dice[0] == this.dice[1] && this.dice[1] == this.dice[2] &&
this.dice[2] != this.dice[3] && this.dice[3] == this.dice[4]) {
pass = true;
}
score = pass ? 25 : 0;
return score;
}
Scoring.getChance = function () {
var score = 0;
for (var i = 0; i < this.dice.length; i++) {
score += this.dice[i];
}
return score;
}
Scoring.getFakezee = function () {
var pass = false;
var score = 0;
if (this.dice[0] == this.dice[1] && this.dice[1] == this.dice[2] &&
this.dice[2] == this.dice[3] && this.dice[3] == this.dice[4]) {
pass = true;
}
score = (pass ? 50 : 0);
return score;
}
//UTIL
Scoring.uniqueArray = function (a) {
var temp = {};
for (var i = 0; i < a.length; i++) {
temp[a[i]] = true;
}
 
Search WWH ::




Custom Search