pset5 - MIT OpenCourseWare http/ocw.mit.edu 6.00...

Info icon This preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
MIT OpenCourseWare http://ocw.mit.edu 6.00 Introduction to Computer Science and Programming Fall 2008 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms .
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
6.00: Introduction to Computer Science and Programming Problem Set 5: Wordgames Handed out: Thursday, October 2, 2008 Due: 11:59pm, Thursday October 9, 2008 Introduction As children, we loved wordgames like Ghost. So, like any good parent or teacher, we'll now force you to do the things that interested us when we were younger. In this problem set, you'll implement two wordgames : first, we'll help you through implementing the 6.00 wordgame, and then you'll implement Ghost on your own. Don't be intimidated by the length of this problem set. It's a lot of reading, but it is very doable. Let's begin by describing the 6.00 wordgame: This game is a lot like Scrabble or Text Twist, if you've played those. Letters are dealt to players, who then construct one or more words out of their letters. Each valid word receives a score, based on the length of the word and the letters in that word. The rules of the game are as follows: Dealing A player is dealt a hand of n letters chosen at random (assume n=7 for now). The player arranges the hand into a set of words using each letter at most once. Some letters may remain unused (these won't be scored). Scoring The score for the hand is the sum of the score for the words. The score for a word is the sum of the points for letters in the word, plus 50 points if all n letters are used on the first go. Letters are scored as in Scrabble; A is worth 1, B is worth 3, C is worth 3, D is worth 2, E is worth 1, and so on. We have defined the dictionary SCRABBLE_LETTER_VALUES that maps each lowercase letter to its Scrabble letter value. For example, 'weed' would be worth 8 points (4+1+1+2=8), as long as the hand actually has 1 'w', 2 'e's, and 1 'd'. As another example, if n =7 and you get 'waybill' on the first go, it would be worth 65 points (4+1+4+3+1+1+1=15, +50 for the 'bingo' bonus of using all seven letters). Workload Please let us know how long you spend on each problem. We want to be careful not to overload you by giving out problems that take longer than we anticipated. Collaboration You may work with other students. However, each student should hand in the assignment separately. Also, be sure to indicate with whom you have worked. This is the collaboration policy for all the problem sets in this course. Getting Started 1. Download and save ps5.py : the skeleton you'll fill in for Problems 1-5 test_ps5.py : Unit tests for some of your code (more on this later) ps5_ghost.py : the skeleton you'll fill in for Problem 6 words.txt : the list of valid words (all words acceptable in North American Scrabble up to 10 letters long)
Image of page 2
Make sure to put all of the files in the same directory!
Image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern