nSnake
A ncurses implementation of the classic Snake game
 All Data Structures Files Functions Variables Enumerations Macros Pages
Documentation Main Page

Introduction

This is the main documentation page of nSnake.
It was made for programmers and people who want to understand the source code.

Here is the folder and file structure:

General game information README file
Installation instructions and information INSTALL file
Known bugs and information about where to submit new ones BUGS file
Copyright and warranty info COPYING file
Doxygen file for generating this documentation. Doxyfile file
Instructions to the 'make' program. Makefile file
Work that needs to be done or ideas for future versions. TODO file
All of the source code files. /src folder
The documentation files (explaining the source code) and manpage /doc folder
Location of resulting object files after compilation /obj folder
Location of the executable generated after compilation /bin folder


Description

One important objective i kept in mind when coding nSnake, was to make the source code as simple as it could be.
I wished too that this code could be a guide to C programming and nCurses learning for beginners.
But with time, the game structure got more complicated; i had to break large chunks of code into more manageable files; the folder structure wasn't as clean as before; the Makefile got bigger and bigger... I kinda lost myself around somewhere.
So now i think this source code may be a guide to people who are used to programming, but don't know about coding standards, modularization, naming rules, and such.
Then, if you already have a project (or if you are making one) i highly recommend you take a time to read these source files and consider at least some of the ideas i present.
For example, the function names.

Each group of .c and .h files represent an unique concept. Player, Fruit and Scores, together with Main and nSnake itself. Each of those has a responsability on the game.
So i renamed each function to this pattern:

modulename_action_provided_by_function ()


This way, just by looking at it you know where this function is from. Also, this is the structure of external functions - functions that can be called from other modules. If there is a function that only serves the current module, it has simply the name of the action provided by the function.

I really need to continue this description.

        Any questions, please email me at <alex.dantas92@gmail.com>.