Browse Source

Use spellchecker Typo.js to determine if words are valid.

feature/save-game
Daniel Perelman 3 years ago
parent
commit
0855f7d0bc
4 changed files with 16 additions and 1 deletions
  1. +3
    -0
      .gitmodules
  2. +1
    -0
      Typo.js
  3. +1
    -0
      mastermind.html
  4. +11
    -1
      wordlist.js

+ 3
- 0
.gitmodules View File

@@ -0,0 +1,3 @@
[submodule "Typo.js"]
path = Typo.js
url = https://github.com/cfinke/Typo.js.git

+ 1
- 0
Typo.js

@@ -0,0 +1 @@
Subproject commit 566f9888239c1e26c709da76a2c4ba0e8ba9d1e1

+ 1
- 0
mastermind.html View File

@@ -3,6 +3,7 @@
<head>
<title>Anagram Mastermind (non-functional prototype)</title>
<link rel="stylesheet" type="text/css" href="main.css" />
<script type="text/javascript" src="typo/typo.js"></script>
<script src="./wordlist.js"></script>
<script src="./mastermind.js"></script>
<script >


+ 11
- 1
wordlist.js View File

@@ -1,4 +1,14 @@
var dictionary;

fetch('typo/dictionaries/en_US/en_US.aff')
.then(response => response.text())
.then(aff => fetch('typo/dictionaries/en_US/en_US.dic')
.then(response => response.text())
.then(dic => {
dictionary = new Typo('en_US', aff, dic);
}));

function isValidWord(str) {
return true;
return dictionary.check(str);
}


Loading…
Cancel
Save