Scrabble challenge: Difference between revisions

imported>Jesstess
No edit summary
 
(19 intermediate revisions by 9 users not shown)
Line 1:
[[File:Scrabble.jpg|right|300px]]
 
== Project ==
 
Line 14 ⟶ 16:
Write a Python script that takes a Scrabble rack as a command-line argument and prints all valid Scrabble words that can be constructed from that rack, along with their Scrabble scores, sorted by score. An example invocation and output:
 
<pre>[[Media:]]
$ python scrabble.py ZAEFIEE
17 feeze
Line 39 ⟶ 41:
===Resources===
 
* http://wwwcourses.isccms.rocaltech.edu/cs11/material/advjava/listslab1/sowpods.zip contains all words in the official [http://en.wikipedia.org/wiki/SOWPODS SOWPODS] word list, one word per line.
* Here is a dictionary containing all letters and their Scrabble values:
 
Line 71 ⟶ 73:
Write the code to get the Scrabble rack (the letters available to make words) from the command line argument passed to your script. For example if your script were called `scrabble_cheater.py`, if you ran <tt>python scrabble_cheater.py RSTLNEI</tt>, <tt>RSTLNEI</tt> would be the rack.
 
Handle the case where a user forgets to supply a rack; in this case, print an error message saying they need to supply some letters., Makeand surethen you are consistent about capitalization: if your scores dictionary is lowercase,exit the lettersprogram supplied byusing the user<code>exit()</code> needfunction. toMake besure convertedyou toare lowercaseconsistent atabout some point before you compare them.capitalization
 
<b>Step 2 resources</b>:
Line 83 ⟶ 85:
<li>Converting letters to lower case: http://docs.python.org/library/stdtypes.html#str.lower</li>
</ul>
 
 
====Step 3: find valid words====
Line 128 ⟶ 129:
<pre>
$ python scrabble.py ZZAAEEI
22 ,zeze
21 ,ziz
12 ,zee
12 ,zea
11 ,za
3 ,aia
2 ,ee
2 ,ea
2 ,ai
2 ae,aa
2 aa,ae
</pre>
 
===Bonus challenge===
 
===Congr!===
Modify your script to handle blank tiles. Blank tiles have a score of 0 but can be used to represent any letter.
 
You've implemented a substantial, useful script in Python from scratch that is perfect for cheating at Scrabble or Words with Friends. Keep practicing!
===Congratulations!===
 
[[File:Fireworks.png|150px]]
You've implemented a substantial, useful script in Python from scratch that is perfect for cheating at Scrabble or Words with Friends. Keep practicing!
[[File:Balloos.png|150px]]
Anonymous user