User Tools

Site Tools


haas:fall2016:data:projects:dsi0

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
haas:fall2016:data:projects:dsi0 [2015/08/26 13:23] – external edit 127.0.0.1haas:fall2016:data:projects:dsi0 [2016/08/27 18:10] (current) – [Verify Your Program] wedge
Line 9: Line 9:
  
 =====Errata===== =====Errata=====
-This section will document any updates applied to the project since original release: +This section will document any updates applied to the project since original  release: 
- +
-  * __revision #__: <description> (DATESTAMP)+
  
 +  * __revision 1__: added some additional output specifications that need to be followed. There will probably be more as time goes by, so keep checking for updates (20160813)
 +  * __revision 2__: nice to see people already getting started; I've had a few questions about project specifications I've clarified below, namely: your display function(s), unlike all the others, DO need to perform output. Also, I am looking for discrete append(), insert(), and obtain(), and some sort of display() functions. How you encapsulate the other functionality is left to you (combine forward/reverse? break them into separate functions?). Also, I'd recommend against using ANY global variables. Pass and return them from functions (this will be more in line with how the later projects work) (20160814)
 +  * __revision 3__: clarification- all prompts should display to STDERR. Only produced output (such as displaying or showing the obtained value) should go to STDOUT (20160820)
 +  * __revision 4__: added the "Verify your Program" section to highlight the availability of the 'projeval' tool (20160827)
 =====Objective===== =====Objective=====
 In this project, we get started with some course initialization and review activities. In this project, we get started with some course initialization and review activities.
Line 28: Line 30:
 Be sure to read through and over the syllabus, ensuring there are no questions on the material and organization of the course. Be sure to read through and over the syllabus, ensuring there are no questions on the material and organization of the course.
  
-====Opus Intro==== +====Journal Intro==== 
-Familiarize yourself with your Opus, and once there:+Familiarize yourself with your Journal, and once there:
   * customize it (title/subtitle)   * customize it (title/subtitle)
   * add an introduction   * add an introduction
   * create your first week content   * create your first week content
  
-**NOTE:** Week 1 opus entry will be due before Monday, the remainder of the intro Opus content will be due by this project's deadline.+**NOTE:** Week 1 journal entry will be due before Monday of week2, the remainder of the intro Journal content will be due by this project's deadline.
  
 ====Mailing List==== ====Mailing List====
 Using the resources found on the course homepage (or the lab46 website in general), locate and subscribe a preferred and frequently checked e-mail address to the class mailing list (known as **DATA**). Using the resources found on the course homepage (or the lab46 website in general), locate and subscribe a preferred and frequently checked e-mail address to the class mailing list (known as **DATA**).
  
-We will use this for class discussions (along with irc, the notes wiki page, your Opus, etc.) and to disseminate announcements and other information.+We will use this for class discussions (along with irc, the notes wiki page, your Journal, etc.) and to disseminate announcements and other information.
  
 Once subscribed, please send a message to the list introducing yourself (also so I can know to associate a particular e-mail address with you). Once subscribed, please send a message to the list introducing yourself (also so I can know to associate a particular e-mail address with you).
Line 51: Line 53:
 Ensure you can still (or if you are new to this, that you can successfully) log into lab46 via an ssh or mosh client. Ensure you can still (or if you are new to this, that you can successfully) log into lab46 via an ssh or mosh client.
  
-Lab46 will be the primary and supported development environment for the course. While you are free to use your own systems, any assigned projects:+Lab46 will be the primary and supported development environment for the course. While you are free to use your own systems for any projects not intimately tied to Lab46 or the LAIR, any assigned projects:
  
-  * MUST be submitted via lab46+  * MUST be submitted via lab46 (typically via the **submit** tool)
   * MUST compile, run, and function as required ON lab46   * MUST compile, run, and function as required ON lab46
  
 Remember, during open LAIR times you can always come in and use the pods. Remember, during open LAIR times you can always come in and use the pods.
  
 +NOTE that **many** of the projects in this class are heavily tied into Lab46, so you'll want to get used to using it as a development platform.
 ====Personal/Per-User Lab46 Mercurial Repository==== ====Personal/Per-User Lab46 Mercurial Repository====
-To both aid you and help you develop better development skills, I'd like for you to make regular commits and pushes to your [[/haas/spring2015/common/repo|Lab46 mercurial repository]].+To both aid you and help you develop better development skills, I'd like for you to make regular commits and pushes to your [[/haas/fall2016/common/repo|Lab46 mercurial repository]].
  
 This way, you can have a regular snapshot of your work as you go along, plus have the ability to grab an older copy should something go wrong. This way, you can have a regular snapshot of your work as you go along, plus have the ability to grab an older copy should something go wrong.
  
-Like the Opus, I will be looking for a minimal amount of repository-related activity PER WEEK (for example, I will be looking for AT LEAST 1 commit in relation to your program for week 1).+Like the Journal, I will be looking for a minimal amount of repository-related activity PER WEEK (for example, I will be looking for AT LEAST 1 commit in relation to your program for week 1).
  
 ====Program to Implement==== ====Program to Implement====
 As a means of simultaneous review, along with starting to acclimate ourselves to new concepts that we'll be encountering on a regular basis, I'd like for you to implement a program (in C) that does the following: As a means of simultaneous review, along with starting to acclimate ourselves to new concepts that we'll be encountering on a regular basis, I'd like for you to implement a program (in C) that does the following:
  
-  * Presents the user with a menu, having the following features: + 
-    * build list +===menu=== 
-      * prompt the user to enter number after number, adding (appending?) it to the list, until the user terminates the action by entering a -1 + 
-      * We will check for the -1 in the array to signify the end of our list +  * Presents the user with a menu, having the listed features. 
-    * display list +    * use numbers for input (don't get fancy) 
-      * From the first (zero-th) element of the array clear through to the element containing the -1, +    * use numbers in for the functionalities given (it will make it easier for me to evaluate) 
-      * display the contained numbers, along with their array index. +    * accept menu and general program input from STDIN (value followed by ENTER). 
-    * insert into list + 
-      * prompt for array index +<cli> 
-      * accept new value from the user +====dsi0==== 
-      * without destroying any array contents, place new value BEFORE specified array index +0. build list 
-        * this will likely involve shifting a bunch of data down an index +1. display list forward 
-    * append into list +2. display list backward 
-      * prompt for array index +3. insert into list 
-      * accept new value from the user +4. append into list 
-      * without destroying any array contents, place new value AFTER specified array index +5. obtain from list 
-        * this will likely involve shifting a bunch of data down an index +6. clear list 
-    * obtain from list +7. quit 
-      * prompt for array index +>>>  
-      * obtain value at array index and place it in a standalone variable (to be displayed to STDOUT) +</cli> 
-      * adjust array contents to no longer include this obtained value (we've removed it from the list) + 
-    * clear list + 
-      * empty the array, leaving it in an initial state (-1 at the 0 index) +===build list=== 
-    * quit + 
-      * Each menu item should correspond to a discrete activity you'll be performing on the list or program, and it is **highly recommended** that you break functionality out into separate functions.+  * build list 
 +    * prompt the user to enter number after number, appending it to the list, until the user terminates the action by entering a -1. Prompt will display to STDERR. 
 +    * We will check for the -1 in the array to signify the end of our list 
 +    * if you're crafty about it, this doesn't have to be a unique function, but a loop (even from the menu code) calling an existing function. 
 + 
 +<cli> 
 +>>>
 +enter value (-1 to finish): 2 
 +enter value (-1 to finish): 4 
 +enter value (-1 to finish): 6 
 +enter value (-1 to finish): 8 
 +enter value (-1 to finish): -1 
 +</cli> 
 + 
 +===display list=== 
 + 
 +  * display list forward 
 +    * From the first (zero-th) element of the array clear through to the element containing the -1, 
 +    * display the contained numbers, along with their array index. 
 +    * as output is a core necessity of displaying, your function displaying the list can and should perform output. 
 +    * I would like to see some sort of **display()** function; you can have a separate one for displaying forward (**displayf()**) and backward (**displayb()**), or one combining both functionalities. I leave that up to you. 
 + 
 +<cli> 
 +====dsi0==== 
 +0. build list 
 +1. display list forward 
 +2. display list backward 
 +3. insert into list 
 +4. append into list 
 +5. obtain from list 
 +6. clear list 
 +7. quit 
 +>>>
 +[0] 2 -> [1] 4 -> [2] 6 -> [3] 8 -> [4] -1 
 +</cli> 
 + 
 +  * display list backward 
 +    * From the last element (before the -1) to the beginning 
 +    * display the contained numbers, along with their array index. 
 +    * as output is a core necessity of displaying, your function displaying the list can and should perform output. 
 + 
 +<cli> 
 +====dsi0==== 
 +0. build list 
 +1. display list forward 
 +2. display list backward 
 +3. insert into list 
 +4. append into list 
 +5. obtain from list 
 +6. clear list 
 +7. quit 
 +>>>
 +[4] -1 -> [3] 8 -> [2] 6 -> [1] 4 -> [0] 2 
 +</cli> 
 + 
 +===insert=== 
 + 
 +  * insert into list 
 +    * prompt for array index (prompt will display to STDERR) 
 +    * accept new value from the user 
 +    * without destroying any array contents, place new value BEFORE specified array index 
 +      * this will likely involve shifting a bunch of data down an index 
 +    * this functionality should be encapsulated in a discrete **insert()** function 
 +      * avoid using global variables; pass and return necessary data 
 + 
 +<cli> 
 +====dsi0==== 
 +0. build list 
 +1. display list forward 
 +2. display list backward 
 +3. insert into list 
 +4. append into list 
 +5. obtain from list 
 +6. clear list 
 +7. quit 
 +>>>
 +Enter index to insert before: 2 
 +Enter value to insert into list: 5 
 +</cli> 
 + 
 +If you were to display the list (forward) after doing this insert, you should have: 2 4 5 6 8 (we inserted the 5 before the current element 2 (containing the 6)). 
 + 
 +===append list=== 
 + 
 +  * append into list 
 +    * prompt for array index (prompt will display to STDERR) 
 +    * accept new value from the user 
 +    * without destroying any array contents, place new value AFTER specified array index 
 +      * this will likely involve shifting a bunch of data down an index 
 +    * this functionality should be encapsulated in a discrete **append()** function 
 +      * avoid using global variables; pass and return necessary data 
 + 
 +<cli> 
 +====dsi0==== 
 +0. build list 
 +1. display list forward 
 +2. display list backward 
 +3. insert into list 
 +4. append into list 
 +5. obtain from list 
 +6. clear list 
 +7. quit 
 +>>>
 +Enter index to append after: 3 
 +Enter value to append into list: 7 
 + 
 +====dsi0==== 
 +0. build list 
 +1. display list forward 
 +2. display list backward 
 +3. insert into list 
 +4. append into list 
 +5. obtain from list 
 +6. clear list 
 +7. quit 
 +>>>
 +[0] 2 -> [1] 4 -> [2] 5 -> [3] 6 -> [4] 7 -> [5] 8 -> [6] -1 
 +</cli> 
 + 
 +===obtain=== 
 + 
 +  * obtain from list 
 +    * prompt for array index (prompt will display to STDERR) 
 +    * obtain value at array index and place it in a standalone variable (to be displayed to STDOUT) 
 +    * adjust array contents to no longer include this obtained value (we've removed it from the list) 
 +    * this functionality should be encapsulated in a discrete **obtain()** function 
 +      * avoid using global variables; pass and return necessary data 
 + 
 +<cli> 
 +====dsi0==== 
 +0. build list 
 +1. display list forward 
 +2. display list backward 
 +3. insert into list 
 +4. append into list 
 +5. obtain from list 
 +6. clear list 
 +7. quit 
 +>>>
 +Enter index to obtain: 3 
 +The value you obtained is: 6 
 + 
 +====dsi0==== 
 +0. build list 
 +1. display list forward 
 +2. display list backward 
 +3. insert into list 
 +4. append into list 
 +5. obtain from list 
 +6. clear list 
 +7. quit 
 +>>>
 +[0] 2 -> [1] 4 -> [2] 5 -> [3] 7 -> [4] 8 -> [5] -1 
 +</cli> 
 + 
 +===clear list=== 
 + 
 +  * clear list 
 +    * empty the array, leaving it in an initial state (-1 at the 0 index, more places if it messes up your reverse list display
 +    * if you're crafty about it, this doesn't have to be a unique function, but a loop (even from the menu code) calling an existing function. 
 + 
 +===quit=== 
 + 
 +  * quit 
 +    * Each menu item should correspond to a discrete activity you'll be performing on the list or program, and each item is implemented out in separate functions (with the exception of the quit option, although you can if you really want). 
   * Additionally, with the exception of displaying, you should perform no I/O within any of these functions (do it all in main(), or where-ever your core menu logic is located).   * Additionally, with the exception of displaying, you should perform no I/O within any of these functions (do it all in main(), or where-ever your core menu logic is located).
-  * This list, for now, will be housed within a statically declared integer array (of, say, 20 elements). You are to perform whatever manipulations are needed on that array.+    * basically, when appending, have a function that handles the actual append operation, but do the input and output in/around your menu code (so your append() function basically just manipulates the list). 
 +  * This list, for now, will be housed within a statically declared integer array (of 20 elements). You are to perform whatever manipulations are needed on that array
 +    * What if you exceed the array? You exceed it... the program may crash and or infinitely loop or otherwise be unpredictable. This program is really just to start you practicing on the important operations of inserting, appending, and obtaining.
   * A "list" is, for all intents and purposes, a sequence of values located together. They do not have to be sorted, merely considered part of a group or category. Here, we will use the containing features of the array to accomplish that (while simultaneously reviewing C!)   * A "list" is, for all intents and purposes, a sequence of values located together. They do not have to be sorted, merely considered part of a group or category. Here, we will use the containing features of the array to accomplish that (while simultaneously reviewing C!)
 +====Further output requirements====
 +The menu:
 +
 +<cli>
 +====dsi0====
 +0. build list
 +1. display list forward
 +2. display list backward
 +3. insert into list
 +4. append into list
 +5. obtain from list
 +6. clear list
 +7. quit
 +</cli>
 +
 +and prompt (note the trailing space after ">>> "):
 +
 +<cli>
 +>>> 
 +</cli>
 +
 +are to go to STDERR, and **NOT** STDOUT. The output from running the various menu options is to go to STDOUT.
 +
 +===Display arrows===
 +The display option arrows are to take the form " -> " (note the single space padded both before and after).
 +
 +===Display values===
 +The index value is enclosed in square brackets (first one flush against left margin), followed by a space, then the array element (then the padded display arrow).
 +
 +These output specifications play important roles, from facilitated program evaluation to testing how well you can code according to specifications (the latter a very important development skill to have).
 +
 +I may have been more lax in C, but here in Data Structures precision and conformance to requirements will be increasingly important (not only for the scope of the project, but for your own sanity as deviating from it will likely make things far more difficult for you in implementation). Might seem a bit nitpicky, and on some level it is... but on others, a very important learning opportunity for the types of things you'll be encountering in the future.
 ====Review C==== ====Review C====
 In addition to writing this program, please be sure you brush up on (at least) the following: In addition to writing this program, please be sure you brush up on (at least) the following:
Line 102: Line 304:
   * structs   * structs
   * pointers   * pointers
 +
 +
 +=====Verify Your Program=====
 +When your program is functional, you can test it for correctness by using the **projeval** tool on lab46. A series of tests will be run, and you will be able to see if you program is in spec (SUCCESS) or out of spec (MISMATCH).
 +
 +An example of a fully compliant test run follows:
 +
 +<cli>
 +lab46:~/src/data/dsi0$ projeval dsi0program
 +[projeval] Evaluating dsi0 for username
 +[test  0] display 4 element populated list forward ...
 +           you have: [0] 2 -> [1] 4 -> [2] 6 -> [3] 8 -> [4] -1
 +          should be: [0] 2 -> [1] 4 -> [2] 6 -> [3] 8 -> [4] -1
 +             Result: SUCCESS!
 +
 +[test  1] inserting into empty list ...
 +           you have: [0] 7 -> [1] -1
 +          should be: [0] 7 -> [1] -1
 +             Result: SUCCESS!
 +
 +[test  2] appending into empty list ...
 +           you have: [0] 7 -> [1] -1
 +          should be: [0] 7 -> [1] -1
 +             Result: SUCCESS!
 +
 +[test  3] obtaining from 1 entry list ...
 +           you have: The value you obtained is: 7
 +          should be: The value you obtained is: 7
 +             Result: SUCCESS!
 +
 +[test  4] obtaining first entry from 2 entry list ...
 +           you have: The value you obtained is: 7
 +          should be: The value you obtained is: 7
 +             Result: SUCCESS!
 +
 +[test  5] obtaining second entry from 2 entry list ...
 +           you have: The value you obtained is: 8
 +          should be: The value you obtained is: 8
 +             Result: SUCCESS!
 +
 +[test  6] inserting before first entry in list ...
 +           you have: [0] 6 -> [1] 7 -> [2] -1
 +          should be: [0] 6 -> [1] 7 -> [2] -1
 +             Result: SUCCESS!
 +
 +[test  7] inserting before second entry in list ...
 +           you have: [0] 7 -> [1] 8 -> [2] 9 -> [3] -1
 +          should be: [0] 7 -> [1] 8 -> [2] 9 -> [3] -1
 +             Result: SUCCESS!
 +
 +[test  8] appending after last entry in list ...
 +           you have: [0] 7 -> [1] 8 -> [2] 9 -> [3] -1
 +          should be: [0] 7 -> [1] 8 -> [2] 9 -> [3] -1
 +             Result: SUCCESS!
 +
 +[test  9] appending after second to last entry in list ...
 +           you have: [0] 7 -> [1] 8 -> [2] 9 -> [3] -1
 +          should be: [0] 7 -> [1] 8 -> [2] 9 -> [3] -1
 +             Result: SUCCESS!
 +
 +[test 10] clearing list then appending ...
 +           you have: [0] 7 -> [1] -1
 +          should be: [0] 7 -> [1] -1
 +             Result: SUCCESS!
 +
 +[test 11] obtaining second entry from 2 entry list (check list integrity) ...
 +           you have: [0] 7 -> [1] -1
 +          should be: [0] 7 -> [1] -1
 +             Result: SUCCESS!
 +
 +[test 12] obtaining first entry from 2 entry list (checking list integrity) ...
 +           you have: [0] 8 -> [1] -1
 +          should be: [0] 8 -> [1] -1
 +             Result: SUCCESS!
 +
 +[test 13] obtaining from 1 entry list (checking list integrity) ...
 +           you have: [0] -1
 +          should be: [0] -1
 +             Result: SUCCESS!
 +
 +lab46:~/src/data/dsi0$ 
 +</cli>
  
 =====Submission Criteria===== =====Submission Criteria=====
Line 134: Line 418:
 lab46:~/src/data/dsi0$  lab46:~/src/data/dsi0$ 
 </cli> </cli>
- 
haas/fall2016/data/projects/dsi0.1440595385.txt.gz · Last modified: 2016/08/12 19:40 (external edit)