Find Jobs
Hire Freelancers

online snake game

$15-25 AUD / hour

Closed
Posted over 1 year ago

$15-25 AUD / hour

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) {
Project ID: 35904958

About the project

16 proposals
Remote project
Active 1 yr ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
16 freelancers are bidding on average $23 AUD/hour for this job
User Avatar
Hello... I am interested
$20 AUD in 40 days
5.0 (249 reviews)
7.1
7.1
User Avatar
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 Architecture, Objective C, C++ Programming Lets connect in chat so that We discuss further. Thank You
$20 AUD in 7 days
4.9 (13 reviews)
5.0
5.0
User Avatar
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 you daily updates well but I need daily communication if possible so I can do fast and good as you require.
$20 AUD in 40 days
5.0 (3 reviews)
5.2
5.2
User Avatar
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+ years • Python/PyQt/PyTorch/appium/web scrapping for 6+ years • OpenGL/OpenCL/Cuda/Cmake for(6+ years) • well versed with RDP/RTSP/RTP for(6+ years) • typescript/webwasm/ffmpeg/webcodec: for 4+ years • the powerful 3D rendering based opengl/gles/webgl Recently, I have developed the 3D Medical Viewer like Syngo, Philise Viewer & deployed in hospitals using C++/Qt/OpenCL/Cmake/VTK/ITK Please contact me
$25 AUD in 40 days
5.0 (1 review)
3.4
3.4
User Avatar
Hello, How are you ? I have rich experience while I had worked as C developer. To discuss about this task, please contact me.
$20 AUD in 40 days
5.0 (1 review)
1.0
1.0
User Avatar
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 you are looking for, as I have worked on many similar projects. I can build your project by using C/C++, C#/.NET(Winform, WPF, DevExpress), VB.NET Python We can discuss your project via chatting in detail thanks
$20 AUD in 40 days
0.0 (0 reviews)
0.0
0.0
User Avatar
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 further.
$20 AUD in 40 days
0.0 (0 reviews)
0.0
0.0
User Avatar
Your code is a mess, you put two main() in snake.c and another one in game.c, for instance. Also, be careful about cols and COLS, they're different variables (or constants) so be careful! That said, if you want i can rule out some of the worst errors, explaining where and why.
$15 AUD in 40 days
0.0 (0 reviews)
0.0
0.0

About the client

Flag of AUSTRALIA
Battery Hill, Australia
5.0
43
Payment method verified
Member since May 2, 2011

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.