online snake game
Budget $15-25 AUD / hour
Job Description:
ok so I am learning to code some old school C code to make a game that is cross platform and can be played over the network
I am trying to split the game up into header files and functions and definitions into other c files
snake.c
game.c
game.h
I have come across these errors and it will not compile but the issue here is the issues are not correct.
snake.c:16:1: warning: '/*' within block comment [-Wcomment]
/*
^
snake.c:100:61: error: use of undeclared identifier 'ROWS'; did you mean 'COLS'?
if (next.x < 0 || next.x >= COLS || next.y < 0 || next.y >= ROWS) {
^~~~
COLS
/Library/Developer/CommandLineTools/SDKs/[login to view URL]:1208:32: note: 'COLS' declared here
extern NCURSES_EXPORT_VAR(int) COLS;
^
snake.c:105:21: warning: ordered comparison between pointer and integer ('int' and 'int *')
for (int i = 1; i < length; i++) {
~ ^ ~~~~~~
snake.c:155:1: error: unterminated function-like macro invocation
getmaxyx(stdscr,
^
/Library/Developer/CommandLineTools/SDKs/[login to view URL]:913:9: note: macro 'getmaxyx' defined here
#define getmaxyx(win,y,x) (y = getmaxy(win), x = getmaxx(win))
^
snake.c:215:1: error: expected '}'
^
snake.c:153:12: note: to match this '{'
int main() {
^
2 warnings and 3 errors generated.
game.c:15:1: warning: '/*' within block comment [-Wcomment]
/*
^
game.c:51:18: error: implicit declaration of function 'getNextPosition' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
Point next = getNextPosition(snake[0], direction);
^
game.c:51:11: error: initializing 'Point' with an expression of incompatible type 'int'
Point next = getNextPosition(snake[0], direction);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
game.c:52:9: error: implicit declaration of function 'checkCollision' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if (checkCollision(next, rows, cols)) {
^
game.c:52:9: note: did you mean 'check_collision'?
./game.h:19:5: note: 'check_collision' declared here
int check_collision(Point next, Point *snake, int length, int rows, int cols);
^
game.c:57:11: error: implicit declaration of function 'checkCollisionWithSnake' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if (checkCollisionWithSnake(next, snake[i])) {
^
game.c:63:9: error: implicit declaration of function 'checkFoodCollision' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if (checkFoodCollision(next, food)) {
^
game.c:63:9: note: did you mean 'checkCollision'?
game.c:52:9: note: 'checkCollision' declared here
if (checkCollision(next, rows, cols)) {
^
game.c:65:14: error: implicit declaration of function 'generateFood' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
food = generateFood(rows, cols);
^
game.c:65:12: error: assigning to 'Point' from incompatible type 'int'
food = generateFood(rows, cols);
^ ~~~~~~~~~~~~~~~~~~~~~~~~
game.c:71:5: error: implicit declaration of function 'updateSnake' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
updateSnake(snake, next, length);
^
1 warning and 8 errors generated.
for example chatGPT reveals this issue:
It seems that you have used the incorrect name for the number of columns in the terminal window. The correct name is COLS instead of ROWS. You can resolve the error by changing the following line:
Copy code
if (next.x < 0 || next.x >= COLS || next.y < 0 || next.y >= ROWS) {
to
Copy code
if (next.x < 0 || next.x >= COLS || next.y < 0 || next.y >= ROWS) {
16 freelancers are bidding on average $23/hour for this job
Hello Chelson A., We would like to grab this opportunity and will work till you get 100% satisfied with our work. We are an expert team which have many years of experience on C Programming, C# Programming, Software A More
Hello sir I have done lot of games in unity game engine and I have more then 7 years experience in unity game engine and I can do any type of games so please send me more details about your game project and I will give More
Hi! How are you? My main skill is the powerful reversing & the powerful debugging & Customizing opensource & the optimized System Design & the code based optimization . Skill Set: • C/C++/Delphi/C#/Qt/Golang: for 12 More
Hello, How are you ? I have rich experience while I had worked as C developer. To discuss about this task, please contact me.
Hello sir I am a Senior Developer specialized in desktop application development having an experience of more than 8+ years. I am very excited to see your job posting as I am confident that I am a perfect fit for what More
Hi, we have experienced team for game applications like your requirement and we are expert in the same field. We also have ready games available for your satisfaction. Let's have a quick chat to discuss and process fur More