diff options
| author | Preston Pan <preston@nullring.xyz> | 2023-02-06 12:03:16 -0800 |
|---|---|---|
| committer | Preston Pan <preston@nullring.xyz> | 2023-02-06 12:03:16 -0800 |
| commit | 59dd4d68c95142ceca1539491b0017985bd96357 (patch) | |
| tree | 335f6e24c0303fb04fb6d8e55512bffa5e41e1bc /snake.c | |
| parent | 60992c31734d233d0cc8c3e8942fa1c173a67fde (diff) | |
add compiler flags for warnings for bad practice; snake game now gets harder the longer you go
Diffstat (limited to 'snake.c')
| -rw-r--r-- | snake.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -18,7 +18,7 @@ volatile sig_atomic_t INT_CTRL_C = 0; //flag for ctrl-c interrupt int SCORE = 0; int boardSize = 15; -const int updateInterval = 300000000L; +int updateInterval = 300000000L; vectorp_t snakePositions; vector_t foodPos; @@ -115,6 +115,9 @@ int main(int argc, char **argv) { if((snakePositions.vectors[0].mx + lastMoveDir.mx == foodPos.mx) && (snakePositions.vectors[0].my + lastMoveDir.my == foodPos.my)) { ateFood = 1; SCORE = SCORE + 1; + if (updateInterval > 50000000) { + updateInterval -= 20000000; + } //move the food while(1) { foodPos = init_vector(1 + (rand() % (boardSize - 2)), 1 + (rand() % (boardSize - 2))); |
