Author Topic: most words beginning with required letter  (Read 4625 times)

TRex

  • Eulexic
  • ***
  • Posts: 2041
  • ~50 miles from Chicago, in the Corn (maize) Belt
    • View Profile
most words beginning with required letter
« on: September 25, 2019, 07:38:16 AM »
IIRC, there was a post (could not find it) which said the in most Chihuahua puzzles, the majority of the (common only?) words started with the required letter. I believe Alan confirmed this to be true. I was wondering if this were true with the letters A E I J K N O Q U V X Z (especially the vowels)?

Alan W

  • Administrator
  • Eulexic
  • *****
  • Posts: 4974
  • Melbourne, Australia
    • View Profile
    • Email
Re: most words beginning with required letter
« Reply #1 on: September 26, 2019, 12:25:00 PM »
I don't recall this being discussed previously, TRex.

I don't think it would be literally true that the majority of words started with the required letter. It's unusual for more than half the words to start with the same letter. But it could be that more words start with the required letter than with any other letter in the puzzle. But if that were true overall, it would surely depend on what that required letter is, as you suggest.

I'll see if I can come up with any statistics on it.
Alan Walker
Creator of Lexigame websites

TRex

  • Eulexic
  • ***
  • Posts: 2041
  • ~50 miles from Chicago, in the Corn (maize) Belt
    • View Profile
Re: most words beginning with required letter
« Reply #2 on: September 28, 2019, 04:30:02 AM »
Well, it wouldn't be the first time I'd imagined something!

Calilasseia

  • Cryptoverbalist
  • *
  • Posts: 525
  • Pass the dissection kit ...
    • View Profile
Re: most words beginning with required letter
« Reply #3 on: September 30, 2019, 11:49:55 AM »

With respect to most of the words solving a given puzzle to begin with the required letter ... I think this phenomenon is more likely to occur if the required letter is R, S or T (look in the dictionary and the section covering R, S and T is substantial), and may possibly occur when the required letter is L. Probably not as likely for letter choices other than this. Letters that strike me as being potentially a let down in this regard include M and P, which would probably need serendipitous combinations of other letters to appear to exhibit this feature. Some surprises might appear though, with letters such as D or W, in one or two puzzles with appropriate other letters.

To save Alan some headaches, here's some JavaScript that will do the job for a given puzzle, given approprpiate input parameters:

Code: [Select]
//For a given puzzle, this function takes as arguments the following:

//[1] wordList: array containing the strings for the words that comprise the puzzle solution;

//[2] requiredLetter: pretty self explanatory

//Returns an object telling you:

//[1] what the required letter was;
//[2] what letter is associated with the most abundant number of solutions;
//[3] how many solutions begin with that letter;
//[4] what percentage of the total solutions those solutions comprise


function CheckPuzzleStats(wordList, requiredLetter)
{
var wlSize = wordList.length; //find out how many words in total are in the solution list

var sortedList = {
a : [],
b: [],
c: [],
d: [],
e: [],
f : [],
g: [],
h: [],
i: [],
j: [],
k : [],
l: [],
m: [],
n: [],
o: [],
p : [],
q: [],
r: [],
s: [],
t: [],
u : [],
v: [],
w: [],
x: [],
y: [],
z: []
};

var resultObject = {
requiredLetter: requiredLetter,
mostAbundantLetter: "",
mostAbundantCount: 0,
mostAbundantPercentage: 0
};

var i = 0;
var thisWord = "";
var ch = "";
var maxCount = 0;
var maxChar = "";
var numEntries = 0;

for (i = 0; i<wlSize; i++)
{
thisWord = wordList[i].toLowerCase(); //Get current word
ch = thisWord.substring(0, 1); //Get first letter

sortedList[ch].push(thisWord) //Append the current word to the proper part of the alphabetically sorted list

numEntries = sortedList[ch].length; //Find out how many entries are in this part of the alpabetically sorted list

if (numEntries > maxCount) //Greater than currently known maximum count?
{
maxCount = numEntries; //Update maximum count if so
maxChar = ch; //And letter that this count is associated with

//End if
}

//End i loop
}

resultObject.mostAbundantLetter = maxChar;
resultObject.mostAbundantCount = maxCount;
resultObject.mostAbundantPercentage = (maxCount / wlSize) * 100;

return(resultObject);

//End function
}

//You then call this code using something like:

var data = CheckPuzzleStats(wordList, requiredLetter);
var CRLF = "\r\n";

var msg = "Required Letter : " + data.requiredLetter + CRLF;
msg += "Most Abundant Letter : " + data.mostAbundantLetter + CRLF;
msg += "Most Abundant Letter Entry Count : " + data.mostAbundantCount.toString() + CRLF;
msg += "Most Abundant Letter Percentage : " + data.mostAbundantPercentage.toString() + CRLF;

alert(msg);

//And you'll be given the stats you need for each puzzle. All you have to do is write a wrapper that gets your
//puzzle data into the arguments "wordList" and "requiredLetter" passed to the function in your JavaScript, and
//hey presto,  you're home and dry.


I've just tested that function with some specially constructed test data, and it works. :)
Remember: if the world's bees disappear, we become extinct with them ...

Alan W

  • Administrator
  • Eulexic
  • *****
  • Posts: 4974
  • Melbourne, Australia
    • View Profile
    • Email
Re: most words beginning with required letter
« Reply #4 on: September 30, 2019, 02:20:35 PM »
Thanks, Cal
Alan Walker
Creator of Lexigame websites