Wordle In A Day

Typing in a Guess


This procedure returns the one dimensional list of Labels in the current guess.


This is a generic any Button Click event, intended to service my keyboard.
I have separate button Click Events for my Enter and Delete keys, so I added a test for
if notAlreadyHandled and a check that this button is in my keyboard buttons list.

When a letter button is pressed, its letter should appear in the first blank Label in the current Guess row. That requires a bit of searching and a local variable firstBlankLabel to keep track of our search result. We start at the end of the label row and work our way backwards, remembering each blank label we encounter. At the end of the loop, firstBlankLabel has our best guess where to drop the letter value, which we get from the Button.Text value.


The Delete button has similar logic, searching for the last nonblank Label in the current guess and clearing it. Here we scan from right to left. If they are all blank, we clear the first Label for simplicity.

2 Likes

Good job !!
I crested an app inspired to Wordle with Kodular:

The ENTER Button, finally


To help in the checking, we need a downcased version of the current guess to check against the word list. This game's rules require that each guess be a word, not just a cheat like aeiou. In this procedure, I pay the price for not having upshifted the word list when I loaded it. I downcase the guess before comparing it against the list of words.


(To read these blocks, right click on them and Open Image in New Tab. Then click on (+) to zoom in on them.)

If the guess is not in the word list, Notify them without penalty.

A local variable correctCount (initially 0) helps keep track of how many correct letters are in place, for deciding if the player made a winning guess.

It is time to loop through the letters of the guess, by index n. We need the index to help us match corresponding positions in the the word of the day and in the current guess.

We extract the current guess letter at index n.

We also keep a local color variable, to hold the current letter match result color, initially mismatch grey.

Again, I pay the price for not having made my word list the same case as my keyboard letters. The Labels are Upper Case and my word is lower case, so I downshift the current guess letter.

Time to compare the guess letter against the corresponding position in the word of the day, using the text segment block and the text compare block.

If we got a match, pick green for a good match and save it for later, and increment our match counter.
Otherwise, we have to check if the chosen letter appears elsewhere in the word of the day.
We use a text contains test, and if it is found, we set our color to yellow.

At this point, we have our color variable ready to drop into the Background Color of our Label and the keyboard Button for this letter. The Label is at index n, and we have to go through the dictionary we loaded at setup time to get to the keyboard Button for that letter.

At the end of the loop, we check our match count.
If all 5 match, we call procedure win to announce our win.
Otherwise, we check if have more guesses available, and increment the guess index.
If we reached our guess limit, call procedure lose to rub it in.


As a reward for following this far, here is the source code:
wordull.aia (30.6 KB)

Feel free to add whatever enhancements you like to it.

3 Likes

Your app has more features than mine, and is more polished.
Welcome to the Wordle clone club!

2 Likes

Your guide is very simple to understand.
You are a great teacher :+1::+1:

Great stuff ABG.

To add to the mix herewith the game layout generated with a dynamic component (CompCreator)
No logic applied. I called this one "Wuddle".

SCREEN

BLOCKS

AIA

Wuddle.aia (16.7 KB)

3 Likes

The end result looks nice, but it feels more like code than visual design.
Do all those text boxes for attribute and component types need to be hand typed, or does the extension supply them?

I have updated this extension.
Use the CreateFrom with a template, no need to hand type the attribute and component type.

2 Likes

Yes, all hand typed. If you have an actual component you can use its blocks to create, and then you can use the anycomponent blocks for property setting.

I actually have an error (of omission) in the blocks, will update when the AI2 server comes online...

[edit - blocks and aia now updated]

With ref to my effort, now done the logic. I didn't look at @ABG 's blocks on purpose. Ended up with a couple of small procedures and one very big anyButton.Click event, which handled clicks for the letter buttons (Q,W,E etc.), the ENTER button, and the back button ( <x]). The tricky part for me was the colouring selection of the grid and the keypad, especially for duplicate letters (either in the word, or in the guessing word), but hopefully solved it. Think I have ironed out all the bugs. This is now installed on my wife and son's phones, and a quiet has descended on the house :slight_smile:

Player can start a new game at anytime, and the app will show the word if not guessed. If there is a double/duplicate letter in the word to be guessed, Wuddle will only show that one is present, you have to figure that part out :wink:

Thanks @ABG for the idea :slight_smile: - kept me quiet for a day as well ....

SCREEN

AIA

WuddleFinal.aia (65.1 KB)

APK

for those that won't need an aia or blocks to see the logic....
Wuddle

5 Likes

Brilliant and very educational. I am adapting Your app in French. Should someone be interested in a word file in french, along with notifications and keyboard in french, please ask me.

1 Like

@ABG try this

Octordle
:red_square::red_square: THING - DECAL
:clock12::red_square: SCALY - WHISK
:red_square::clock11: HENCE - SPILT
:red_square::three: SIXTY - PETAL

:white_large_square::white_large_square::green_square::white_large_square::white_large_square: :white_large_square::white_large_square::white_large_square::white_large_square::yellow_square:
:white_large_square::white_large_square::white_large_square::white_large_square::white_large_square: :white_large_square::green_square::yellow_square::white_large_square::green_square:
:white_large_square::white_large_square::yellow_square::white_large_square::white_large_square: :white_large_square::green_square::white_large_square::green_square::green_square:
:white_large_square::white_large_square::white_large_square::white_large_square::white_large_square: :white_large_square::green_square::white_large_square::green_square::green_square:
:white_large_square::white_large_square::white_large_square::white_large_square::white_large_square: :white_large_square::yellow_square::yellow_square::yellow_square::white_large_square:
:white_large_square::white_large_square::white_large_square::white_large_square::white_large_square: :white_large_square::yellow_square::yellow_square::yellow_square::yellow_square:
:white_large_square::white_large_square::white_large_square::white_large_square::white_large_square: :white_large_square::yellow_square::yellow_square::yellow_square::white_large_square:
:white_large_square::white_large_square::white_large_square::yellow_square::white_large_square: :white_large_square::white_large_square::white_large_square::white_large_square::green_square:
:white_large_square::white_large_square::green_square::white_large_square::white_large_square: :white_large_square::white_large_square::white_large_square::white_large_square::green_square:
:white_large_square::white_large_square::green_square::white_large_square::white_large_square: :white_large_square::white_large_square::white_large_square::yellow_square::yellow_square:
:white_large_square::white_large_square::green_square::white_large_square::yellow_square: :white_large_square::white_large_square::white_large_square::yellow_square::white_large_square:
:white_large_square::white_large_square::white_large_square::white_large_square::white_large_square: :white_large_square::yellow_square::yellow_square::yellow_square::white_large_square:
:white_large_square::white_large_square::yellow_square::white_large_square::white_large_square: :white_large_square::green_square::white_large_square::green_square::green_square:

:white_large_square::white_large_square::white_large_square::white_large_square::white_large_square: :white_large_square::white_large_square::green_square::white_large_square::white_large_square:
:white_large_square::white_large_square::green_square::white_large_square::yellow_square: :white_large_square::white_large_square::white_large_square::white_large_square::white_large_square:
:white_large_square::white_large_square::white_large_square::yellow_square::yellow_square: :white_large_square::white_large_square::white_large_square::white_large_square::white_large_square:
:green_square::white_large_square::white_large_square::yellow_square::yellow_square: :yellow_square::white_large_square::white_large_square::white_large_square::white_large_square:
:green_square::yellow_square::yellow_square::white_large_square::white_large_square: :yellow_square::white_large_square::white_large_square::white_large_square::white_large_square:
:green_square::green_square::green_square::green_square::white_large_square: :yellow_square::white_large_square::white_large_square::white_large_square::white_large_square:
:green_square::green_square::green_square::green_square::white_large_square: :yellow_square::white_large_square::white_large_square::white_large_square::white_large_square:
:green_square::white_large_square::white_large_square::white_large_square::yellow_square: :yellow_square::white_large_square::white_large_square::yellow_square::white_large_square:
:green_square::white_large_square::white_large_square::green_square::white_large_square: :yellow_square::white_large_square::green_square::white_large_square::white_large_square:
:green_square::white_large_square::white_large_square::green_square::white_large_square: :yellow_square::white_large_square::green_square::white_large_square::white_large_square:
:green_square::white_large_square::white_large_square::green_square::white_large_square: :yellow_square::white_large_square::green_square::white_large_square::white_large_square:
:green_square::green_square::green_square::green_square::green_square: :yellow_square::white_large_square::white_large_square::white_large_square::white_large_square:
:black_large_square::black_large_square::black_large_square::black_large_square::black_large_square: :white_large_square::white_large_square::white_large_square::white_large_square::white_large_square:

:white_large_square::white_large_square::white_large_square::white_large_square::green_square: :yellow_square::white_large_square::green_square::white_large_square::white_large_square:
:white_large_square::green_square::white_large_square::white_large_square::white_large_square: :yellow_square::white_large_square::white_large_square::white_large_square::yellow_square:
:white_large_square::green_square::white_large_square::white_large_square::white_large_square: :yellow_square::white_large_square::yellow_square::white_large_square::yellow_square:
:white_large_square::green_square::white_large_square::white_large_square::white_large_square: :green_square::white_large_square::white_large_square::white_large_square::yellow_square:
:white_large_square::white_large_square::white_large_square::yellow_square::white_large_square: :green_square::white_large_square::yellow_square::white_large_square::white_large_square:
:white_large_square::yellow_square::white_large_square::white_large_square::green_square: :green_square::white_large_square::white_large_square::green_square::white_large_square:
:white_large_square::yellow_square::white_large_square::white_large_square::white_large_square: :green_square::white_large_square::white_large_square::green_square::yellow_square:
:white_large_square::white_large_square::white_large_square::white_large_square::white_large_square: :green_square::green_square::white_large_square::yellow_square::yellow_square:
:white_large_square::white_large_square::white_large_square::white_large_square::white_large_square: :green_square::green_square::green_square::green_square::white_large_square:
:white_large_square::white_large_square::white_large_square::white_large_square::green_square: :green_square::green_square::green_square::green_square::white_large_square:
:white_large_square::white_large_square::white_large_square::white_large_square::white_large_square: :green_square::green_square::green_square::green_square::green_square:
:white_large_square::yellow_square::white_large_square::white_large_square::white_large_square: :black_large_square::black_large_square::black_large_square::black_large_square::black_large_square:
:white_large_square::green_square::white_large_square::white_large_square::white_large_square: :black_large_square::black_large_square::black_large_square::black_large_square::black_large_square:

:white_large_square::white_large_square::yellow_square::white_large_square::white_large_square: :green_square::white_large_square::white_large_square::white_large_square::yellow_square:
:white_large_square::white_large_square::white_large_square::white_large_square::white_large_square: :green_square::green_square::yellow_square::white_large_square::green_square:
:white_large_square::white_large_square::yellow_square::white_large_square::white_large_square: :green_square::green_square::green_square::green_square::green_square:
:green_square::white_large_square::white_large_square::white_large_square::white_large_square: :black_large_square::black_large_square::black_large_square::black_large_square::black_large_square:
:green_square::white_large_square::white_large_square::white_large_square::white_large_square: :black_large_square::black_large_square::black_large_square::black_large_square::black_large_square:
:green_square::white_large_square::white_large_square::white_large_square::white_large_square: :black_large_square::black_large_square::black_large_square::black_large_square::black_large_square:
:green_square::white_large_square::white_large_square::white_large_square::white_large_square: :black_large_square::black_large_square::black_large_square::black_large_square::black_large_square:
:green_square::white_large_square::white_large_square::yellow_square::white_large_square: :black_large_square::black_large_square::black_large_square::black_large_square::black_large_square:
:green_square::white_large_square::yellow_square::white_large_square::white_large_square: :black_large_square::black_large_square::black_large_square::black_large_square::black_large_square:
:green_square::white_large_square::yellow_square::white_large_square::white_large_square: :black_large_square::black_large_square::black_large_square::black_large_square::black_large_square:
:green_square::white_large_square::yellow_square::white_large_square::yellow_square: :black_large_square::black_large_square::black_large_square::black_large_square::black_large_square:
:green_square::white_large_square::white_large_square::white_large_square::green_square: :black_large_square::black_large_square::black_large_square::black_large_square::black_large_square:
:white_large_square::white_large_square::yellow_square::white_large_square::white_large_square: :black_large_square::black_large_square::black_large_square::black_large_square::black_large_square:

2 Likes

@ABG Hello,

I haven't used App Inventor in a while. I'm following your tutorial here and I'm loving it. My problem (sorry I'm not very smart) is I can't find the when do control button in my controls. Is there anyway you can direct me in where to find it. also when initializing the screen I can't find the filWords to call. What am I missing? Sorry I'm not very smart. Rick

Actually it is File component renamed to fillWords

@dora_paz Sorry to be a pest. Maybe i'm too stupid to try this tutorial. How do I put my file in the screen 2. It's in my media uploads.

No need to put in Screen 2, it was just an example to show you that you have to use File component :slight_smile:

@dora_paz Thank you. I got it. You're Awsome.

2 Likes

Hopefully this will be my last post here about this. Sorry for being a pest. I finished the entire project and when I used the emulator I got an error "Undefined variable. irritants: (yail/yail-dictionary)"

Does anyone know what this means? Is it fixable or did I do something wrong and wasted all my time?

Thanks,

Rick

Sounds like you are using IOS companion. Not all the list and none of the dictionary blocks work in iOS companion. If these are used anywhere in your project, then you will get this error.

You can probably workaround this by creating procedures to replicate the missing blocks, or simply switch to using an android device.

thank you. I am using the IOS Companion. Thank you.