Skip to main content

Nonsense words and random boards

I quite like Soybomb’s nonsense word generator. It creates words that sound like they could be real words, but are usually made up words. They come in handy for more memorable nearly random character strings. I didn’t like having to load a website to get them though, and individually copy and paste them. So in about ten minutes, and about as many lines of code, I made this script to print out a selection of randomly generated words. BeautifulSoup and requests feel like such a wonderful swiss army knife of tools to have.

While visiting my mom for a few days, we played Boggle together. Whenever I play Boggle or put together puzzles, my mind veers off on tangents of how to implement an algorithm to do it for me. This time I realized I could bang out a board generator really easily. The random module comes with the useful shuffle and choice functions. So with a list of dice, all it took was shuffling them, then choosing a random face off of each one, then using fill from the textwrap module to shape the board.

In case you’re wondering — like I was — here are some stats about the dice in Boggle:

letter count percentage of total difference
e 11 11.458% -0.562
t 9 9.375% 0.275
o 7 7.292% -0.388
a 6 6.250% -1.870
i 6 6.250% -1.060
s 6 6.250% -0.030
n 6 6.250% -0.700
h 5 5.208% -0.712
r 5 5.208% -0.812
l 4 4.167% 0.187
u 3 3.125% 0.245
d 3 3.125% -1.195
w 3 3.125% 1.035
y 3 3.125% 1.015
m 2 2.083% -0.527
v 2 2.083% 0.973
g 2 2.083% 0.053
c 2 2.083% -0.627
p 2 2.083% 0.263
b 2 2.083% 0.593
f 2 2.083% -0.217
qu 1 1.042% 0.932
j 1 1.042% 0.942
z 1 1.042% 0.972
k 1 1.042% 0.352
x 1 1.042% 0.872

The difference is in percent, from the representation in Boggle to a 40,000 word sample statistical average.