763dbd0ab7f45bc009a0181a88fae744b8c34cb9
haas/fall2026/unix/eoce/EoCE.md
| ... | ... | @@ -0,0 +1,380 @@ |
| 1 | +# UNIX FALL2026 EOCE |
|
| 2 | + |
|
| 3 | +The End of Course Experience (eoce) satisfies the fourth discrete grading |
|
| 4 | +component of the course. It is meant to evaluate your knowledge and |
|
| 5 | +understanding gained through the semester. |
|
| 6 | + |
|
| 7 | +Unlike the regular weekly projects, the purpose of which is to promote a |
|
| 8 | +learning and understanding of the concepts of the course, this EoCE is |
|
| 9 | +meant more as a demonstration of your proficiency in understanding and |
|
| 10 | +utilizing the concepts and skills obtained, showing me how productive you |
|
| 11 | +can be with the experiences gained. |
|
| 12 | + |
|
| 13 | +## RULES |
|
| 14 | + |
|
| 15 | +Presented within will be various activities evaluating your knowledge and |
|
| 16 | +experience gained this semester. In places where you are able, the more |
|
| 17 | +you write (ie comment) and explain topics the better the chance you will |
|
| 18 | +have of receiving full credit (and alternatively, the more credit you |
|
| 19 | +will receive should something defer correctness). |
|
| 20 | + |
|
| 21 | +Unless otherwise specified, the components on this experience are open |
|
| 22 | +resource with the exception of other individuals. In that respect, it |
|
| 23 | +is **CLOSED PERSON**. This means you are not to communicate with |
|
| 24 | +other people (either in the class or otherwise), in real life or |
|
| 25 | +electronically. Use your own knowledge, use your own skills, and use your |
|
| 26 | +own ability to access the allowed resources to aid you in coming up with |
|
| 27 | +your well thought out responses to each activity. |
|
| 28 | + |
|
| 29 | +You are allowed, and expected, to seek clarification on any activity by |
|
| 30 | +asking me. But the aim here is to evaluate what you have learned, so do |
|
| 31 | +not expect tutoring. Any help should be prompted by a well-asked |
|
| 32 | +question. The better and more informed your questions, the better my |
|
| 33 | +responses MAY be. In many ways, I designed this EoCE premised on each and |
|
| 34 | +every one of you interacting with me through the asking of informed |
|
| 35 | +questions. Those that do not take advantage of asking such calibre of |
|
| 36 | +questions and instead end up struggling, please know that you're doing |
|
| 37 | +this wrong. But also know that, the aim here is for you to accomplish the |
|
| 38 | +various tasks through your own understanding of the task and concepts at |
|
| 39 | +hand, and not to outsource your thinking and remembering to others. |
|
| 40 | + |
|
| 41 | +You are to all of the available items. Submission is to be as a submitted |
|
| 42 | +archive to the usual and appropriate places: the 'pctF' project submitted |
|
| 43 | +via its usual process, the other items will be part of the `eoce` project |
|
| 44 | +that you would have `grabit`ed. |
|
| 45 | + |
|
| 46 | +To maximize any credit received (or to minimize points lost), optimize |
|
| 47 | +your submission for an organized and easy-to-read presentation of |
|
| 48 | +information that conforms with each section's stated guidelines. In the |
|
| 49 | +case of programs or scripts written, ensure that you are following proper |
|
| 50 | +and consistent commenting/documentation and indentation practices. Use |
|
| 51 | +well-named variables (at least 4 symbols long), and be mindful of how |
|
| 52 | +your particular files submitted will appear on a reasonably-sized |
|
| 53 | +terminal (most of my terminals are 80-90 characters wide), should that be |
|
| 54 | +the contextually relevant destination of output. |
|
| 55 | + |
|
| 56 | +The EoCE is worth 26 points of your overall grade (projects (52) + |
|
| 57 | +participation (13) + notes (13) + eoce (26) = 104), representing a |
|
| 58 | +distinct fourth category within the grading policy of the course |
|
| 59 | +(Projects, Journal, Participation, and EoCE). |
|
| 60 | + |
|
| 61 | +### FINALS WEEK AVAILABILITY |
|
| 62 | + |
|
| 63 | +While some classes are allocated a specific meeting time during finals |
|
| 64 | +week, I make all such times available should you be free and have |
|
| 65 | +questions. As such, finals week in **CHM123** will look something like |
|
| 66 | +this: |
|
| 67 | + |
|
| 68 | + * Thursday, December 10th, 2026 from 08:00AM-11:00AM |
|
| 69 | + * Thursday, December 10th, 2026 from 02:30PM-05:30PM |
|
| 70 | + * Friday, December 11th, 2026 from 02:30PM-05:30PM |
|
| 71 | + * Tuesday, December 15th, 2026 from 11:15AM-02:15PM |
|
| 72 | + |
|
| 73 | +Do note, the discord remains available for questions, and there is no |
|
| 74 | +need for you to be physically present at a given time during finals week. |
|
| 75 | +These are merely resources available to you should you wish to utilize |
|
| 76 | +them in the appropriate manners they are available to be used. |
|
| 77 | + |
|
| 78 | +## GRABIT |
|
| 79 | + |
|
| 80 | +There is a **grabit** available for the EoCE. It would house the code for |
|
| 81 | +the various programming sections. The letter division is transacted via |
|
| 82 | +its own `pctF` project. |
|
| 83 | + |
|
| 84 | +## CONTENT |
|
| 85 | + |
|
| 86 | +### CALENDAR SCRIPT |
|
| 87 | + |
|
| 88 | +Your task here is to implement a bash script solution of a real life |
|
| 89 | +process: the mental math trick of determining what day of the week |
|
| 90 | +January 1 of any given year (in the 21st century) falls on. |
|
| 91 | + |
|
| 92 | +You may safely assume that all requests will be for days in the 21st |
|
| 93 | +century (2000-2099) |
|
| 94 | + |
|
| 95 | +#### Background |
|
| 96 | + |
|
| 97 | +Mental Math constitutes an intersection of mental tricks and math- |
|
| 98 | +instead of utilizing a purely math-only solution, textual manipulations |
|
| 99 | +or simplifications in the computational process may take place enabling |
|
| 100 | +an individual to, once having learned the process, solve such problems in |
|
| 101 | +their head, and typically without the use of a calculating device. |
|
| 102 | + |
|
| 103 | +The process in this case is one of simple (reduced) multiplication and |
|
| 104 | +mapping against a table. To wit: |
|
| 105 | + |
|
| 106 | +#### Day values |
|
| 107 | + |
|
| 108 | +For this trick to work, we need to be familiar with the following table |
|
| 109 | +(a map of days to numeric values): |
|
| 110 | + |
|
| 111 | +|-----|-----|-----|-----|-----|-----|-----|-----| |
|
| 112 | +| Sun | Mon | Tue | Wed | Thu | Fri | Sat | Sun | |
|
| 113 | +|-----|-----|-----|-----|-----|-----|-----|-----| |
|
| 114 | +| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | |
|
| 115 | +|-----|-----|-----|-----|-----|-----|-----|-----| |
|
| 116 | + |
|
| 117 | +NOTE: Depending on how you implement your algorithm, you may find your |
|
| 118 | +approach prefers 7s OR 0s for your Sunday value... you aren't going to be |
|
| 119 | +encountering them at random. Once you work through your approach, you |
|
| 120 | +will discover which one you end up with. |
|
| 121 | + |
|
| 122 | +#### Calculating day of the week based on year |
|
| 123 | + |
|
| 124 | +Okay, time for the magic: |
|
| 125 | + |
|
| 126 | +Let us try it on January 1st, 2014. |
|
| 127 | + |
|
| 128 | +#### Step 1: Obtain last two digits of the year |
|
| 129 | + |
|
| 130 | +In our example, we're working with 2014, the last two digits are |
|
| 131 | +therefore: 14 |
|
| 132 | + |
|
| 133 | +You should be able to come up with a means of extracting this information |
|
| 134 | +in your program. |
|
| 135 | + |
|
| 136 | +NOTE: You are to input the 4-digit year as input into your bash script. |
|
| 137 | + |
|
| 138 | +#### Step 2: Compute 25% (drop the decimal) |
|
| 139 | + |
|
| 140 | +Even this is something we can do in our heads. I can think of two |
|
| 141 | +approaches right off the bat: |
|
| 142 | + |
|
| 143 | +#### Approach 1: 10 + 10 + 5 |
|
| 144 | + |
|
| 145 | +10% percent of anything is merely moving the decimal over one place to |
|
| 146 | +the left. 10% of 54 is 5.4 |
|
| 147 | + |
|
| 148 | +For our 2014 example, 10% of 14 is therefore 1.4 |
|
| 149 | + |
|
| 150 | +So we need two 10 percents... 1.4 + 1.4 = 2.8 |
|
| 151 | + |
|
| 152 | +Finally, 5% is half of 10% (half of 1.4 is 0.7), so 1.4 + 1.4 + 0.7 = 3.5 |
|
| 153 | + |
|
| 154 | +But, since we do not care about the decimal at this end point, we drop it |
|
| 155 | +and are left with just 3. |
|
| 156 | + |
|
| 157 | +#### Approach 2: half of half |
|
| 158 | + |
|
| 159 | +25% is a convenient value for us with respect to 100, allowing this |
|
| 160 | +optimized approach to work. |
|
| 161 | + |
|
| 162 | + * Half of 100 is 50 (50%) |
|
| 163 | + * Half of 50 is 25 (25%) -- hence the "half of a half" |
|
| 164 | + |
|
| 165 | +So, 14 cut in half is 7. |
|
| 166 | + |
|
| 167 | +7 cut in half is 3.5. |
|
| 168 | + |
|
| 169 | +Once again, dropping the decimal yields 3. |
|
| 170 | + |
|
| 171 | +#### Step 3: Add 25% to year value |
|
| 172 | + |
|
| 173 | +Once we have our 25% value, go and add it back to our two-digit year |
|
| 174 | +value: |
|
| 175 | + |
|
| 176 | +``` |
|
| 177 | + 14 + 3 = 17 |
|
| 178 | +``` |
|
| 179 | + |
|
| 180 | +#### Step 4: Subtract the largest fitting multiple of 7 |
|
| 181 | + |
|
| 182 | +Why multiple of 7? Seven days in a week. |
|
| 183 | + |
|
| 184 | +Some multiples of 7: |
|
| 185 | + |
|
| 186 | +|------|------|------|------|------|------|------|------| |
|
| 187 | +| 0 | 7 | 14 | 21 | 28 | 35 | 42 | 49 | |
|
| 188 | +|------|------|------|------|------|------|------|------| |
|
| 189 | + |
|
| 190 | +So, with a value of 17, what is the largest multiple of 7 that is still |
|
| 191 | +less than (or equal to) 17? |
|
| 192 | + |
|
| 193 | +Hopefully you identified the 14 as the likely candidate. |
|
| 194 | + |
|
| 195 | +``` |
|
| 196 | + 17 - 14 = 3 |
|
| 197 | +``` |
|
| 198 | + |
|
| 199 | +#### Step 5: Look up day in table |
|
| 200 | + |
|
| 201 | +We ended up with a 3 as the result for January 1st, 2014. |
|
| 202 | + |
|
| 203 | +Go and reference the 3 from that table... what day do we get? Does it |
|
| 204 | +match the actual day of the week for January 1st, 2014? We can verify it |
|
| 205 | +with the cal command: |
|
| 206 | + |
|
| 207 | +``` |
|
| 208 | + $ cal 01 2014 |
|
| 209 | + January 2014 |
|
| 210 | + Su Mo Tu We Th Fr Sa |
|
| 211 | + 1 2 3 4 |
|
| 212 | + 5 6 7 8 9 10 11 |
|
| 213 | + 12 13 14 15 16 17 18 |
|
| 214 | + 19 20 21 22 23 24 25 |
|
| 215 | + 26 27 28 29 30 31 |
|
| 216 | + |
|
| 217 | + lab46:~$ |
|
| 218 | +``` |
|
| 219 | + |
|
| 220 | +Pretty neat, eh? |
|
| 221 | + |
|
| 222 | +#### Exception: Leap Years |
|
| 223 | + |
|
| 224 | +In the event of a leap year, we simply subtract 1 from the 25% value, and |
|
| 225 | +continue on as usual. |
|
| 226 | + |
|
| 227 | +Makes sense, right? Leap years add a day, so something ends up being "off |
|
| 228 | +by one". |
|
| 229 | + |
|
| 230 | +#### Script |
|
| 231 | + |
|
| 232 | +It is your task to write a bash script that will use the above method to |
|
| 233 | +determine the day of the week any given January 1st in the 21st century |
|
| 234 | +falls on. |
|
| 235 | + |
|
| 236 | +Your script should: |
|
| 237 | + * prompt the user for the four digit year (input) |
|
| 238 | + * perform the task (process) |
|
| 239 | + * display the final value (output) |
|
| 240 | + |
|
| 241 | +#### Execution |
|
| 242 | + |
|
| 243 | +Here is a sample run of the script: |
|
| 244 | + |
|
| 245 | +``` |
|
| 246 | + Which year: 2014 |
|
| 247 | + January 1st, 2014 falls on: Wednesday |
|
| 248 | +``` |
|
| 249 | + |
|
| 250 | +The execution of the script is short and simple- obtain the input, do the |
|
| 251 | +processing, produce the output, and then terminate. |
|
| 252 | + |
|
| 253 | +#### Output Specifications |
|
| 254 | + |
|
| 255 | +Your program must output as follows: |
|
| 256 | + |
|
| 257 | + * Input prompts, and everything else except the actual day of the week |
|
| 258 | + should be output to STDERR |
|
| 259 | + |
|
| 260 | + * The calculated, fully-spelled-out day of the week (and only the day |
|
| 261 | + name) needs to be displayed to STDOUT |
|
| 262 | + |
|
| 263 | + * The output MUST contain the "January 1st, YEAR" string |
|
| 264 | + * YEAR must be all 4 digits, exactly as input by the user |
|
| 265 | + |
|
| 266 | + * The calculated day of the week must be fully spelled out and correct, |
|
| 267 | + with the first letter capitalized, remaining letters lowercase. |
|
| 268 | + |
|
| 269 | +#### Verification |
|
| 270 | + |
|
| 271 | +One of the tests I will perform for output compliance of your code will |
|
| 272 | +involve comparing your script's output against a range of input values, |
|
| 273 | +to see if they all output in conformance with project specifications. |
|
| 274 | + |
|
| 275 | +You can check your results by typing in the following at the prompt: |
|
| 276 | + |
|
| 277 | +``` |
|
| 278 | + $ ./verify |
|
| 279 | +``` |
|
| 280 | + |
|
| 281 | +If all aligns, you will see a lack of error messages output to the |
|
| 282 | +screen. However, if your output or formatting is off by even one byte, |
|
| 283 | +you will see a "MISMATCH". |
|
| 284 | + |
|
| 285 | +The resultant script MUST be well-organized, easy-to-read, consistently |
|
| 286 | +indented visually showing the encapsulated levels of logic, and be |
|
| 287 | +thoroughly commented to explain each significant step of the process. |
|
| 288 | + |
|
| 289 | +### REVERSE ENGINEER AND DOCUMENT A SCRIPT |
|
| 290 | + |
|
| 291 | +Reference and modify the files in the `revE/` directory. |
|
| 292 | + |
|
| 293 | +Here you will find a script, stripping of proper formatting and comments; |
|
| 294 | +it performs a task that you must figure out and document (in the form of |
|
| 295 | +comments), as you also restore proper indentation. |
|
| 296 | + |
|
| 297 | +Note that the files in their current form, while they perform an |
|
| 298 | +operation, are not in the proper form needed for submission (namely, |
|
| 299 | +laying out in an organized, easy-to-read, consistently indented, and |
|
| 300 | +well-commented fashion; that is something you may need to figure out). |
|
| 301 | + |
|
| 302 | +What is going on here? Both on a global (what functionality the script, |
|
| 303 | +when properly invoked, provides) and also more local (what are particular |
|
| 304 | +operations within the script doing to aid in performing the overall |
|
| 305 | +process). |
|
| 306 | + |
|
| 307 | +In your finished, submitted product, no line in the script should span |
|
| 308 | +longer than 90 characters. This includes both script logic and your |
|
| 309 | +comments. |
|
| 310 | + |
|
| 311 | + * with the exception of "then" and "do" statements, no other commands |
|
| 312 | + can be separated by semi-colons |
|
| 313 | + |
|
| 314 | + * if there are any naming manipulations needed on the script, create |
|
| 315 | + them as symbolic links against the main script. |
|
| 316 | + |
|
| 317 | + * submit with the rest of the `eoce`, by running "make submit" in the |
|
| 318 | + base directory. |
|
| 319 | + |
|
| 320 | +The resultant script MUST be well-organized, easy-to-read, consistently |
|
| 321 | +indented visually showing the encapsulated levels of logic, and be |
|
| 322 | +thoroughly commented to explain each significant step of the process. |
|
| 323 | + |
|
| 324 | +### PCTF |
|
| 325 | + |
|
| 326 | +Your task here is a familiar one: a letter division, just as we've |
|
| 327 | +encountered all semester. Only, this one is of the solve4 variety (ie not |
|
| 328 | +only do you have to solve for the key and provide a written step-by-step |
|
| 329 | +solution, but you also have to solve for the quotient and the remainder). |
|
| 330 | + |
|
| 331 | +Additionally, the puzzle difficulty has been increased to 'hard', which |
|
| 332 | +should provide more of a challenge than the 'medium'-rated puzzles you've |
|
| 333 | +had prior. |
|
| 334 | + |
|
| 335 | +Be sure to submit the appropriately-named and formatted files persuant to |
|
| 336 | +stated pctX project specifications (especially where a solve4-category |
|
| 337 | +puzzle is concerned). |
|
| 338 | + |
|
| 339 | +## SUBMISSION |
|
| 340 | + |
|
| 341 | +The DEADLINE FOR SUBMISSION of this EoCE is 11:59:59pm EDT (that's |
|
| 342 | +23:59:59 in 24-hour time) Tuesday, December 15th, 2026. This is the |
|
| 343 | +ultimate deadline for any and all coursework. There is no "late", only |
|
| 344 | +"too late". Don't be that person, not with this. |
|
| 345 | + |
|
| 346 | +I would highly recommend not waiting until the last moment (or even the |
|
| 347 | +last week) to start on this. It has been released weeks in advance, with |
|
| 348 | +the intention that you chip away at it a little bit at a time, over the |
|
| 349 | +course of weeks. |
|
| 350 | + |
|
| 351 | +As with the projects and other deliverables this semester, you can submit |
|
| 352 | +early (and worthwhile, early submissions or extra work can receive up to |
|
| 353 | +7 bonus points (applicable to the EoCE grading component)), and also |
|
| 354 | +submit as many times as you desire. Note that when you submit, that |
|
| 355 | +resets the timestamp from which I will evaluate any early submission |
|
| 356 | +bonus points or on-time eligibility. |
|
| 357 | + |
|
| 358 | +Eligibility of any received bonus points on the EoCE are ultimately up to |
|
| 359 | +my decision: if you have genuinely put forth just and honest effort that |
|
| 360 | +is worthy of this undertaking, you will likely receive any eligible bonus |
|
| 361 | +points as described. If you are more calculating and avoiding of work in |
|
| 362 | +your EoCE efforts, I reserve the right not to grant any bonus points. |
|
| 363 | + |
|
| 364 | +Also, if I notice any cases of rule violations (people overhelping each |
|
| 365 | +other instead of letting each individual complete the EoCE on their own |
|
| 366 | +accord and ability), you risk forfeiting any/all bonus points or even any |
|
| 367 | +credit for the section(s) that you violated the rules on. |
|
| 368 | + |
|
| 369 | +Additionally: |
|
| 370 | + |
|
| 371 | + * Solutions not abiding by spirit of project will be subject to a 50% |
|
| 372 | + overall deduction |
|
| 373 | + * Solutions not utilizing descriptive why and how comments will be |
|
| 374 | + subject to a 50% overall deduction |
|
| 375 | + * Solutions not utilizing indentation to promote scope and clarity will |
|
| 376 | + be subject to a 50% overall deduction |
|
| 377 | + * Solutions not organized and easy to read are subject to a 50% overall |
|
| 378 | + deduction |
|
| 379 | + |
|
| 380 | +Good luck! |