For now, document code in a similar style given below, replacing <yourname> with your name, (if you want credit for the documentation, else do not include the Documentation Author line):
class Rectangle {
/*
* Create rectangle shapes.
*
* Attributes:
* int width: The width of the rectangle.
* int height: The height of the rectangle.
*
* Documentation Author: <yourname>
*/
int width, height;
public:
void set_values (int,int);
int area() {
/*
* Get the area of the rectangle.
* Returns:
* int: The area of the rectangle.
*
* Documentation Author: <yourname>
*/
// Compute the area of a rectangle, which is width*height.
return width*height;
}
};
void Rectangle::set_values (int x, int y) {
/*
* Set the width and height of the rectangle.
* Parameters:
* int x: The height to set the rectangle.
* int y: The width to set the rectangle.
*
* Documentation Author: <yourname>
*/
width = x;
height = y;
}
int main () {
Rectangle rect;
// Set the width and height of rect.
rect.set_values (3,4);
cout << "area: " << rect.area();
// return
return 0;
}
To summarise, describe classes and functions/ method descriptions using /* ... */ and code lines using //. Ideally, try to keep commenting to a minimum and only comment lines of code, when it is non-obvious what the code does. Any small amount of documentation is welcome!
A lot of the AI code in this project is not well understood. Documentation of this code, which can be found at https://github.com/ZetaGlest/zetaglest-source/tree/develop/source/glest_game/ai , would greatly help the project.
Documenting Style
For now, document code in a similar style given below, replacing
<yourname>
with your name, (if you want credit for the documentation, else do not include theDocumentation Author
line):To summarise, describe classes and functions/ method descriptions using
/* ... */
and code lines using//
. Ideally, try to keep commenting to a minimum and only comment lines of code, when it is non-obvious what the code does. Any small amount of documentation is welcome!