**CS 111 f19 - Homework 0** *Due: Friday, September 20, at 9pm* --- Track how much time you spend on this homework outside class. You’re required to include this in [what you turn in](#whattoturnin). Post questions on the [Homework 0 forum](https://moodle.carleton.edu/mod/forum/view.php?id=479166)! # Survey **(Due EARLY, before class on Wednesday, September 18)** Complete the introductory [survey](https://moodle.carleton.edu/mod/questionnaire/view.php?id=479843) before class on Wednesday. This is a really important part of helping me make the course as useful for you as possible. # Lab Environment Take some time to get oriented to the setup in the computer labs (CMC 102, 304, and 306). Go to one of them to complete the following two activities. There is nothing to turn in for this section, but please post any questions or problems you encounter to the [homework 0 discussion forum](https://moodle.carleton.edu/mod/forum/view.php?f=38162) or bring them to class. ## Log in Some of the machines in these rooms boot into both Windows and MacOS; you’ll need MacOS. (If you don’t see a Mac login screen, you’ll need to reboot into the Mac side.) Log in, using your Carleton user name and password. If you can’t log in, contact Mike Tie, the all-star CS technical guru, in CMC 305. If you see an icon called `map-network-drives` on the desktop, go see Mike Tie. If you see a folder named Courses in your home directory, go see Mike Tie. ## UNIX tutorial The MacOS command line, which we will use extensively in this course, is based on the UNIX operating system. To introduce you to this environment, Work through Typographical Conventions, Introduction to the UNIX Operating System, and Tutorials 1–4 of [this Unix tutorial](http://cs.carleton.edu/faculty/jondich/documents/unixtutorial/) on the CS web site. # Describing Algorithms These final two exercises will help you practice *thinking like a computer* by translating tasks into step-by-step procedures. ## Word Frequency Often, one property of good writing is varied and interesting word choice. Overusing a particular word can feel repetitive and boring. Thus, I want to determine what word appears *most frequently* in a document. Describe, in as much detail as necessary to be completely clear, a step-by-step procedure to determine what word is the most frequently used word in a given document. Do not give instructions like "count how many times the word $x$ appears in the document"; instead, tell me how to figure out how many times the word $x$ appears in the document. You should assume I have a very bad memory, but plenty of scratch paper; tell me what to write down (or read from my notes). In particular, you should assume that I can do the following kinds of things reliably: - remember a word or three in my head. (But not more than about three words at a time.) - recognize a word that I’m remembering when I see it. - write things down on a piece of scrap paper. - use my fingers to keep track of where I am in the document or on a piece of scrap paper. I expect that a full description will take approximately 0.5 page of single-spaced typewritten text, but that’s a guideline only; write as much or as little as is necessary to convey your procedure. ## Scrabble Bingo The game of Scrabble is a word game in which players form words from a collection of tiles in their hand. The first player draws a “hand” of seven tiles, each of which has a letter printed on it. The person aims to form a legal word—one found in the official Scrabble dictionary—worth as many points as possible. A bingo is a play that uses all seven tiles in the player’s hand. The Scrabble scoring system strongly rewards bingos. For example, if you are dealt the hand ******************************************************************************* * .---. .---. .---. .---. .---. .---. .---. * | N | | T | | H | | P | | O | | S | | Y | * '---' '---' '---' '---' '---' '---' '---' ******************************************************************************* then you can play a bingo (the word PYTHONS), but if you are dealt the hand ******************************************************************************* * .---. .---. .---. .---. .---. .---. .---. * | C | | A | | R | | L | | E | | T | | O | * '---' '---' '---' '---' '---' '---' '---' ******************************************************************************* then there’s no bingo play available. Describe, in as much detail as necessary to be completely clear, an algorithm that determines whether a given hand $h$ of seven tiles can be played as a bingo. As before, do not give instructions like "try all the different orderings of h and see if any of them are words"; instead, tell me how to figure out every step. You should assume that I have a very bad memory, but plenty of scratch paper; tell me what to write down (or read from my notes) as I look at the tiles. You should assume that I have access to a dictionary, but I don’t remember how to use it well. In particular, you should assume that I can do the following kinds of things reliably: - turn pages in the dictionary. - remember a few words (or any sequence of up to ten letters) in my head. - recognize a word that I’m remembering when I see it. - write things down on a piece of scrap paper. - use my fingers to keep track of where I am in the dictionary, tiles, or on a piece of scrap paper. Hint: you may find it easier to consider each word in the dictionary and check if it can be played with the available tiles rather than to consider each possible arrangement of the available tiles. # What to Turn In - **Introductory survey** before class on Wednesday Submit the following files via the [Moodle homework 0 page](https://moodle.carleton.edu/mod/assign/view.php?id=479844) - A file called `frequency.txt` with your [most frequent word algorithm](#wordfrequency) - A file called `scrabble.txt` with your [Scrabble bingo algorithm](#scrabblebingo) - A file called `feedback.txt` with the following information (you get points for answering these questions!): - How many hours you spent outside of class on this homework. - The difficulty of this homework for this point in a 100-level course as: too easy, easy, moderate, challenging, or too hard. - What did you learn on this homework (very briefly)? Rate the educational value relative to the time invested from 1 (low) to 5 (high). *Acknowledgments: content adapted from David Liben-Nowell*