Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

ScramWords -- a word game

edited March 2013 in Examples Posts: 1,255

It's about 90% cooked, and I'm hoping to post to the app store soon, so I wanted to show it off here. The video might be painfully slow paced, but that's not the game's fault. That's just how long it takes me to spot a word.

The idea is to combine combine the speed limits of games like Boggle, with the board & tiles structures of games like Scrabble or Words with Friends. On each board, there is a starting position, marked by a dot circled by the word START. Also on the board are one or more spots circled by "NEXT LEVEL." To progress in the game, build a bridge of words from start to a level up spot. if you are quick enough, you can rack up points by playing words anywhere on the board. You're also free to dump your entire tray of candy-shaped letters any time you're stuck.

Each board has a different layout. Time gets shorter. The challenge gets tougher.

Still working on some of the effects and nailing down board design and other details, but it's basically all there.

The word test comes from a roughly 60k word dictionary compiled from public sources, filtered for duplicates and formatted for easy use. To fit the dictionary into Codea, I created one massive string per letter, put each one in it's own file, and added a very, VERY simple interface. For example:

function checkStringX(w)
    return string.find(
    , ","..w..",")

I'm happy to share the dictionary files if anyone else is building a word game.



  • I like the game concept. Great job.

  • Posts: 384

    Very cool, @Mark! Do the words submit as soon as they match, or do you trigger that manually? I was wondering if you tried to spell a long word which had a short word as its beginning...

  • Posts: 1,255

    You tap the Word! text to submit a word. I did have it going off automatically, but ran into exactly the issue you describe.

  • Posts: 1,255

    Pulled up this long forgotten project yesterday, cleaned up the code, worked out a couple of issues, drew icons, created a help screen, and went through the hundred an one steps to push it through XCode to the App Store.

    Just waiting now for Apple's review process.

  • IgnatzIgnatz Mod
    Posts: 5,396

    @Mark recently I had a go at squeezing over 100,000 words into Codea, and managed to compress them from about 860kb down to 270kb, which is pretty close to zip performance, through two simple compression techniques. On running the program, Codea extracted them back into a hash table of all the words.

    I'm happy to share if you're interested (I also posted all my words via this forum, a week or two ago).

  • Posts: 1,255

    I'd love to look at it. The 1.0 version went to the store with about 70k words. I did the simplest thing possible (as seen above) — crammed everything into a massive string and just did a string.find. Works essentially instantly, and it's easy to tack on more words.

    But I can already see a couple of things I'd like to add, and a bigger dictionary would be a nice upgrade.

  • IgnatzIgnatz Mod
    Posts: 5,396

    my word list is here


    I'll send you my compression approach by PM

  • dave1707dave1707 Mod
    edited March 2013 Posts: 9,808

    I pulled a word list off the Internet and encoded it in a 1025x1025 .png image file containing
    300,249 words that I have in my Documents folder. Below is the number of words, by characters per word. Not sure if an image file would be better or worse than a string. I decode the .png file and create a table of words. See this post for info.

    EDIT: Here is another post.

    char # words 1     26 2     213 3     1511 4     5840 5     16153 6     21981 7     31221 8     38895 9     41596 10    39425 11    32745 12    25346 13    18134 14    11808 15    7133 16    4019 17    2185 18    1032 19    534 20    264 21    106 22    51 23    21 24    7 25    1 26    0 27    1
  • IgnatzIgnatz Mod
    Posts: 5,396

    If you're encoding in a lossless image and the pixels are essentially random, then the result isn't going to be compressed much more than a plain string - unless of course you applied compression first.

  • dave1707dave1707 Mod
    Posts: 9,808

    It's not really compressed. A 1025x1025 png file at 3 characters per pixel can hold 3,151,875 bytes. That's a little more than the size of the word list I was using. A 1025x1025 png image was easier to use than a 3mb file on my iPad.

  • IgnatzIgnatz Mod
    Posts: 5,396

    What I'm offering is the ability to compress that by about 2/3, if you are interested.

  • Posts: 2,161

    @Ignatz What is the benefit of compression here? Does it speed up the initial read of the dictionary (which would mean that decompression worked faster than the overhead of reading the larger file)? Once it is in memory, is there any difference between a compressed source and an uncompressed one? Or are you storing it still compressed in memory (which sounds like it would then need to be decompressed for every lookup so I consider that unlikely)?

    Way back when (possibly when Mark started this project) we had a discussion as to the best way to store the dictionary in memory for fast lookup. I don't remember the precise details. I think - Mark can correct me - that table lookup was faster but not by enough to persuade Mark to switch! (For table lookup, the words are the keys of a big table - actually, I think I had 26 dictionaries - and the spellcheck tests to see if the key exists in the key index of that table.)

    Just checked. I didn't have 26 dictionaries. I split my dictionary into 23 according to word length (so that I could decide only to load words up to some length) and to keep the file length not too big. I had 76,876 words in my English dictionary and 622,115 in my Norwegian one. I think I pulled the English one from the dictionary bundled with aspell and the Norwegian one is from some official/reputable (I don't remember which) source which releases its word list as a GPL file (finally someone gets it right!).

  • IgnatzIgnatz Mod
    Posts: 5,396

    I compressed my word file so I could bundle it in the Codea code rather than having it separate.

    And because I find compression a fun game :)

  • Posts: 1,255

    @Andrew Yep, a 70k dictionary returned values almost 40x faster from table lookup as opposed to my generic string match. But it spent over thirty seconds (on my ipad2) populating the tables. And since the return time on a string match was less than a tenth of a second, and I only need to do one lookup at a time, the easiest thing to do from a perspective of making it fast for the users was just leave it in strings.

    The total size of the current dictionary comes out less than 450k bytes. Codea allows me to shove the whole thing into a string without complaining. So honestly compression isn't a major concern at this point.

    But I'm interested in packing a bigger dictionary, so long as it doesn't add a long prep time.

    I'm intrigued by the image idea. I've used the same kind of scheme (ChipBots originally had an option to save your whole bot design to a little postage stamp sized image) but I don't quite see how you'd quickly unpack the dictionary or scan the image for a random scheme.

  • dave1707dave1707 Mod
    Posts: 9,808

    It takes 17 seconds to read the 1025x1025 image and create a table of words. So a 70k file should create an image of 153x153 and shouldn't take more than a few seconds.

  • Posts: 1,255

    Due to a conflict of names, the app has been changed to ScramWords. Version 1.0 is waiting for approval, but this little movie shows some cosmetic and gameplay changes made for 1.1.

    This version will go up with a slightly expanded (75k words) dictionary. The next round will have a word list revised to over 100k words, more closely matching the lists used in the most popular word games.

  • Posts: 1,255

    ScramWords is now available in the App Store. Huzzah.

  • Posts: 176

    Interesting game. I found the time seems to go by too quickly, and I am a fairly fast Scrabble player. Also, it is hard to drop the letters in the right place sometimes, at least on an iPad Mini. Too many words I am used to playing are not in the dictionary, so that makes it a little tough at first, too. I am enjoying it, however!

  • Posts: 1,255

    Thanks, @jlslate. I've already pushed up a 1.1 update that includes bug fixes, graphics updates, and about 5k more words, but my goal for 1.2 is to get the Scrabble/Words with Friends dictionary covered.

    Sorry about the difficulty of locating spots on the mini. I hate to hear that as I was hoping to go universal with this app in an upcoming version. Any suggestions on how to make placement easier?

  • Posts: 903

    .@Mark - good job! I too found the timer a bit short. Also locating the spots on an iPad 3 seems to be out by about half a circle.

    Suggestions for improvements for starters - just my thoughts
    1) as well as dragging the letters to the destination could you tap it in the tray to highlight it then tap the destination circle. I would find this to be a quicker way of adding words.
    2) highlight the current destination tile as well as the tile itself
    3) add a shuffle rack button
    4) you could add a bonus system for longer words. For example, words of 6 letters or more add x seconds to the timer, or freezes the timer for x seconds. The longer the word the larger the bonus.
    5) add a high score table. I think the only place you see it is on the game over screen.
    6) the text for your score at game over says "best ever" regardless of what it is - change to "final score"?
    7) letters which create two words, you only get the score for one of the words

  • edited April 2013 Posts: 1,255

    Thanks, @West.

    On the timer issue: the "standard" version of the game (which is standard in that it uses a fixed tile set equal to that used in an English Scrabble set minus the wild cards) provides "bonus" time for words played, with time dependent on score. I'm thinking maybe this time needs to be increased by a factor of 2 or 3, so the pressure to play something remains, but the reward for a good word is increased. That might address both the timing issue and your #4. What do you think?

    Highlighting the spot you're currently over on the board is a great idea. A definite for 1.2 (1.1 has already been pushed up for review).

    In 1.1 the high scores are shown on the menu screen, and the bug that screws up the "best ever" value in 1.0 is fixed. I'm thinking that down the road I'd like to return a lot of statistics: how many words did you play in the game? What was your longest word? What word scored the most? etc. And I'd like to get integration with Game Center worked in Real Soon Now.

    7) surprises me. You should be getting credit for both. Time for me to dig out another bug!

  • Posts: 903

    .@Mark, sounds like a good solution for the rewards. On second look I do see the increase but a boost to this would be better

    Top score is 266 so far :-/

  • edited April 2013 Posts: 903

    I found a bug:

    _ _ _ B O G

    _ _ _ U _ _

    _ _ _ T W _

    R I O T E D

    _ _ _ _ A _

    _ _ _ _ K _

    When I added "weak" the word was accepted, even though TW is not a word (I assume!)

    Also, as an observation, you sometimes need to click go twice when two words are formed.

    Really like the game though - keep up the good work

  • Posts: 1,255

    @West Well... darn. It should have caught that.

    When tiles are played, the program goes through a routine of running up-down / left-right from open space to open space. So it should have assembled TW, RIOTED, and WEAK out of that play and tested them all for validity before moving forward.

    So clearly you're on to something (something I didn't catch before pushing 1.1). It'll get hammered in 1.2.

    Thanks so much for your feedback!

  • Posts: 903

    No probs. If it helps the order I played the words was: riot, rioted, butt, bog, weak

    I don't know how you are storing the words, but maybe logging riot and rioted might have affected things?

  • Posts: 1,255

    What it does is actually look at each new letter that's been played and build out the word list from there, so the TW should have been picked up when you played "weak." I think I've found the problem -- the "down words" check was overriding the "right words" check.

    In reworking this, I think I've found a way to improve the efficiency.

  • Posts: 2,820

    @Mark - How did you integrate a dictionary into the app? Did you do it through the runtime, or did you convert a list of words into an array?

  • Posts: 1,255

    @Zoyt I did it in the most sloppy, lazy way you can imagine.

    I took a 70K dictionary, read it in, then wrote it out as a series of strings -- one for each letter of the alphabet. Each string I stuffed into a tab inside Codea. In 1.4, I could edit the strings directly, but 1.5 seems to have problems with these large strings so most of the text is invisible. As a result, I paste them (into notepad or another text editor) whenever I need to add words or make adjustments, then paste them back. It still seems to work fine, though I can't see the text.

    At the bottom of the first message in this thread, you'll see an example of what it looks like. Several people have proposed neater solutions, and I may go to one before the next big update.

  • Posts: 1,255

    Version 1.1 up

    Bug fixes, improved graphics, better high score handling, little improvements on touch, new menu options... Kind of where it should have been at 1.0

  • Posts: 176

    Well, it is a well known strategy to never buy / install a .0 version. ;)

  • Posts: 903

    Update looks good, though only played a few times so far. Another small bug - if you are in the red timer zone and you get the alarm zone, then get a word which takes the timer back out of the zone, the alarm still persists.

  • Posts: 1,255

    Thanks, @West. Another thing to fix for 1.2.

    Have an all new 180k word dictionary loading in less than 6 seconds, so all those folks who have been frustrated with my ugly old string find, and players who have been frustrated that thy couldn't find a missing word, should both breath easier.

  • Posts: 1,255

    Submitted version 1.2 today. Includes a new 180k dictionary — compressed, as several people suggestedinto an image. Loads up in less than 5 seconds on an ipad2.

    New interface, new icon, new... lots of stuff.

    But the big deal for me is that it's now a universal app. I got there in the most unimaginative way possible. First I wrote a series of graphic primitives that mapped in relative screen positions rather than absolute coordinates, but passing my old code through this didn't give a satisfactory result. The different screen ratios let to odd positioning.

    So instead I just intercepted all the HEIGHT and WIDTH calls and made routines to scale fonts and sprites. As a game that wasn't originally aimed at the iPhone, I had a problem with some elements being too small, but I made adjustments were possible. By the way, if you set up a 320x480 screen on your iPad, it's very close to the actual size of an iPhone 4 screen. Certainly close enough to test the visibility of elements.

    In any case, this finally feels like the game it should have been on day one.

  • Posts: 1,255

    ScramWords 1.2 not ready for sale as a universal app. Just tried it on my iPhone. It is a bit of an eye test, but it works dandy.

  • Posts: 903

    Liking the fresher look and highlighting the target circle is good though I would still prefer that the target was the circle under my finger rather than up and left.

    Also the option of tap to select from the tray and tap to drop into the destination circle would be appreciated ;-)

  • Posts: 1,255

    The problem I had when moving the circle directly under the finger was simply not being able to see -- especially on the iPhone version. But I think I can move the selection point offset about 1/2 back to center on the iPad and get a more satisfying feel.

    Let me work on the tap-tap implementation. It should be do able.

    Hey, I'm just glad to see that at least one person is still playing!

    It will be interesting to see the update stats tomorrow. Last time, it seemed like about 80% of the original purchasers updated. I'm assuming the other 20% deleted the app.

  • Posts: 903

    Fair enough for the iPhone but I guess it's just personal preference. I equate dropping the letter the same as pressing a key on the onscreen keyboard - sure I need to locate it but once my finger is over the right button I no longer need that visual confirmation. I already know the destination where I want the letter to go before picking it up and dragging it - I don't select a letter then hover about wondering where it should go. :-). Maybe have a settings switch which allows the user to choose?

    ScramWords plus Crabitron have seriously dented my productivity on Codea!

  • Posts: 1,255

    Thanks, @West. That's good company to be in.

  • Posts: 41

    Nice game, Mark! Really impressive.

    I love the tap-tap suggestion for placing letters. One extra idea on top of that one -- instead of tapping the letter in the tray first, and then the location, have the player tap the location first and then the letter. Combine that with the following: once the player has placed two letters, start auto-highlighting the next location. (In fact, even after the first letter is placed, take a guess as to the location of the next letter, of either one to the right, or one below.) Then, if the auto-highlight is the next location they wanted, the player can just tap the letter tile. In other words, to place a five-letter word, they'd tap the location for the first letter, then the first letter itself, and then if the auto-highlight guesses the right direction, they could just tap the second through fifth letters without having to tap the board again. If it happened that the auto-highlight wasn't where they wanted it, then they'd first tap the board (to move the highlight) and then tap the letter.

    You could make the auto-highlight really smart, and skip over existing letters to highlight the next open spot in that direction.

    One other request: at the start of the game, maybe a sound effect that lets you know the timer has begun. And it would be helpful if the "next level" tiles glowed for a moment, just to help you see where they are. (Even better, for me, would be to have a few free seconds to study the board -- perhaps the board appears, the "next level" tiles glow, and you get a couple of seconds to look around, and then the letters appear on the tray and the timer starts.)

    Okay, gonna go play some more... :)

  • Posts: 1,255

    Ahh. I like that idea, @goatherd.

    Yeah, I hate it when I have a letter under my finger and am dragging it carefully into place when the time runs out. The suggestions that you and @west bring to the table would probably cut down on user frustration. I know they'd help mine.

    And I like the idea of a countdown to the start of play. Definitely there for 1.3.

    Out in one of the reviews of the game, I took a lot of heat over design elements, which was a bit disappointing as I spent a lot of time nipping and tucking for this version. But expect the UI for the next version to be pared back, with less color and more of a paper feel.

  • Posts: 903

    @Mark I'm working on a word game and would love to have access to your dictionary/lookup approach if the offer is still there. Also, any plans to update ScramWords?

  • Posts: 1,255

    @West Yup, a ScramWords update with several interface improvements is coming.

    I'll have to locate the dictionary image, but once I do I'll stick it up along with the dictionary code.

  • Posts: 903

    @Mark - cheers. In the meantime I managed to implement a solution similar to the one you describe above. A major pain in the neck dealing with the code line bug but got there in the end after a few false starts

Sign In or Register to comment.