Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Small simple nodejs based Boggle grid solver
After installing nodejs, run:
npm install -g boggle
// ignore any warnings
boggle "ABCD EFGH IJKL MNOP"
The spaces between letters are optional, it could be single string with 16 characters. In this case, you don't need quotes:
boggle ABCDEFGHIJKLMNOP
Case does not matter, characters will be converted to lowercase.
The algorithm iterates over the 2D grid, trying to walk depth first, including diagonally, but not visiting same cell more than once. At each step, the accumulated string is checked against the dictionary. Walking stops and the algorithm backtracks to previous depth level if the string is no longer a valid word or valid word prefix.
// src/boggle.js
var uniqueWords = {};
paths(lowerCased, {
stepWhile: function (str, x, y, grid) {
if (dictionary.isWord(str)) {
// found whole word, maybe there is more!
uniqueWords[str] = true;
return true;
}
if (dictionary.isWordPrefix(str)) {
// not a word, but possible
return true;
}
}
});
var words = Object.keys(uniqueWords);
words = utils.validWords(words);
To discover paths in the letter grid, I use matrix-paths. While walking through the matrix, I use boggle prefix-dictionary that uses a trie data structure. Trie is a binary search tree that stores words in addition to children links, making word or prefix matching very quick.
To unit and function test the module, execute command
npm test
This might require installing gt testing tool globally
npm install -g gt
To see code complexity (it is very low), run command
npm run-script complexity
This might require installing jsc tool globally
npm install -g jsc
FAQs
Boggle grid solver
The npm package boggle receives a total of 0 weekly downloads. As such, boggle popularity was classified as not popular.
We found that boggle demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.