Or, perhaps it’s a pretty normal thing. But again, the entire experience is being blatantly counter-intuitive.
I’m not sure how to fix this. There are an equal number of times when I think I can make out that DiceOnHand needs it’s math reconfigured, and reset back to 1
OR
For some reason, the blink throws back up one random colored face.
In Liars Dice, everyone rolls five dice in secret. After this is done, there are rounds of bidding, that declares at a minimum, how many dice of a given number, in grand total, are on the table. Each bid must either increase the number of dice, or increase the current rank of the pip count. If a player bids that there are Two Threes on the table, the next bid must be either Three Threes on the table, or Two Fours. This continues until the bid is challenged. If a challenge is successful, and the bider did not have what he bid actually on the table, after all dice are revealed, he looses a die for the rest of the game.
A Common dice game, in the Pirates Of The Caribbean movies, also marketed under the name Perudo. Etc. Etc. Etc. The game isn’t fleshed out quite yet, as I ((Obviously)) took from my Kingmaker code and wanted to play around a bit. Liars dice felt like a natural step up here. And I thought, [[Heh]] I could tackle it.
byte currentColor = 0;
byte GemColorRandomizer1 = 0;
byte GemColorRandomizer2 = 0;
byte GemColorRandomizer3 = 0;
byte GemColorRandomizer4 = 0;
byte GemColorRandomizer5 = 0;
int DiceOnHand = 1;
//Declaring Variables Fairly certain this can get cleaned up with better code.
Color GemColorList[6] = {RED, ORANGE, YELLOW, GREEN, BLUE, MAGENTA};
//The "numbers" on the dice. Selected these because they were predefined. A better curation here may help.
void setup() {
randomize();
GemColorRandomizer1 = random(5);
GemColorRandomizer2 = random(5);
GemColorRandomizer3 = random(5);
GemColorRandomizer4 = random(5);
GemColorRandomizer5 = random(5);
}
void loop() {
if (buttonSingleClicked()) {
setColorOnFace(OFF, 1);
setColorOnFace(OFF, 2);
setColorOnFace(OFF, 3);
setColorOnFace(OFF, 4);
setColorOnFace(OFF, 5);
}
// A Single Click to "hide" the dice under your cup, in case real life calls you away from the game.
if (buttonLongPressed()) {
if (DiceOnHand == 1) {
setColorOnFace(GemColorRandomizer1[GemColorList], 1);
setColorOnFace(GemColorRandomizer2[GemColorList], 2);
setColorOnFace(GemColorRandomizer3[GemColorList], 3);
setColorOnFace(GemColorRandomizer4[GemColorList], 4);
setColorOnFace(GemColorRandomizer5[GemColorList], 5);
}
if (DiceOnHand == 2) {
setColorOnFace(GemColorRandomizer1[GemColorList], 1);
setColorOnFace(GemColorRandomizer2[GemColorList], 2);
setColorOnFace(GemColorRandomizer3[GemColorList], 3);
setColorOnFace(GemColorRandomizer4[GemColorList], 4);
}
if (DiceOnHand == 3) {
setColorOnFace(GemColorRandomizer1[GemColorList], 1);
setColorOnFace(GemColorRandomizer2[GemColorList], 2);
setColorOnFace(GemColorRandomizer3[GemColorList], 3);
}
if (DiceOnHand == 4) {
setColorOnFace(GemColorRandomizer1[GemColorList], 1);
setColorOnFace(GemColorRandomizer2[GemColorList], 2);
}
if (DiceOnHand == 5) {
setColorOnFace(GemColorRandomizer1[GemColorList], 1);
}
if (DiceOnHand == 6) {
DiceOnHand = 1;
}
//Lengthy Math to roll only the number of dice that you currently still have in play. Another instance where I am certain that this can be expedited with better code.
}
if (buttonDoubleClicked())
{
DiceOnHand = (DiceOnHand + 1) % 6;
}
if (buttonMultiClicked())
{
setColor(OFF);
GemColorRandomizer1 = random(5);
GemColorRandomizer2 = random(5);
GemColorRandomizer3 = random(5);
GemColorRandomizer4 = random(5);
GemColorRandomizer5 = random(5);
}
// code to re-roll the dice
}