You need a buffer... but may be not a display/output buffer... but something has to represent the 'board' - 16x8 matrix - which is actually better than fallen/settled blocks. There is no need to check against all fallen blocks. When a block is fallen, the board is updated. Collision detection uses the board and the block's 'next' position - a maximum of four comparisons. Next positions are the next fall position, 90 degree left/right rotated block on same position, or move left/right position. If the next position would be a fall position, the block settles. If it cannot rotate or move left/right because of detected collision, nothing is done. The fallen blocks are kept for an eventual redraw - or - when you do not score when fallen/settled but at the end when game is over.
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.
You need a buffer... but may be not a display/output buffer... but something has to represent the 'board' - 16x8 matrix - which is actually better than fallen/settled blocks. There is no need to check against all fallen blocks. When a block is fallen, the board is updated. Collision detection uses the board and the block's 'next' position - a maximum of four comparisons. Next positions are the next fall position, 90 degree left/right rotated block on same position, or move left/right position. If the next position would be a fall position, the block settles. If it cannot rotate or move left/right because of detected collision, nothing is done. The fallen blocks are kept for an eventual redraw - or - when you do not score when fallen/settled but at the end when game is over.