a9487d805d9c6b761d5a0f49070a8db4629b7c8f
haas/spring2026/cprog/projects/dap0.md
| ... | ... | @@ -0,0 +1,228 @@ |
| 1 | +# CSCS1320 C/C++ Programming |
|
| 2 | + |
|
| 3 | +# PROJECT: DRAW A PICTURE (dap0) |
|
| 4 | + |
|
| 5 | +## OBJECTIVE |
|
| 6 | + |
|
| 7 | +To adapt and experiment with a program that generates an image, before |
|
| 8 | +having extensive knowledge of the subject matter. |
|
| 9 | + |
|
| 10 | +Also to start some time-sensitive activities to ensure ground is broken |
|
| 11 | +on the project before the day it is due (see submission rubric below) |
|
| 12 | + |
|
| 13 | +## BACKGROUND |
|
| 14 | + |
|
| 15 | +For this project, you will be using a graphics design library to render |
|
| 16 | +the indicated image. |
|
| 17 | + |
|
| 18 | +## GRABIT |
|
| 19 | + |
|
| 20 | +I have prepared a `grabit` for resources related to this project. To |
|
| 21 | +obtain it: |
|
| 22 | + |
|
| 23 | +``` |
|
| 24 | +lab46:~/src/SEMESTER/DESIG$ grabit DESIG dap0 |
|
| 25 | +make: Entering directory '/var/public/SEMESTER/DESIG/dap0' |
|
| 26 | +'/var/public/SEMESTER/DESIG/dap0/Makefile' -> '/home/user/src/SEMESTER/DESIG/dap0/Makefile' |
|
| 27 | +'/var/public/SEMESTER/DESIG/dap0/dap0.c' -> '/home/user/src/SEMESTER/DESIG/dap0/dap0.c' |
|
| 28 | +make: Leaving directory '/var/public/SEMESTER/DESIG/dap0' |
|
| 29 | +lab46:~/src/SEMESTER/DESIG$ |
|
| 30 | +``` |
|
| 31 | + |
|
| 32 | +At which point you can change into the newly created and populated |
|
| 33 | +`dap0` directory. |
|
| 34 | + |
|
| 35 | +Be sure to **add**, **commit**, and **push** this to your lab46 clone of |
|
| 36 | +your repository. |
|
| 37 | + |
|
| 38 | +Then, on your pi/system, **pull** and **update** to get the files |
|
| 39 | +available there, or continue working on it on lab46. |
|
| 40 | + |
|
| 41 | +## TASK |
|
| 42 | + |
|
| 43 | +It is first your task to study the existing code, figuring out how to |
|
| 44 | +compile and run it, and to view the image it produces. |
|
| 45 | + |
|
| 46 | +Next, observing the composition of the image, study the code to try and |
|
| 47 | +ascertain how the various shapes are formed and positioned where they |
|
| 48 | +are, along with other elements like colors. |
|
| 49 | + |
|
| 50 | +You will want to experiment with the code, making small changes to see if |
|
| 51 | +you can predictably change the resulting image that it output. Once you |
|
| 52 | +get comfortable with it, and you can reliably make predictable changes, |
|
| 53 | +you can proceed to the submittable task: |
|
| 54 | + |
|
| 55 | +You will want to modify this program that generates an image according to |
|
| 56 | +the following specifications: |
|
| 57 | + |
|
| 58 | + * is a coherent image, consisting of a recognized theme |
|
| 59 | + * allocates and utilizes at least EIGHT (8) colors |
|
| 60 | + * image dimensions are no smaller than 1000 pixels on either axis |
|
| 61 | + * picture utilizes the bulk of the canvas |
|
| 62 | + * uses at least 3 instances of each of: |
|
| 63 | + * circle/ellipse |
|
| 64 | + * line |
|
| 65 | + * rectangle |
|
| 66 | + |
|
| 67 | +<!-- place a black, filled 2x2 rectangle at coordinates 0, 0 in the image --> |
|
| 68 | + |
|
| 69 | +The program will be an exercise in exploration: you will be given some |
|
| 70 | +example code that does something. You should poke at it to gain deeper |
|
| 71 | +understanding. Then you will, taking out the demo graphics, implement the |
|
| 72 | +needed steps to generate your intended picture. |
|
| 73 | + |
|
| 74 | +Your program should: |
|
| 75 | + |
|
| 76 | + * have valid, descriptive variable names of length *no shorter than* 3 symbols |
|
| 77 | + * have consistent, well-defined indentation (no less than 4 spaces per level of indentation) |
|
| 78 | + * all code within the same scope aligned to its indentation level |
|
| 79 | + * have proximal comments explaining your rationale and what is going on, throughout your code |
|
| 80 | + * perform the intended operation, outputting the correct/accurate information in indicated format |
|
| 81 | + |
|
| 82 | +<!-- mix a color, calling it "gray", using an RGB value of 0xA1, 0xA1, 0xA1 --> |
|
| 83 | + |
|
| 84 | +### LAB46 DEVELOPMENT |
|
| 85 | + |
|
| 86 | +If you desire, you can do this project entirely on the LAB46 SHELL |
|
| 87 | +SYSTEM, making use of your WEB DIRECTORY to view your image in a WEB |
|
| 88 | +BROWSER. |
|
| 89 | + |
|
| 90 | +### ON YOUR DEVELOPMENT SYSTEM |
|
| 91 | + |
|
| 92 | +You are also free to work on this project on your own Linux system, |
|
| 93 | +provided it has the necessary tools and libraries available to compile |
|
| 94 | +and run it. |
|
| 95 | + |
|
| 96 | +To utilize the needed functionality for this project, you will need to |
|
| 97 | +ensure you have the following packages installed: |
|
| 98 | + |
|
| 99 | + * **build-essential** |
|
| 100 | + * **libgd-dev** |
|
| 101 | + * **libgd-tools** |
|
| 102 | + * **libgd3** |
|
| 103 | + |
|
| 104 | +And any related packages that may be needed to support this endeavour. |
|
| 105 | + |
|
| 106 | +### COMPILING |
|
| 107 | + |
|
| 108 | +Since the grabit brought in a `Makefile`, if your code needs compiling |
|
| 109 | +you can compile your code simply by typing: **make** |
|
| 110 | + |
|
| 111 | +For this project, you can then run the program with: **make run** |
|
| 112 | + |
|
| 113 | +If on the LAB46 SHELL SYSTEM, you can get the image copied into your web |
|
| 114 | +space (under the **dap0/** subdirectory) by running: **make install** |
|
| 115 | + |
|
| 116 | +When done and ready to submit, only on the LAB46 SHELL SYSTEM: **make |
|
| 117 | +submit** |
|
| 118 | + |
|
| 119 | +## STRATEGY |
|
| 120 | + |
|
| 121 | +As with any process you are looking to describe or automate (in this |
|
| 122 | +case, both), if YOU do not personally understand or appreciate the steps |
|
| 123 | +involved, you are going to have a hard time communicating a proficient |
|
| 124 | +list of instructions to the computer to carry out. |
|
| 125 | + |
|
| 126 | +So, the FIRST order of business would be to, BY HAND, ON A SHEET OF GRAPH |
|
| 127 | +PAPER (consider this your PROTOTYPE): |
|
| 128 | + |
|
| 129 | + * START EARLY: Don't WASTE the abundance of time made available to you. Waiting until the last minute will only preserve frustration and confusion |
|
| 130 | + * decide what sort of picture you would like to "render" |
|
| 131 | + * practice plotting the elements out, figuring out how to best represent and fill the graph paper |
|
| 132 | + * determine what a good ratio of blocks to screen size would be (holding a 11"x8.5" sheet of graph paper in landscape orientation would be a good fit for the resolution of 1280x1024, for example. |
|
| 133 | + * mark up your appropriately sized and filled out prototype with the different colors the project calls for |
|
| 134 | + * ONCE you have worked out your scheme by hand, you can THEN proceed to start playing with the provided code |
|
| 135 | + * determine what shapes are being rendered (view it in a web browser or image viewer) |
|
| 136 | + * make changes to the shapes. Experiment and develop an understanding of the coordinate system and how you can predictably impact the shape as it is rendered in the image |
|
| 137 | + * once you understand how to manipulate the shapes, remove the demo shapes/comments and start laying down your own |
|
| 138 | + * the provided code infrastructure may not be adequate for the demands of the project, and will need to be **expanded** in some areas |
|
| 139 | + * see if you understand the patterns of the existing infrastructure, and explore attempts to expand it to support your project aims |
|
| 140 | + * ASK QUESTIONS so as to maintain an understanding of what is going on |
|
| 141 | + |
|
| 142 | +## VIEWING THE PICTURE |
|
| 143 | + |
|
| 144 | +Depending on your computing setup, choose the most practical means of |
|
| 145 | +viewing your program's image output: |
|
| 146 | + |
|
| 147 | +### VIEWING VIA THE WEB ON LAB46 |
|
| 148 | + |
|
| 149 | +If you have successfully built and run the code on LAB46, running the |
|
| 150 | +`install` line as documented above, you can view your handiwork through a |
|
| 151 | +web browser, by pointing it at the image in your LAB46 WEB SPACE: |
|
| 152 | + |
|
| 153 | + * `https://lab46.g7n.org/~user/dap0/dap0.png` |
|
| 154 | + |
|
| 155 | +Do NOTE that for the image to be properly updated after any code change, |
|
| 156 | +you will need to re-**compile**, re-**run**, and re-**install** as you |
|
| 157 | +did above. Neglecting to redo the steps will result in what appears to be |
|
| 158 | +a stale image that doesn't change or update. |
|
| 159 | + |
|
| 160 | +NOTE: sometimes the web browser caches previous results, you may have to |
|
| 161 | +refresh a few times on revisions to get changes to manifest. |
|
| 162 | + |
|
| 163 | +### VIEWING VIA YOUR DEVELOPMENT SYSTEM |
|
| 164 | + |
|
| 165 | +Open a file browser, web browser, or image viewer and navigate to/open up |
|
| 166 | +your **dap0.png** image in your **~/src/SEMESTER/desig/dap0/** directory. |
|
| 167 | + |
|
| 168 | +Rinse and repeat as you go through revisions. |
|
| 169 | + |
|
| 170 | +## PREVIOUS SEMESTER ENTRIES |
|
| 171 | + |
|
| 172 | +A selection of completed entries from prior semesters: |
|
| 173 | + |
|
| 174 | + * [previous dap0 entries (gallery)](https://lab46.g7n.org/~wedge/dap0/) |
|
| 175 | + |
|
| 176 | +## CURRENT SEMESTER ENTRIES |
|
| 177 | + |
|
| 178 | +Direct links to the default images of all doing dap0 this semester: |
|
| 179 | + |
|
| 180 | +dcastil2 eraffer2 lbailey6 ngugliel rsmith18 snipitku |
|
| 181 | + |
|
| 182 | + * [dcastil2](https://lab46.g7n.org/~dcastil2/dap0/dap0.png) |
|
| 183 | + * [eraffer2](https://lab46.g7n.org/~eraffer2/dap0/dap0.png) |
|
| 184 | + * [lbailey6](https://lab46.g7n.org/~lbailey6/dap0/dap0.png) |
|
| 185 | + * [ngugliel](https://lab46.g7n.org/~ngugliel/dap0/dap0.png) |
|
| 186 | + * [rsmith18](https://lab46.g7n.org/~rsmith18/dap0/dap0.png) |
|
| 187 | + * [snipitku](https://lab46.g7n.org/~snipitku/dap0/dap0.png) |
|
| 188 | + |
|
| 189 | +## SUBMISSION |
|
| 190 | + |
|
| 191 | +To successfully complete this project, the following criteria must be |
|
| 192 | +met: |
|
| 193 | + |
|
| 194 | + * Code must compile/execute cleanly (no notes, warnings, nor errors) |
|
| 195 | + * Code must be nicely and consistently indented |
|
| 196 | + * Code must be well commented |
|
| 197 | + * Do NOT double space your code. Group like statements together. |
|
| 198 | + * Track/version the source code in your private semester repository |
|
| 199 | + * Submit a copy of your source code to me using the **submit** tool |
|
| 200 | + |
|
| 201 | +To submit this program to me using the **submit** tool, run the following |
|
| 202 | +command at your LAB46 prompt: |
|
| 203 | + |
|
| 204 | +``` |
|
| 205 | +lab46:~/src/SEMESTER/DESIG/dap0$ make submit |
|
| 206 | +``` |
|
| 207 | + |
|
| 208 | +You should get some sort of confirmation indicating successful submission |
|
| 209 | +if all went according to plan. If not, check for typos and or locational |
|
| 210 | +mismatches. |
|
| 211 | + |
|
| 212 | +What I'll be looking for: |
|
| 213 | + |
|
| 214 | +``` |
|
| 215 | +78:dap0:final tally of results (78/78) |
|
| 216 | +*:dap0:post image created to #desig discord channel [13/13] |
|
| 217 | +*:dap0:grabit the code on lab46 by Sunday before deadline [13/13] |
|
| 218 | +*:dap0:code is pushed to private semester repository [13/13] |
|
| 219 | +*:dap0:no negative compiler/interpreter messages for program [13/13] |
|
| 220 | +*:dap0:proper output formatting per specifications [26/26] |
|
| 221 | +``` |
|
| 222 | + |
|
| 223 | +Additionally: |
|
| 224 | + * Solutions not abiding by spirit of project will be subject to a 50% overall deduction |
|
| 225 | + * Solutions not utilizing descriptive why and how comments will be subject to a 25% overall deduction |
|
| 226 | + * Solutions not utilizing indentation to promote scope and clarity will be subject to a 25% overall deduction |
|
| 227 | + * Solutions not organized and easy to read are subject to a 25% overall deduction |
|
| 228 | + |