Skip to content

Commit

Permalink
Merge pull request espruino#1795 from nemesisridiculii/master
Browse files Browse the repository at this point in the history
[Bordle] Fix bug in valid word detection
  • Loading branch information
gfwilliams committed May 9, 2022
2 parents 09fe490 + 5152e68 commit b8b69cc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions apps/bordle/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
0.01: New App
0.02: app keeps track of statistics now
0.03: Fix bug in valid word detection
7 changes: 6 additions & 1 deletion apps/bordle/bordle.app.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,12 @@ class Wordle {
}
}
addGuess(w) {
if ((this.words.indexOf(w.toLowerCase())%5)!=0) {
let idx = -1;
do{
idx = this.words.indexOf(w.toLowerCase(), idx+1);
}
while(idx !== -1 && idx%5 !== 0);
if(idx%5 !== 0) {
E.showAlert(w+"\nis not a word", "Invalid word").then(function() {
layout = getKeyLayout("");
wordle.render(true);
Expand Down
2 changes: 1 addition & 1 deletion apps/bordle/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Bordle",
"shortName":"Bordle",
"icon": "app.png",
"version":"0.02",
"version":"0.03",
"description": "Bangle version of a popular word search game",
"supports" : ["BANGLEJS2"],
"readme": "README.md",
Expand Down

0 comments on commit b8b69cc

Please sign in to comment.