Difference between revisions of "CISC220 F2023 Lab1"

From class_wiki
Jump to: navigation, search
(3. Submission)
(3. Submission)
 
(10 intermediate revisions by the same user not shown)
Line 10: Line 10:
 
** Your shell must be "bash" (test with ''echo $SHELL'').  Either type "bash" after logging in or change your default shell with <tt>chsh</tt>
 
** Your shell must be "bash" (test with ''echo $SHELL'').  Either type "bash" after logging in or change your default shell with <tt>chsh</tt>
 
* Run it: ''./wordbyword test.txt''.  You should get a list of words in the file.
 
* Run it: ''./wordbyword test.txt''.  You should get a list of words in the file.
 +
* To get credit, in the PDF you submit (see below), include some explanation/evidence/screenshots that you have a functional workflow for compiling and running C++ code.  At a minimum, please tell us what OS and compiler/IDE you are using, and whether this is your machine, a UD machine, a VM, or something else.  You may also verbally show/tell this to a TA or the instructor for credit.  If you do this, please mention it in the PDF.
  
 
===2. C++ programming exercises===
 
===2. C++ programming exercises===
  
*'''(1 point)''' Make a ''piglatin'' directory and copy the wordbyword main.cpp and Makefile into it.  Change the executable name in the Makefile to ''piglatin''.  Now instead of just echoing the words that you read, write a function ''string piglatin(string s)'' which takes a normal word and returns a string with the "pig latin" form of that word according to a simplified version of these [https://en.wikipedia.org/wiki/Pig_Latin#Rules rules].  In these rules, the first letter of the word is moved to the end if it is a consonant and "ay" is appended.  For example, "happy" becomes "appyhay" and "duck" becomes "uckday".  Consonant clusters are moved as a group: "friends" becomes "iendsfray" and "school" becomes "oolschay".  If the first letter of the word is a vowel, just add "way" to the end of it.  So "egg" becomes "eggway" and "awesome" becomes "awesomeway".
+
*'''(2 points)''' Make a ''piglatin'' directory and copy the wordbyword main.cpp and Makefile into it.  Change the executable name in the Makefile to ''piglatin''.  Now instead of just echoing the words that you read, write a function ''string piglatin(string s)'' which takes a normal word and returns a string with the "pig latin" form of that word according to a simplified version of these [https://en.wikipedia.org/wiki/Pig_Latin#Rules rules].  In these rules, the first letter of the word is moved to the end if it is a consonant and "ay" is appended.  For example, "happy" becomes "appyhay" and "duck" becomes "uckday".  Consonant clusters are moved as a group: "friends" becomes "iendsfray" and "school" becomes "oolschay".  If the first letter of the word is a vowel, just add "way" to the end of it.  So "egg" becomes "eggway" and "awesome" becomes "awesomeway".
* '''(3 points)''' Make a ''wordsearch'' directory.  Now your program will read in two text files, first a letter grid of unknown size and second a list of words (one per line) to find in that grid.  The words may be horizontal, vertical, or diagonal, backwards or forwards.  The grid may have spaces in it; ignore case in both files.  The output should be a per-line display of the word's first letter location by (row, column) ("(-1, -1)" if not found).  At some point your program should have a dynamically-allocated 2-D array of chars ('''YOU MAY USE AI FOR THIS INTERMEDIATE STEP ONLY''') that is then searched systematically.  Two sample puzzles are given below:
+
* '''(2 points)''' Make a ''wordsearch'' directory.  Now your program will read in two text files, first a rectangular character grid of unknown dimensions and second a list of words (one per line) to find in that grid.  The words may be horizontal, vertical, or diagonal, backwards or forwards.  The grid may have spaces in it; ignore case in both files.  The output should be a per-line display of the word's first letter location by <tt>row,column</tt> (no whitespace, 0-based indexing, write <tt>-1,-1</tt> if not found).  At some point your program should have a dynamically-allocated 2-D array of chars ('''YOU MAY USE AI FOR THIS INTERMEDIATE STEP ONLY (NO STL/VECTORS)''') that is then searched systematically.  Two sample puzzles are given below:
 
** African capitals: [http://nameless.cis.udel.edu/class_data/cisc220/africa_grid.txt grid], [http://nameless.cis.udel.edu/class_data/cisc220/africa_words.txt word list]
 
** African capitals: [http://nameless.cis.udel.edu/class_data/cisc220/africa_grid.txt grid], [http://nameless.cis.udel.edu/class_data/cisc220/africa_words.txt word list]
 
** Animals: [http://nameless.cis.udel.edu/class_data/cisc220/animal_grid.txt grid], [http://nameless.cis.udel.edu/class_data/cisc220/animal_words.txt word list]
 
** Animals: [http://nameless.cis.udel.edu/class_data/cisc220/animal_grid.txt grid], [http://nameless.cis.udel.edu/class_data/cisc220/animal_words.txt word list]
Line 22: Line 23:
 
* Put a '''PDF file''' <Your Name>_README.pdf in <Your Name>_Lab1 explaining what OS and text editor/IDE you are using, as well as any AI tool citations/explanations that are required per the syllabus.  Please also add a section, if necessary, noting any limitations or issues of your code, as well as your interpretation of any ambiguities in the instructions.
 
* Put a '''PDF file''' <Your Name>_README.pdf in <Your Name>_Lab1 explaining what OS and text editor/IDE you are using, as well as any AI tool citations/explanations that are required per the syllabus.  Please also add a section, if necessary, noting any limitations or issues of your code, as well as your interpretation of any ambiguities in the instructions.
 
* Create a single tar/zip/rar file out of the top-level and all subdirectories.  This archive file should be named <Your Last Name>_Lab1.tar (or .zip or .rar, etc.). If you didn't follow the Unix/Linux directions above but used Visual Studio/Xcode or something like that, please do NOT submit files associated with those compilers -- only C++ code and header files, please.
 
* Create a single tar/zip/rar file out of the top-level and all subdirectories.  This archive file should be named <Your Last Name>_Lab1.tar (or .zip or .rar, etc.). If you didn't follow the Unix/Linux directions above but used Visual Studio/Xcode or something like that, please do NOT submit files associated with those compilers -- only C++ code and header files, please.
 +
* '''Add your name (and your lab partner's if you have one), the date, and the class and section number as comments at the top of EVERY code file that you submit'''
 
* Submit it in Canvas
 
* Submit it in Canvas
 +
* '''NEW (9/2): GRADESCOPE AUTOGRADER'''.  We are trying out autograding for this assignment (and hopefully future assignments!) with Gradescope in Canvas.  Please submit your code to Gradescope as detailed below and let me know if you have any issues/comments.
 +
** You should see the assignment after clicking "Gradescope Pilot" in Canvas
 +
** Rename your piglatin main.cpp to "piglatin.cpp" and wordsearch main.cpp to "wordsearch.cpp", and submit both of them at once -- nothing else
 +
** Note: Read the instructions above on the output format for wordsearch carefully, and omit the last cout in piglatin.cpp which declares how many total words there are.
 +
** Tests have been structured so that you can get a maximum of 2 points for piglatin.cpp and 2 points for wordsearch.cpp, in 0.25 point gradations.  If your program doesn't compile, you will get 0 points on the tests
 +
** Feel free to resubmit as many times as you like until the deadline

Latest revision as of 16:50, 2 September 2023

Lab #1

1. Getting started (1 point)

  • Get your programming environment figured out following these set-up instructions. Directions below are for Linux/Unix.
  • Download the class programs cplusplus_1.tar to the computer you are working on and untar it (if it's unfamiliar, Google "tar command" or try "man tar" in Unix).
  • Make a directory called <Your Name>_Lab1 and copy the wordbyword subdirectory from the cplusplus_1 directory into it (cp wordbyword/* <Your Name>_Lab1/).
  • Verify that you can compile wordbyword by typing "make" in that directory.
    • If this doesn't work, you probably need to add g++, etc. to your path.
    • Your shell must be "bash" (test with echo $SHELL). Either type "bash" after logging in or change your default shell with chsh
  • Run it: ./wordbyword test.txt. You should get a list of words in the file.
  • To get credit, in the PDF you submit (see below), include some explanation/evidence/screenshots that you have a functional workflow for compiling and running C++ code. At a minimum, please tell us what OS and compiler/IDE you are using, and whether this is your machine, a UD machine, a VM, or something else. You may also verbally show/tell this to a TA or the instructor for credit. If you do this, please mention it in the PDF.

2. C++ programming exercises

  • (2 points) Make a piglatin directory and copy the wordbyword main.cpp and Makefile into it. Change the executable name in the Makefile to piglatin. Now instead of just echoing the words that you read, write a function string piglatin(string s) which takes a normal word and returns a string with the "pig latin" form of that word according to a simplified version of these rules. In these rules, the first letter of the word is moved to the end if it is a consonant and "ay" is appended. For example, "happy" becomes "appyhay" and "duck" becomes "uckday". Consonant clusters are moved as a group: "friends" becomes "iendsfray" and "school" becomes "oolschay". If the first letter of the word is a vowel, just add "way" to the end of it. So "egg" becomes "eggway" and "awesome" becomes "awesomeway".
  • (2 points) Make a wordsearch directory. Now your program will read in two text files, first a rectangular character grid of unknown dimensions and second a list of words (one per line) to find in that grid. The words may be horizontal, vertical, or diagonal, backwards or forwards. The grid may have spaces in it; ignore case in both files. The output should be a per-line display of the word's first letter location by row,column (no whitespace, 0-based indexing, write -1,-1 if not found). At some point your program should have a dynamically-allocated 2-D array of chars (YOU MAY USE AI FOR THIS INTERMEDIATE STEP ONLY (NO STL/VECTORS)) that is then searched systematically. Two sample puzzles are given below:

3. Submission

  • Put a PDF file <Your Name>_README.pdf in <Your Name>_Lab1 explaining what OS and text editor/IDE you are using, as well as any AI tool citations/explanations that are required per the syllabus. Please also add a section, if necessary, noting any limitations or issues of your code, as well as your interpretation of any ambiguities in the instructions.
  • Create a single tar/zip/rar file out of the top-level and all subdirectories. This archive file should be named <Your Last Name>_Lab1.tar (or .zip or .rar, etc.). If you didn't follow the Unix/Linux directions above but used Visual Studio/Xcode or something like that, please do NOT submit files associated with those compilers -- only C++ code and header files, please.
  • Add your name (and your lab partner's if you have one), the date, and the class and section number as comments at the top of EVERY code file that you submit
  • Submit it in Canvas
  • NEW (9/2): GRADESCOPE AUTOGRADER. We are trying out autograding for this assignment (and hopefully future assignments!) with Gradescope in Canvas. Please submit your code to Gradescope as detailed below and let me know if you have any issues/comments.
    • You should see the assignment after clicking "Gradescope Pilot" in Canvas
    • Rename your piglatin main.cpp to "piglatin.cpp" and wordsearch main.cpp to "wordsearch.cpp", and submit both of them at once -- nothing else
    • Note: Read the instructions above on the output format for wordsearch carefully, and omit the last cout in piglatin.cpp which declares how many total words there are.
    • Tests have been structured so that you can get a maximum of 2 points for piglatin.cpp and 2 points for wordsearch.cpp, in 0.25 point gradations. If your program doesn't compile, you will get 0 points on the tests
    • Feel free to resubmit as many times as you like until the deadline