I tried to code the famous Game of Life on Bangle.js but I got stuck.
The first attempt was to use an array to do the math and then convert it into an image to print to the screen, but it seems that an array of 240*240 (57600) booleans doesn't fit in memory... to tell the truth only a 30*30 long array fits in (seems strange to me, 57600 boolean should be 7.125kB).
The second attempt was to manipulate pixels directly via g.setPixel and g.getPixel, but it turns out that g.getPixel doesn't work on Bangle.js.
Were you using a regular JS array? Regular JS arrays and booleans have a lot of space overhead - the most space efficient option would be to use an Uint8Array, and then access the individual bits of each byte using bitwise operations.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I tried to code the famous Game of Life on Bangle.js but I got stuck.
The first attempt was to use an array to do the math and then convert it into an image to print to the screen, but it seems that an array of 240*240 (57600) booleans doesn't fit in memory... to tell the truth only a 30*30 long array fits in (seems strange to me, 57600 boolean should be 7.125kB).
The second attempt was to manipulate pixels directly via
g.setPixel
andg.getPixel
, but it turns out thatg.getPixel
doesn't work on Bangle.js.I run out of ideas... any suggestion?