//Adds into sDet till full and returns true if successful public bool addFull(int num) { while (!isFull()) { dice d = new dice(num); addDice(d); } return(true); }
//Add a dice to dSet returns true if added else false public bool addDice(dice d) { if (isFull())//Checks if dSet is full { return(false); } dSet[amount] = d;//Add to dSet amount++; return(true); }
//This method try to get an item using posion, number or size then might delete it public bool getAndDeleteDice(int num, string type, bool delete) { if (isEmpty())//Check if dSet is empty { return(false); } int element = -1; switch (type)//Checks way to find the dice { case "size": if (sizeDice(num)) //Checking by number { element = getRetNum(); //Geting element postion } break; case "number": if (numDice(num)) //Checking by size { element = getRetNum(); //Geting element postion } break; case "element": if (elemDice(num)) //Checking for element { element = getRetNum(); //Geting element postion } break; default: return(false); } if (element != -1)//Checks a value is found { retDice = dSet[element]; retNum = dSet[element].getNumber(); if (delete)//Check if delete is found { dice[] temp = dSet; amount--; for (int j = element; j < amount; j++)//Loop though each value saving over the delete value { dSet[j] = temp[j + 1]; } } return(true); } return(false); }