Add medium word list.

This commit is contained in:
Quantum 2018-11-27 22:21:02 -05:00
parent 492f29d4a0
commit 04dbed2c11
6 changed files with 2063 additions and 7 deletions

View file

@ -3,7 +3,7 @@ const digits = '0123456789'
const symbols = '`~!@#$%^&*()_+-=,./<>?;:|' const symbols = '`~!@#$%^&*()_+-=,./<>?;:|'
function getWordList (name) { function getWordList (name) {
if (['small'].includes(name)) { if (['small', 'medium'].includes(name)) {
return words[name] return words[name]
} }
throw new Error(`Invalid word list: ${name}`) throw new Error(`Invalid word list: ${name}`)
@ -59,3 +59,7 @@ function computeBits (options) {
return wordBits * options.count + capsBits + symbolBits + digitBits return wordBits * options.count + capsBits + symbolBits + digitBits
} }
module.exports = {
getWordList, getWords, capitalize, generate, lengthBits, computeBits
}

View file

@ -57,7 +57,7 @@
<div class="col-sm-10"> <div class="col-sm-10">
<select id="word-list" class="form-control custom-select" name="list"> <select id="word-list" class="form-control custom-select" name="list">
<option value="small">2048 words (11 bits/word)</option> <option value="small">2048 words (11 bits/word)</option>
<option value="medium" disabled>4096 words (12 bits/word)</option> <option value="medium">4096 words (12 bits/word)</option>
<option value="large" disabled>8192 words (13 bits/word)</option> <option value="large" disabled>8192 words (13 bits/word)</option>
</select> </select>
</div> </div>

View file

@ -521,7 +521,6 @@ module.exports = [
'dreadful', 'dreadful',
'dream', 'dream',
'dress', 'dress',
'drew',
'drink', 'drink',
'drive', 'drive',
'drop', 'drop',
@ -696,7 +695,6 @@ module.exports = [
'flat', 'flat',
'fleet', 'fleet',
'flesh', 'flesh',
'flew',
'flight', 'flight',
'flood', 'flood',
'floor', 'floor',
@ -790,6 +788,7 @@ module.exports = [
'governor', 'governor',
'grace', 'grace',
'gracious', 'gracious',
'grade',
'grain', 'grain',
'grant', 'grant',
'grasp', 'grasp',
@ -801,7 +800,6 @@ module.exports = [
'great', 'great',
'greek', 'greek',
'green', 'green',
'grew',
'grey', 'grey',
'grief', 'grief',
'gross', 'gross',
@ -1091,6 +1089,7 @@ module.exports = [
'medium', 'medium',
'meet', 'meet',
'melancholy', 'melancholy',
'melt',
'member', 'member',
'memory', 'memory',
'mental', 'mental',
@ -1844,6 +1843,7 @@ module.exports = [
'thunder', 'thunder',
'thus', 'thus',
'tide', 'tide',
'tilde',
'till', 'till',
'time', 'time',
'tiny', 'tiny',

2050
src/words/4096.js Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,3 +1,4 @@
module.exports = { module.exports = {
small: require('./2048') small: require('./2048'),
medium: require('./4096'),
} }

View file

@ -2,10 +2,11 @@ const assert = require('assert').strict
const words = require('../src/words') const words = require('../src/words')
describe('Word List Tests', () => { describe('Word List Tests', () => {
const lists = ['small'] const lists = ['small', 'medium']
it('length', () => { it('length', () => {
assert.equal(words.small.length, 2048, 'small list size incorrect') assert.equal(words.small.length, 2048, 'small list size incorrect')
assert.equal(words.medium.length, 4096, 'medium list size incorrect')
}) })
lists.forEach(name => { lists.forEach(name => {