CMPS-3350 Week-11 assignment - Individual source file ---------------------------- A requirement for the group project and all assignments is good coding style. This assignment is to apply required coding style to your own individual source file of the group project. To be collected Monday Apr 10th at 6:00pm. Steps to do... 1. Clone your group project from github. ------------------------------------ 2. Copy your individual source file to the Odin server. --------------------------------------------------- Copy your file to this directory: 3350/b 3. Fix the coding style of your source file. ---------------------------------------- • Follow the K&R bracing, spacing, and indenting style. • One statement per line-of-code. • No lines will wrap around on an 80-character wide editor. • Consistent indenting. • Do not mix hard tabs and spaces for indenting your code. • Samples are given below. 4. Push your style fixes to github. ------------------------------- Your github and Odin source files should match. Below are listed some suggestions for better code style.
Use of braces with a function header replace------------------------------------------------------------ bool startMenu() { with--------------------------------------------------------------- bool startMenu() { Use of braces with a class member function header replace------------------------------------------------------------ float Timer::deltaTime() { with--------------------------------------------------------------- float Timer::deltaTime() { Line wrapping on 80-column editor replace------------------------------------------------------------ ggprint8b(&r, 50, c, " PLAYER%i WINS", player); with--------------------------------------------------------------- r.left += 80; ggprint8b(&r, 50, c, "PLAYER%i WINS", player); r.left -= 80; Spacing within a statement replace------------------------------------------------------------ if(a > 0 && b > 0){//1st with--------------------------------------------------------------- if (a > 0 && b > 0) { //1st quadrant ... ... Indenting replace------------------------------------------------------------ void attacks(void) { static int cd_2 = 0; with--------------------------------------------------------------- void attacks(void) { static int cd_2 = 0; Spacing, consistent indenting replace------------------------------------------------------------ void makeBullet(float x, float y,float z, bool tb, int bullet_type) { switch(bullet_type){ case 1: if (g.n_Bullet < MAX_bullet){ bul[g.n_Bullet].setBullet(x, y, z, tb, 1); ++g.n_Bullet; } break; with--------------------------------------------------------------- void makeBullet(float x, float y, float z, bool tb, int bullet_type) { switch (bullet_type) { case 1: if (g.n_Bullet < MAX_bullet) { bul[g.n_Bullet].setBullet(x, y, z, tb, 1); ++g.n_Bullet; } break;