Hello! Thank you very much for your useful video) This is the most short and understandable tutorial I've ever seen. I think, you made a mistake in revealWord function. Imagine that secret word is 'OFTEN' and you input the word 'OFFER'. You've guess the letter on second position, but you also see the yellow background behind the third letter. You will think, that secret word contains at least 2 letters 'F'. But it's not true. I've fix this issue in my game Blindle (it has the same goal to guess the word, but verdicts for each word you see after sixth turn). I think RU-vid will remove my comment if I place my GitHub repo link here. Thank you!
Thanks so much! I'm glad you enjoyed it. I actually noticed this problem while recording the video and I thought about the exact same scenario. But I decided to leave it out just because it was a very specific case and I thought it would perhaps confuse some viewers. Good job noticing it! The way I would fix this is - before checking which color to paint the letter, I would check the number of occurrences of the letter in both the secret word and the player's word. If the player's word has more occurrences, I would skip the color checking and paint the box gray immediately. Otherwise, I would proceed with the color checking. Hopefully this makes sense. EDIT: I updated my GitHub repo to fix this issue :)
Thank you for this, works great! Question: Is there a way to make this functional on mobile? Don't believe there's a way to type answers on phone as-is? Thanks again
When I put the javascript code it doesn't work what is the problem Knowing that I put them all in one file and not every language alone in a file as you did
That's a great question! You can have a local json file and load it in using the fetch function: const dictionary = await fetch('./pathToFile/dictionary.json');
Thanks for the video, I really liked everything, but I have a question. Is it possible to make this game in another language, if so, what would need to be changed?
@@user-sr8xw3vq7b Oh i thought you meant programming language 😃 Yeah, you would need to go through all the files (html and js) and change the text there.
Hello , thank you for your content amazing work , i added keybord but i couldn’t manage to change the alert at the and to a pop up with correct word or congratulation and try again / go home button !! Can u help me with that !! Thank you
I have a question. Is there anyway to add a detection if there's only one of the letter. Let's your word is AGENT and you guess SHEEP , it'll tell you the third E is right, but the fourth E is still in there.
Yes, great question! This is an edge case that I noticed when making the wordle clone, but I left it out of the video to avoid confusion and to keep things short. The way I handled this case is by checking the number of occurrences of each letter in your guess, as opposed to the secret. The second condition is that the current letter position is higher than the number of letter occurrences in the secret. So basically: if (occurrence(letter, guess) > occurrence(letter, secret) && (letterPosition > occurrence(secret)) ==> move on to next letter If this sounds confusing, check out my Github code (especially line 117 linked below) or ask if you have any follow up questions. github.com/DoubleDebug/wordle-speedrun/blob/cf2ad83530850b89abbfecf46ae84c157adce626/src/index.js#L117
@@DoubleDRU-vid another question. I've added something new to my code: document.getElementById("worl").innerHTML = 'Better luck next time! The word was .'; how do I add the secret word after "The word was"??
@@tsaintreal There's a few ways, but the most simple one is just appending it at the end of your text: document.getElementById("word").innerHTML = "Better luck next time! The word was " + state.secret;
Change the grid into a 4 x 4 grid and instead of 5 letter words, use 4 letter ones. You might have to go through the code and make sure everything works but that's pretty much it.
hey is there something wrong with my code? this is the javascript i have and it just shows 1 line and thats all const state = { grid: Array(6) .fill() .map(() => Array(5).fill(' ')), currentRow: 0, currentCol: 0, }; function updateGrid() { for (let i = 0; i < state.grid.length; i++) { for (let j = 0; j < state.grid[i].length j++) { const box = document.getElementById(`box${i}${j}`); box.textContent = state.grid[i][j]; } } } function drawBox(container, row, col, letter='') { const box = document.createElement('div'); box.className = 'box'; box.id = `box${row}${col}`; box.textContent = letter; container.appendChild(box); return box; } function drawGrid(container) { const grid = document.createElement('div') grid.className = 'grid'; for (let i = 0; i < 6; i++) { for (let j = 0; j < 5; j++) { drawBox(grid, i, j); } } container.appendChild(grid); } function startup() { const game = document.getElementById('game'); drawGrid(game); state.grid: Array(6) .fill() .map(() => Array(5).fill('a')); updateGrid(); } startup();
When you say "it just shows 1 line", what so you mean exactly? Also, are you using VS Code to check for syntax errors? It seems to me that there's a syntax error in your startup function (state.grid ... ).
@@TNB-k5b I don't know what's the error because I don't have the full context. If you want, you can upload your code to Github and send me a link to check it out.