wordle search
by John Doe
HTML
<html>
<head>
</head>
<body>
This is a "cheating" program for <a href="https://www.powerlanguage.co.uk/wordle/">Wordle:</a>. <br />
To start the game, always guess <code>BEANS</code> or <code>COINS</code>.*<br />
Then enter the result in the current masks below. The <i>fixed</i> input
refers to the last entered row: Black squares translate to periods (<code>.</code>),
green squares translate to lower case characters, yellow squares to upper case characters.
The black squares of <i>all</i> previously entered lines, should be entered into the
<i>excluded</i> field.
<table>
<tr><td>fixed</td><td><input type="text" id="fixed" value="ABa.."/></td></tr>
<tr><td>excluded</td><td><input type="text" id="excluded" value="qrs" /></td></tr>
<tr><td><input id="submit" type="button" value="submit" /></td><td></td></tr>
</table>
<div id="results">
</div>
<!-- precomputation of BEANS and COINs in following linkk. (enter the hardcodeed words string including quotes into the "input" field) https://tio.run/##tVI9b9swEN35Kw7qIBIJhAJpMgTw0AQZsrRDRoIoVJq2GUg84niG4l/vHmWhSeFMCTpJfHz3Pk7KB95hujoe@2GYkNYFVhBT3rM23YBTIHmWPETW7WVr1BuWnWCDBJPQ4S8cNzCEpCcDqxVcO7UhHMHjMATPEZMQxozEcI/7xIGUZ5q1hClasWpRn7ZBX5tbBUyHW1AAXijLhLaTje7c2ZnKE7WuzzmktfYChBcfMsNjWoeXByIk0YRMMbFuYgUhVLQR6gn13YiFf3kcR0z6xhilarymmeP5alg9RKbAheC2gQto2@4ZY9K22K@nZGUm/qP1zTgj3MY1aglAYSsBCstp21xCEa9lORSUXIovhU7GcxyCluuzzhJD9i3UbuzZ72Trtd9SZRK901s7xR3jnuHu4fuPJ/mI5@qtLb53tsfobERyNkQ5hgO79r/7srMYafGNcjowfcz21Vf@afG9//lYfeELiM3vuV@Qgv2pYZorFun4frB5YOZ/fiHH4x8 -->
</body>
</html>
JavaScript
function removeElement(x, arr){
var ind = arr.indexOf(x)
if(ind > -1){
arr.splice(ind, 1)
}
}
function includesAllOf(word, possibleChars){
}
function main(){
var fixed_inp = document.getElementById('fixed')
//var included_inp = document.getElementById('included')
var excluded_inp = document.getElementById('excluded')
var results = document.getElementById('results')
var fcw = fiveCharWords()
console.log('main')
function compute(){
results.innerHTML = ""
var excluded = excluded_inp.value
//var included = included_inp.value
var fixed = fixed_inp.value
var alphabet = 'abcdefghijklmnopqrstuvwxyz'.split('')
// remove excluded
excluded.split('').map(x => removeElement(x, alphabet))
var allowedChars = alphabet.join('')
console.log(alphabet.join(''))
// apply rules
var included = []
var regex = fixed.split('').map(function(x){
var allowedChar = Array.from(allowedChars)
if(x.match('[A-Z]') != null){
removeElement(x.toLowerCase(), allowedChar)
included.push(x.toLowerCase())
} else {
console.log('else', x)
if (x.match('[a-z]') != null){
return x
}
}
return '['+allowedChar.join('')+']'
}).join('')
console.log('included ' + included)
console.log(regex)
for(var i=0; i<fcw.length; i++){
var word = fcw[i]
if(word.match(regex)){
if(included.every(x => word.includes(x))){
results.innerHTML += word + "<br/>"
}
}
}
console.log('done')
}
document.getElementById('submit').onclick = compute
//included_inp.oninput = compute
//fixed_inp.oninput = compute
}
main()
function fiveCharWords(){
var...