I just finished a recreation of the Game of Life for Arduboy.
You can randomly generate the grid and see what happens.
You can Edit the grid yourself and experiment.
You can control the Speed of the simulation.
You can change the rules for when a cell gets “born” and when it gets to “survive”.
I still think it would be best to have a proper licence.
If you want a ‘do what you want’ sort of licence, then the Unlicence is a good option.
It voids all warranty and liability (as is standard for a licence), permits people to use the code privately or commercially and allows the code to be modified and distributed without constraint.
I use that weird calculation because of negative numbers.
The way i have come to know modulu -8 % 28 = 20.
However in C++ -8 % 28 = -8.
(((cursorX + 4) % 128) + 128) % 128 this handles cursrorX even when it leaves the screen to the left side and wraps around to the right.
I also tested the changes you made and it seems that the iteration to the next frame doesent work properly and when i go to edit one cell it turns on more than one cell.
Moving the courser also rarely moved every cell half a cell in the y direction but i do not know exactly how to recreate that bug.
Thanks for trying to save me some bytes though as I think thats one of the areas where I still have to learn alot.
The cursor isn’t a using datatype that handles negative numbers.
You currently have it set as byte (a.k.a. uint8_t), which is an unsigned datatype.
So actually it wouldn’t be -8 % 28, it would be 248 % 28 which is 24.
Some languages take the sign of the dividend, some take the sign of the divisor.
C++ takes the sign of the dividend, which is the more common approach.
The reason it’s more common is because it allows (((a / b) * b) + (a % b)) == a.
Presumably you’re used to one of the languages that do it the other way, like Python or Ruby.
I’ll check later.
There’s only one place where I touched the cursor code though,
which was toggling a cell on/off.
I haven’t touched it anywhere else, so I don’t know how my changes could have caused the other bugs.
Are you sure they aren’t present in the original?
With all the changes counted, the changes save 346 bytes of progmem and 452 bytes of RAM.
(I could probably manage more space savings if I could do some even more radical things like altering how the cursor works.)