homeGeek CultureWebstoreeCards!Forums!Joy of Tech!AY2K!webcam

The Geek Culture Forums


Post New Topic  New Poll  Post A Reply
my profile | directory login | | search | faq | forum home
  next oldest topic   next newest topic
» The Geek Culture Forums   » News, Reviews, Views!   » Our stupid lives   » scrabble

 - UBBFriend: Email this page to someone!    
Author Topic: scrabble
nerdwithnofriends
Uber Geek
Member # 3773

Icon 1 posted November 24, 2005 12:45      Profile for nerdwithnofriends     Send New Private Message       Edit/Delete Post   Reply With Quote 
So my mom wanted us to have a family game of scrabble today for thanksgiving, and she said we could use our computers to 'look up words'.

Well, here's my secret weapon, should anybody here really care:

code:
 
#!/usr/bin/python
lettervalues = { '*':0, 'a':1, 'b':3, 'c':3, 'e':1, 'f':4, 'g':2, 'h':4, 'i':1, 'j':8, 'k':5, 'l':1, 'm':3, 'n':1, 'o':1, 'p':3, 'q':10, 'r':1, 's':1, 't':1, 'u':1, 'v':4, 'w':4, 'x':8, 'y':4, 'z':10 }


wordsource = '/usr/share/dict/web2'
sourcefile = open(wordsource, 'r')
wordlist = []
for line in sourcefile:
wordlist.append(line.rstrip('\n').lower())
sourcefile.close()
#for line in wordlist:
# print line

while True:
letters = raw_input('available letters: ')
if letters == '': break
stems = []
s = ' '
while s != '':
s = raw_input('word stem: ')
if s != '': stems.append(s.lower())
else: break
if stems == []: break
viable = False
numwildcards = letters.count('*')
for stem in stems:
for word in wordlist:
for i in range(len(stem)):
ch = stem[i]
aletters = letters + ch
for w in word:
if word.count(w) == aletters.count(w):
viable = True
else:
viable = False
break
if viable and len(word) > 1:
print '%s[ %s ]%s -> %s'%(stem[0:i],stem[i], stem[i+1:len(stem)], word)


print 'Exiting.'



--------------------
"The Buddha, the Godhead, resides quite as comfortably in the circuits of a digital computer or the gears of a cycle transmission as he does at the top of a mountain or in the petals of a flower." - Robert M. Pirsig

Posts: 948 | Registered: Mar 2005  |  IP: Logged
Rhonwyyn

Solid Gold SuperFan!
Member # 2854

Member Rated:
4
Icon 1 posted November 24, 2005 16:26      Profile for Rhonwyyn   Author's Homepage     Send New Private Message       Edit/Delete Post   Reply With Quote 
But the real question is,

did you win?

[Wink]

--------------------
Change the way you SEE, not the way you LOOK!

Posts: 3849 | From: Lancaster, PA | Registered: Jul 2004  |  IP: Logged
nerdwithnofriends
Uber Geek
Member # 3773

Icon 1 posted November 24, 2005 16:43      Profile for nerdwithnofriends     Send New Private Message       Edit/Delete Post   Reply With Quote 
quote:
Originally posted by Rhonwyyn:
But the real question is,

did you win?

[Wink]

Actually, I lost by four points to my mom. But no machine can beat her; she's a scrabble master [Razz]

--------------------
"The Buddha, the Godhead, resides quite as comfortably in the circuits of a digital computer or the gears of a cycle transmission as he does at the top of a mountain or in the petals of a flower." - Robert M. Pirsig

Posts: 948 | Registered: Mar 2005  |  IP: Logged
supergoo

SuperFan!
Member # 2280

Member Rated:
5
Icon 2 posted November 25, 2005 09:15      Profile for supergoo     Send New Private Message       Edit/Delete Post   Reply With Quote 
Scrabble is my favorite game ever!!

I wish I had someone to play scrabble with, everyone I know doesn't like to play scrabble [Frown]

--------------------
Y los sueños, sueños son.

Posts: 675 | From: Boston 'burbs | Registered: Jul 2003  |  IP: Logged
maximile

SuperFan!
Member # 3446

Member Rated:
5
Icon 1 posted November 25, 2005 09:58      Profile for maximile   Author's Homepage     Send New Private Message       Edit/Delete Post   Reply With Quote 
I'm sure there's a cross-platform online solution somewhere out there... we could have a GC tournament!

Of course, python scripting would have to be allowed. In fact, it'd probably turn into a python contest instead, knowing our crowd... [Roll Eyes]

Posts: 1085 | From: London, UK (Powys, UK in hols) | Registered: Feb 2005  |  IP: Logged
drunkennewfiemidget
BlabberMouth, a Blabber Odyssey
Member # 2814

Member Rated:
4
Icon 1 posted November 25, 2005 10:57      Profile for drunkennewfiemidget     Send New Private Message       Edit/Delete Post   Reply With Quote 
quote:
Originally posted by maximile:
I'm sure there's a cross-platform online solution somewhere out there... we could have a GC tournament!

Of course, python scripting would have to be allowed. In fact, it'd probably turn into a python contest instead, knowing our crowd... [Roll Eyes]

Not everyone in our crowd is silly enough to code in Python. [Wink]

</holy-war>

Posts: 4897 | From: Cambridge, ON, Canada | Registered: Jun 2004  |  IP: Logged
dragonman97

SuperFan!
Member # 780

Member Rated:
4
Icon 1 posted November 25, 2005 12:36      Profile for dragonman97   Author's Homepage     Send New Private Message       Edit/Delete Post   Reply With Quote 
Newf: If we could round up another Perl hacker, I bet we could reduce it to line noise. [Wink] [Big Grin]

I kid...really...I write clean Perl. [Smile]

--------------------
There are three things you can be sure of in life: Death, taxes, and reading about fake illnesses online...

Posts: 9331 | From: Westchester County, New York | Registered: May 2001  |  IP: Logged
nerdwithnofriends
Uber Geek
Member # 3773

Icon 1 posted November 25, 2005 13:40      Profile for nerdwithnofriends     Send New Private Message       Edit/Delete Post   Reply With Quote 
quote:
Originally posted by drunkennewfiemidget:
quote:
Originally posted by maximile:
I'm sure there's a cross-platform online solution somewhere out there... we could have a GC tournament!

Of course, python scripting would have to be allowed. In fact, it'd probably turn into a python contest instead, knowing our crowd... [Roll Eyes]

Not everyone in our crowd is silly enough to code in Python. [Wink]

</holy-war>

You would prefer java, perhaps?

Yeah, that's what I thought [Razz]

--------------------
"The Buddha, the Godhead, resides quite as comfortably in the circuits of a digital computer or the gears of a cycle transmission as he does at the top of a mountain or in the petals of a flower." - Robert M. Pirsig

Posts: 948 | Registered: Mar 2005  |  IP: Logged
drunkennewfiemidget
BlabberMouth, a Blabber Odyssey
Member # 2814

Member Rated:
4
Icon 1 posted November 25, 2005 16:53      Profile for drunkennewfiemidget     Send New Private Message       Edit/Delete Post   Reply With Quote 
quote:
Originally posted by nerdwithnofriends:
quote:
Originally posted by drunkennewfiemidget:
quote:
Originally posted by maximile:
I'm sure there's a cross-platform online solution somewhere out there... we could have a GC tournament!

Of course, python scripting would have to be allowed. In fact, it'd probably turn into a python contest instead, knowing our crowd... [Roll Eyes]

Not everyone in our crowd is silly enough to code in Python. [Wink]

</holy-war>

You would prefer java, perhaps?

Yeah, that's what I thought [Razz]

*vomits on nwnf*
Posts: 4897 | From: Cambridge, ON, Canada | Registered: Jun 2004  |  IP: Logged
Elvermere
Geek
Member # 2456

Member Rated:
2
Icon 12 posted November 26, 2005 04:34      Profile for Elvermere     Send New Private Message       Edit/Delete Post   Reply With Quote 
AHA!

We just figured out why he has no friends!

Java indeed! [crazy]

--------------------
Duct Tape is like the force.
It has a light side and a dark side and it holds the universe together.

Posts: 113 | From: Perth, West AU | Registered: Nov 2003  |  IP: Logged
The Famous Druid

Gold Hearted SuperFan!
Member # 1769

Member Rated:
4
Icon 1 posted November 26, 2005 12:14      Profile for The Famous Druid     Send New Private Message       Edit/Delete Post   Reply With Quote 
Of course, a Real Programmer would have used a bash script [Wink]

--------------------
If you watch 'The History Of NASA' backwards, it's about a space agency that has no manned spaceflight capability, then does low-orbit flights, then lands on the Moon.

Posts: 10668 | From: Melbourne, Australia | Registered: Oct 2002  |  IP: Logged
dragonman97

SuperFan!
Member # 780

Member Rated:
4
Icon 1 posted November 26, 2005 16:44      Profile for dragonman97   Author's Homepage     Send New Private Message       Edit/Delete Post   Reply With Quote 
Oy...back in my day, we didn't have bash scripts - we had assembly, and we liked it! Why, me older mate Jimmy 'ad to program in binary...using nails wrapped in 'lectrical tape, and he was glad!

--------------------
There are three things you can be sure of in life: Death, taxes, and reading about fake illnesses online...

Posts: 9331 | From: Westchester County, New York | Registered: May 2001  |  IP: Logged
alfrin
Uber Geek
Member # 3836

Member Rated:
4
Icon 1 posted November 26, 2005 23:41      Profile for alfrin     Send New Private Message       Edit/Delete Post   Reply With Quote 
quote:
Originally posted by dragonman97:
Oy...back in my day, we didn't have bash scripts - we had assembly, and we liked it! Why, me older mate Jimmy 'ad to program in binary...using nails wrapped in 'lectrical tape, and he was glad!

Fags.
I've got a group of about twenty guys who:
1. Type my documents
2. Prints Them
3. Plays my music, switches cds/songs
4. Entertain me witih random flash worthy anticts

You guys are just too high tech

--------------------
Art is Resistance / Resistance is Art

Posts: 813 | From: Nevada, USA | Registered: Apr 2005  |  IP: Logged


All times are Eastern Time  
Post New Topic  New Poll  Post A Reply Close Topic    Move Topic    Delete Topic next oldest topic   next newest topic
 - Printer-friendly view of this topic
Hop To:

Contact Us | Geek Culture Home Page

© 2015 Geek Culture

Powered by Infopop Corporation
UBB.classicTM 6.4.0



homeGeek CultureWebstoreeCards!Forums!Joy of Tech!AY2K!webcam