In a round of Ludo or Parcheese, nothing is better than winning, or at least having lots of 6s and bringing all the pieces on the field.
With a normal dice you need a lot of luck. Children can help there luck with these versions of the Arduino program of my Cube for Kids.
If you got the dice for your own, you could simply increase the probability and make a 6 occur more frequently.
This works in source code with an additional condition.
zufall=zufall%6; //result is number 0..5
if zufall<>5 {zufall=millis()%6;} //dice again if no 6!
But that quickly comes up and it's possible that all other players throw the electronic dice. Who wants that others often have a 6?
Version 2Better is an inconspicuous variant: During dicing (= key pressed), the holding time of the key is measured. If this is between 3 and 4 seconds, the throw becomes a 6.
spezial=millis()-spezial;
if ((spezial>3000) and (spezial<4000)) {
zufall=5; //6!
}
Version 3That's quite good, but could be noticed over time. Less noticeable, if only the probability of a 6 in the interval of 2..3 seconds is increased.
It looks like this:
spezial=millis()-spezial;
if ((spezial>2000) and (spezial<3000)) {
if (zufall!=5) {zufall=millis()%6;} //dice again, if no 6!
}
Pimped cubeThe cube animation is best suited for that. This change makes it easy to set even more effects.
// LED order
// 1 2
// 3 7 4
// 5 6
int wuerfelBild[8][7]=
{{0,0,0,0,0,0,0}, //0 = all LED's off
{0,0,0,0,0,0,1}, //1
{0,1,0,0,1,0,0}, //2
{1,0,0,0,0,1,1}, //3
{1,1,0,0,1,1,0}, //4
{1,1,0,0,1,1,1}, //5
{1,1,1,1,1,1,0}, //6
{1,1,1,1,1,1,1}}; //7 = all LED's on
int lauflichtmax=6;
int lauflicht[6]= { 1, 7, 6, 2, 7, 5}; //LED number
int lauflichtpause[6]={ 60,100,180,180,100, 60}; //time in ms
Or something like a Knight-Rider effect:
int lauflichtmax=6;
int lauflicht[6]= { 3, 7, 4, 4, 7, 3}; // sequence of LED's
int lauflichtpause[6]={100,180,100,100,180,100}; // time in ms
Have fun with inconspicuous cheating and pimples.
PS: Wenn Sie das Projekt in Deutsch lesen möchten, schauen Sie in meinen Blog auf techpluscode.de.
Comments