I really thought I was going to finish Tank Street Dominoes before work today.
Below, variable ClickTell informs what value to send on the faces of the " buildings " [Double Click] that the “cars” [Multi Click] receive and respond to when the cars are connected to a building blink, and the faces of the car and the building match in color. Much like in dominoes.
I have the buildings successfully cycling Green Red Yellow Blue. This is expected. However, once past the first Blue, when the blink’s colors go back to green, ClickTell does not.
Because ClickTell does not “reset” it no longer sets the correct value on the faces, and therefore, the cars can no longer cross the corresponding “” errand “” off their list / turn off the matching face on the car.
Not sure what to do with the math at this point, I’ve done various math checks at 4 and 5, equal to, greater than, … as well as setting ClickTell to 0, -1, and even subtracting 4 from click tell.
Apparently the answer is none of the above, or anything close to the above.
// Tank Street Dominoes The Not Knot 7/7
byte BuildingColor = 0;
byte CarColor = 0;
byte ClickTell = 0;
Color CarColorList[4] = {CYAN, WHITE, ORANGE, MAGENTA};
Color BuildingColorList[4] = {GREEN, RED, YELLOW, BLUE};
void setup() {
setColor(OFF);
}
void loop() {
if (buttonLongPressed()){
setColorOnFace(dim (CarColorList[CarColor], 100), 2);
setColorOnFace(OFF, 5);
CarColor = (CarColor + 1) % 4;
}
if (buttonDoubleClicked()){
setColorOnFace(BuildingColorList[BuildingColor], 0);
setColorOnFace(BuildingColorList[BuildingColor], 1);
setColorOnFace(BuildingColorList[BuildingColor], 3);
setColorOnFace(BuildingColorList[BuildingColor], 4);
BuildingColor = (BuildingColor + 1) % 4;
setValueSentOnAllFaces(++ClickTell);
}
if (buttonMultiClicked()){
setColorOnFace(GREEN, 0);
setColorOnFace(RED, 1);
setColorOnFace(YELLOW, 3);
setColorOnFace(BLUE, 4);
}
if (buttonSingleClicked())
{
if (getLastValueReceivedOnFace(0) == 1 && isValueReceivedOnFaceExpired(1) && isValueReceivedOnFaceExpired(3) && isValueReceivedOnFaceExpired(4))
{
setColorOnFace (OFF, 0);
//Green Single Off
}
if (getLastValueReceivedOnFace(1) == 2 && isValueReceivedOnFaceExpired(0) && isValueReceivedOnFaceExpired(3) && isValueReceivedOnFaceExpired(4))
{
setColorOnFace (OFF, 1);
//Red Single Off
}
if (getLastValueReceivedOnFace(3) == 3 && isValueReceivedOnFaceExpired(1) && isValueReceivedOnFaceExpired(0) && isValueReceivedOnFaceExpired(4))
{
setColorOnFace (OFF, 3);
//Yellow Single Off
}
if (getLastValueReceivedOnFace(4) == 4 && isValueReceivedOnFaceExpired(1) && isValueReceivedOnFaceExpired(3) && isValueReceivedOnFaceExpired(0))
{
setColorOnFace (OFF, 4);
//Blue Single Off
}
if (getLastValueReceivedOnFace(0) == 1 && getLastValueReceivedOnFace(1) == 2 && isValueReceivedOnFaceExpired(3) && isValueReceivedOnFaceExpired(4))
{
setColorOnFace (OFF, 0);
setColorOnFace (OFF, 1);
//Doubles. Green and Red off.
}
if (getLastValueReceivedOnFace(3) == 3 && getLastValueReceivedOnFace(4) == 4 && isValueReceivedOnFaceExpired(0) && isValueReceivedOnFaceExpired(1))
{
setColorOnFace (OFF, 3);
setColorOnFace (OFF, 4);
//Doubles. Yellow and Blue off.
}
if (getLastValueReceivedOnFace(3) == 3 && getLastValueReceivedOnFace(4) != 4 && isValueReceivedOnFaceExpired(0) && isValueReceivedOnFaceExpired(1))
{
setColorOnFace (OFF, 3);
//Yellow Off, Blue Touches Non Blue
}
if (getLastValueReceivedOnFace(1) == 2 && getLastValueReceivedOnFace(0) != 1 && isValueReceivedOnFaceExpired(3) && isValueReceivedOnFaceExpired(4))
{
setColorOnFace (OFF, 1);
//Red Off, Green touches Non Green
}
if (getLastValueReceivedOnFace(0) == 1 && getLastValueReceivedOnFace(1) != 2 && isValueReceivedOnFaceExpired(3) && isValueReceivedOnFaceExpired(4))
{
setColorOnFace (OFF, 0);
//Green Off, Red touches Non Red
}
if (getLastValueReceivedOnFace(4) == 4 && getLastValueReceivedOnFace(3) != 3 && isValueReceivedOnFaceExpired(0) && isValueReceivedOnFaceExpired(1))
{
setColorOnFace (OFF, 4);
//Blue Off, Yellow Touches Non Yellow
}
}
//another attempt at ClickTell reset below, comment out as needed
if (ClickTell >=4){
ClickTell = -1;
}
//ClickTell Attempt End
}