Question: write a program in c that uses the curses library which acts exactly like the famous game snake. please consider all possible situations in the
write a program in c that uses the curses library which acts exactly like the famous game "snake". please consider all possible situations in the code (display "win" or something if the users wins, etc). The program must (important key) use the logic behind these given codes.

(the game should have 4 corners, and so if the snake touches them, the user looses)
#include curses.h> #define TRUE ! #define FALSE ? #define UP 3 #define DOWN 2 #define RIGHT 5 #define LEFT 4 int main(void)f keypad (initscr),TRUE) int xPos-l; int yPos 2; char c='\ while( C!f') c=getch ( ) ; mvprintw(1,1, "drawing game) switch(C) case UP: yPos-- break case DOWN: yPostt break case LEFT break case RIGHT: xPos++ mvaddch(yPos , xPos, ? * ') ; endwin); #include curses.h> #define TRUE ! #define FALSE ? #define UP 3 #define DOWN 2 #define RIGHT 5 #define LEFT 4 int main(void)f keypad (initscr),TRUE) int xPos-l; int yPos 2; char c='\ while( C!f') c=getch ( ) ; mvprintw(1,1, "drawing game) switch(C) case UP: yPos-- break case DOWN: yPostt break case LEFT break case RIGHT: xPos++ mvaddch(yPos , xPos, ? * ') ; endwin)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
