Unexpected problem with New game "Main Street"

Below is my work in progress game “Main Street”, in relative terms to my other programs so far, this one is rough. even by my standards. Unplayable even. However, I can post what I have, and explain the issue.

I can get what I want to happen on exactly one color out of four ((And with that, only after moving the math around, to force it to work, not that I fully understand why it does it that way.))

With the code below, double click a blink three times, so that you have a blink with 4 red faces at 0, 1, 3, and 4, and OFF at 2 and 5.

Then Multi / Triple Click a second blink so that you have Red Yellow Blue and Green each on a face in the second blink.

Connect the two blinks, so that red touches, like dominoes.

Long press the second (multi colored) blink until red goes off on the multi colored blink.

I’d like to replicate this for each of the colors, the rule for “off” when colors match, and I thought my code allowed for that.

Take what value you can from my comments. It has some rules [[That aren’t fully there yet.]] and other failed starts in them, but I knocked this much out is pretty much one day, and even less than that, actual coding.

byte BuildingSend = 0;
byte BuildingColor = 0;
byte CarColor = 0;
Color CarColorList[4] = {CYAN, WHITE, ORANGE, MAGENTA};
Color BuildingColorList[4] = {GREEN, BLUE, RED, YELLOW};

void setup() {
  // put your setup code here, to run once:
//Main Street Pre-Alpha Feel-Around 06/23/21
//4 blinks in one row, connected. One blink for die. 4 blinks as cars. Each car has to go down "Main Street" to run errands on this very busy Saturday. 
//Green Grocers, A Doctor's Appointment, The Post Office, and The Library. Roll Die. ROTATE blink over the top of Main Street, and over other cars (Traffic Jam) 
// in effort to have your blink's face with the corresponding color match the given location's face, at the time they are there. First to unload all faces wins. 
// Both directions of travel allowed, but turn is skipped if another blink is over-taking you. 

  //setColorOnFace(dim (WHITE, 50), 2);
  //setColorOnFace(dim (WHITE, 50), 5); 
  //White to set up the double stripe lined road.
  //Green Grocers, Doctor/Red, Post Office/Blue, Library / Yellow



void loop() {

  if (buttonSingleClicked()){
    setColorOnFace(CarColorList[CarColor], 2);
    setColorOnFace(CarColorList[CarColor], 5);
    CarColor = (CarColor + 1) % 4;

  if (buttonDoubleClicked()){
    setColorOnFace(BuildingColor[BuildingColorList], 0);
    setColorOnFace(BuildingColor[BuildingColorList], 1);
    setColorOnFace(BuildingColor[BuildingColorList], 3);
    setColorOnFace(BuildingColor[BuildingColorList], 4);
    BuildingSend = (BuildingSend + 1) % 4;
    BuildingColor = (BuildingColor + 1) % 4;
  if (buttonMultiClicked()){
    setColorOnFace(GREEN, 0);
    setColorOnFace(RED, 1);
    setColorOnFace(YELLOW, 3);
    setColorOnFace(BLUE, 4);

//The Logistics

  if (buttonLongPressed())
    if (getLastValueReceivedOnFace(0) == 0)
        setColorOnFace (OFF, 1);

    if (getLastValueReceivedOnFace(1) == 1)
       setColorOnFace (OFF, 0);

    if (getLastValueReceivedOnFace(3) == 2)
       setColorOnFace (OFF, 3);

   if (getLastValueReceivedOnFace(4) == 3)
      setColorOnFace (OFF, 4);

//&& BuildingSend == 0
//&& BuildingSend == 1
//&& BuildingSend == 2
//&& BuildingSend == 3



The actual game rules (Which could be seen as yet another programing language) involve moving the blink in a way that is not obvious at first. I admit this, and will work on explaining that better, later. However, it is moot to the pushed forward demonstration of the problem at hand. A smaller fire that I can put on the back burner. … Uh, something like that.

Possible these lines should say…



I’ll go check. I’m sure the notion of being “immune” to your code is … more common than not.

Oh, you mean yet another simple typo and or lack of semi colon? Because that never, ever, ever, kills me by the death of a thousand cuts. Ever.

Seriously, it saps my motivation and will to program, next to anything. It’s like, if not but for cosmetics, I know what I am doing. … ish.

But, legit. Thanks. I just hate how… the smallest things always take down my programs.

… But I’m not sure what that has to do with the entire GetLastValueReceived tree I have going on.

I agree that syntax is archaic and frustrating and gets in the way of programming, but we are in the minority!

Have you tried any of the visual “blocky” languages without syntax?

Not sure I would know a “blocky” language. As it is, I literally have C++ for Dummies coming via Amazon tomorrow.

To anticipate, Most of my experience is in LOGO, not that anyone else’s is, and Ive looked at BASIC and somehow suffered through some JAVA at university.

@bigjosh , not sure if making the changes you suggested, changing the container and index for Building Color / List … is the culprit here, but, now I can long press anything, at any time, and get faces to turn off.

I want my blinks to match to each other like dominoes, and have one face (preferably the face on the ““car”” — the multi colored blink) to turn off, once the faces match, and a button … becomes true.

Seriously considering changing the name of the game to Tank Dominoes. To drive (heh) home the fact that the game is dominoes and a “tank” tread mechanic ((Although, I’m not too sold now, that, the actual ““tanking”” of the blinks in this manner is either fun, or ultimately feasible with a full complement of players … at 4 ))

No syntax to learn, program with pictures.

I’ll do us both a favor, and take that link as the compliment you intended it to be.