I wrote a simple program to print a grid of 0s on the screen, and move a 1 around with user input from the keyboard (eventually, the goal is a "snake" game).
It works fine. I hit W, it moves the 1 up one space. I hit A, it moves it to the left, etc.
The problem I'm having is that each time it prints a whole new box. I would much rather have it update the same box each time I hit a key, and I have no idea how to do that.
I'm currently using this to print my box each time I update the location of my 1:
How would I make it draw the box only once, and simply update "pixels" in the array as I enter input?Code:for(i=0;i<boxsize;i++){ for(j=0;j<boxsize;j++){ printf("%d",grid[i][j]); } printf("\n"); }