Thread: Scrabble rack generator (not really)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Registered User
    Join Date
    May 2012
    Location
    Arizona, USA
    Posts
    956
    What about a 5-letter word? There's a 1 in 6 chance that it'll be untouched too.

    So there's a good chance that one of the words in these sentences will stay the same:

    Alice reads books. Bobby reads books.
    I'd also just let the shuffle do its job and let it produce untouched results some of the time.

    If you wanted to guarantee that a word will always be different than the original, you could put the shuffling in a loop, and if the word is 4 letters or longer and the shuffled version is the same as the original, repeat the loop. That way you don't have to handle 4-letter words specifically.

    Edit: I didn't consider cases where all of the inside letters are the same, as in "book" or "booooook". That would make the loop infinitely repeat. So you would need another test to see if all the letters are the same; if they are, just break out of the loop (or don't enter the loop in the first place).
    Last edited by christop; 07-21-2023 at 12:18 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. New 1/2 rack colo - signup question
    By ginoitalo in forum Tech Board
    Replies: 0
    Last Post: 02-12-2010, 09:49 AM
  2. scrabble counting
    By kees in forum C Programming
    Replies: 6
    Last Post: 10-03-2009, 09:43 AM
  3. Scrabble Solver
    By Coder87C in forum C++ Programming
    Replies: 3
    Last Post: 08-11-2005, 03:36 PM
  4. Scrabble AI
    By vex_helix in forum C Programming
    Replies: 9
    Last Post: 04-03-2004, 03:03 PM
  5. Player's input in Scrabble?
    By vex_helix in forum C Programming
    Replies: 5
    Last Post: 03-26-2004, 02:38 AM

Tags for this Thread