Okay, so I was trying to make a word-guessing game, kind of like that Semantle thing, you know?
First, I started by setting up a basic webpage using HTML. Just a simple page with an input box where you’d type your guess and a button to submit it.
Then, I jumped into JavaScript. I needed a way to handle the player’s guesses. So, I wrote a function that gets triggered when you hit that submit button. This function grabs what you typed in the input box.
Next up, I figured I needed a secret word, right? I just picked one for now and stored it in a variable. Later, I could make it choose a random word from a list or something, but for now, a single word was good enough.
Now, the tricky part. I had to compare the player’s guess to the secret word. In Semantle, it tells you how close you are, meaning-wise. I decided to keep it simple for now and just check if the guess is exactly the same as the secret word.
- If it’s a match, I made it show a message saying “You got it!”.
- If it’s not, it says “Nope, try again.”
I tested it out, typing in words, hitting submit. It was working! At least, the basic “exact match” part was. I’ll try to work on making it score how close it is, just like Semantle later.
So, I kept adding stuff. Like, I thought it would be cool to show a history of all the guesses. I added an unordered list (that’s what the
- tag is for) to the HTML and updated the JavaScript to add each guess to the list after it’s submitted.
Further development idea
I played around with it some more. Now you can see your past guesses, which is kind of neat. It’s still super basic, but it’s starting to feel like a game. Next steps for me are to add the scoring system, so it tells you how close you are to the secret word. Also need a bigger word list, and maybe some kind of hint system. I ended up creating a very simple game for now, but at least I have an idea of how to improve it.