diff options
| author | Preston Pan <preston@nullring.xyz> | 2023-02-06 23:50:14 -0800 |
|---|---|---|
| committer | Preston Pan <preston@nullring.xyz> | 2023-02-06 23:50:14 -0800 |
| commit | 2b2ec2f98948f2b9e98913a057c33b179632319e (patch) | |
| tree | 1b5fafcaa732e9fad46a16249329465aa5476339 | |
| parent | c9b0b054c6a01d99df3a920ab53aead9d080d1aa (diff) | |
uint8 for bools instead of full 32 bit integer
| -rw-r--r-- | snake.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -120,7 +120,7 @@ int main(int argc, char **argv) { while(1) { vector_t basePos = init_vector((rand() % (boardSize - (obstacleSize - 1))), (rand() % (boardSize - (obstacleSize - 1)))); /* if obstacle overlaps snake, try again */ - int overlap = 0; + uint8 overlap = 0; for(int r = 0; r < obstacleSize; r++) { for(int c = 0; c < obstacleSize; c++) { vector_t voxelPos = init_vector(basePos.mx + c, basePos.my + r); @@ -180,7 +180,8 @@ int main(int argc, char **argv) { if((dir.mx != 0 || dir.my != 0) && !(dir.mx == 1 && lastMoveDir.mx == -1) && !(dir.mx == -1 && lastMoveDir.mx == 1) && !(dir.my == 1 && lastMoveDir.my == -1) && !(dir.my == -1 && lastMoveDir.my == 1)) { lastMoveDir = dir; } - int ateFood = 0; + + uint8 ateFood = 0; /* check if snake is moving onto food */ if((snakePositions.vectors[0].mx + lastMoveDir.mx == foodPos.mx) && (snakePositions.vectors[0].my + lastMoveDir.my == foodPos.my)) { ateFood = 1; |
