Twos code cleanup (#1220)

This commit is contained in:
Riku Isokoski
2022-07-06 11:29:23 +03:00
committed by GitHub
parent b9f5a0745d
commit 9b92861753
2 changed files with 112 additions and 107 deletions

View File

@@ -26,11 +26,14 @@ namespace Pinetime {
lv_obj_t* scoreText;
lv_obj_t* gridDisplay;
TwosTile grid[4][4];
static constexpr int nCols = 4;
static constexpr int nRows = 4;
static constexpr int nCells = nCols * nRows;
TwosTile grid[nRows][nCols];
unsigned int score = 0;
void updateGridDisplay(TwosTile grid[][4]);
bool tryMerge(TwosTile grid[][4], int& newRow, int& newCol, int oldRow, int oldCol);
bool tryMove(TwosTile grid[][4], int newRow, int newCol, int oldRow, int oldCol);
void updateGridDisplay();
bool tryMerge(int newRow, int newCol, int oldRow, int oldCol);
bool tryMove(int newRow, int newCol, int oldRow, int oldCol);
bool placeNewTile();
};
}