Written by Tracy Poff in misc on Sun 16 May 2010. Tags: wordspy,
As of the most recent revision (r18:6453f11b96e6), WordsPy functions as a (bad)
game. The dictionary is hooked up, and it only lets you remove letters if they
form a word in the dictionary (That’s a rule. Games have rules. Ergo, game. Right?).
Other features:
- Selected letters are highlighted
- Backspace support
- Nonstop key-pressing action!
Next steps will be arranging it so the letter generator provides useful letters
rather than just random ones (probably just analyze the dictionary for letter
frequencies and use that), creating some kind of status display, and additional
nice things (score? list of words you made in that session? difficulty levels?
the possibilities are endless!)
Edit: and a screenshot for posterity.
Well, the bad news is that wordspy still does nothing other than scroll new
lines onto the screen. The good news is that it does it in a better way.
In order to deal with letters dropping (due to letters below them being removed)
at the same time as a new line was scrolling up, it was necessary to re-engineer
the whole thing. Now letters store their current location, and it’s modified
whenever necessary by the newlinescroll and drop actions. This does have some
other benefits, too. For example, it simplifies drawing the new line onto the
screen somewhat. Before, I was doing:
for col in range(10):
screen.blit(Game.letters[6][col].image, (64*col, 481))
Now, since I initialize the letters with their location, I can just do:
for letter in Game.letters[6]:
screen.blit(letter.image, letter.rect)
Which is rather more readable.
Lesson learned, though: don’t forget to empty the dirty rectangles list after
updating the screen. Once it grows to 64 items or so, it noticeably slows down
the game. I’m fairly sure it shouldn’t contain more than a dozen or so items
under normal usage, but I’ll have to remember to keep an eye on it.
Written by Tracy Poff in misc on Sat 15 May 2010. Tags: wordspy,
I found that I wanted to play Word Zap/Word Jolt/Bookworm/whatever word
construction game, but I didn’t seem to have one on hand, and the version of
Bookworm I found was far from
satisfying. So, I did what anyone would do: set out to make my own.
I’ve been wanting to learn to use pygame for a while, and this seemed like a
good opportunity. I’ve had my fair share of trouble so far, but I think I’m
beginning to get a handle on how to use it. It’s
here for now, though it’s not playable
yet—it only generates the letters and scrolls them onto the screen. Still, it’s
a start.