i created my dice as images so just needing to figure out how to be able to count how many of each die there are in the array . Such as how many 1's or 2's there are so that im able to compare that to possible yahtzee combinations
$(document).ready(function(){
var die1=$('.die1');
var die2=$('.die2');
var die3=$('.die3');
var die4=$('.die4');
var die5=$('.die5');
var turns=3;
//roll function
function roll(die){
var rando = Math.floor(Math.random()*6)+1;
die.html("<img src=images/die"+rando+".png>");
$('img').height(50);
};
$('.die').click(function(){
$(this).toggleClass('selected'); //adds border around die if clicked
});
//attaches roll funcition to each die
$('.button').click(function(){
for(i=0; i<=turns; turns--){
if(turns>0){
var dice =[die1,die2,die3,die4,die5];
for(i=0; i<dice.length;i++){
if (!dice[i].hasClass('selected')){
roll(dice[i]);
}
}
}
else{
$('.warning').html('Pick a category!');
}
}
}); //button function
});