Skip to content

Commit

Permalink
fixed xordle-- converts pairs into unique words when necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuval Ben-Hayun authored and Yuval Ben-Hayun committed Nov 22, 2022
1 parent be49be1 commit 48c5849
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 11 additions & 0 deletions js/bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,13 @@ function runBot(guess, difficulty) {
let testing_sample = getTestAnswers(TEST_SIZE, []);
let final_scores = []

// let full_list = words.filter(a => a.length == word_length);

let iv = setInterval(function() {
clearGrids();

// guess = randomElementOf(full_list);

let points = wordleBot(guess, testing_sample[count], difficulty);
if (points > bot.guessesAllowed()) {
missed.push(testing_sample[count]);
Expand Down Expand Up @@ -429,6 +434,12 @@ function wordleBot(guess, answer, difficulty) {
attempts++;

let lists = getPotentialGuessesAndAnswers(difficulty);
// if (attempts < bot.guessesAllowed()) {
// guess = randomElementOf(lists.all);
// } else {
// guess = randomElementOf(lists.answers);
// }

final_guesses = getBestGuesses(lists.answers, lists.guesses, difficulty, lists.unique);
guess = final_guesses[0].word;
}
Expand Down
6 changes: 3 additions & 3 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -831,15 +831,15 @@ function getNextGuesses(new_guesses, answers, best, differences, difficulty) {
}

if (!bot.isFor(ANTI) && !isDifficulty(HARD)) {
list = combineLists(answers, new_guesses);
list = combineLists(uniqueWordsFrom(answers), new_guesses);
}

return list;
}

function countResults(best, answers, guesses, results, attempt, difficulty, differences) {
let new_guesses = combineLists(answers, guesses);
new_guesses = getNextGuesses(combineLists(guesses, uniqueWordsFrom(answers)), answers, best, differences, difficulty);
let new_guesses = combineLists(uniqueWordsFrom(answers), guesses);
new_guesses = getNextGuesses(new_guesses, answers, best, differences, difficulty);

if (answers.length <= 2 && (!bot.isFor(ANTI) || new_guesses.length == answers.length || !answers.length)) {
addToResults(results, answers, attempt, best.word, bot.guessesAllowed());
Expand Down

0 comments on commit 48c5849

Please sign in to comment.