How to get specific items from a random list

Hi all !

I will love your help as I am trying to retrieve list items, but I cannot. What I’m looking to achieve:

I have a variable where I create a list of 6 items, each of them have 3 items: an index number, a color and a button.

When initializing the screen, I want to retrieve 4 random elements from this list and then change the color of 4 other buttons by the selected color, and change the text of a label by displaying the 4 indexes of each selected item.

I’m not sure if I’m clear in what I’m writing, but here are my blocks, maybe you can figure out what I want:

Thank you for your help !

Can you try saving it in tinydb then calling it again

So you want something like this ?

1 Like

I think that’s more or less what I’m trying to do yeah

I didn’t use index number in first list because I can find index later. I did it like this

Okay, I try this method and see if it works for what I want to do! Thank you !

Procedure is draggable :slight_smile:

So the color of the buttons works, however the text to display the indexes does not work, I only have


So that you understand exactly my goal, I want to make the MasterMind game, a game where there is a series of 4 colored pawns (chosen randomly from a list of 6 colors).
These 4 pawns are hidden for the player, and that player must guess which colors are and in the correct order.

He has several tries (12 it seems to me, I have to find the rules). And at each test, you have to see if the combination he gave is correct. If a color is present and in the right place, we put a white pawn, if the color is present but not in the right place, we put a black pawn and if the color is not present we do not put anything.

MasterMind.aia (14.4 KB)

I know mastermind :slight_smile:, love that game

I dont know about the game, but according to the topic i was prepared a aia, just see to that… nothing behind more logic in this…

sorry, check this Due to network delay, some blocks not saved properly

random(1).aia (5.6 KB)

Try this

MasterMind_1.aia (14.3 KB)

Also this is from my private collection, dated from 1970’s :slight_smile:


But seems to be repetation of colour it seems

Oooh woaw! Awesome the game, it’s a collector’s item you have, @dora_paz ! It reminds me of memories, my father had a pretty similar box, but I think he doesn’t have it anymore.

I test your aia tonight and see if it works well! Thanks to you for the help!

1 Like

If possible, why dont you test this app?

random.apk (5.3 MB)

I am not sure how willl the game go on…( just for learning)

Tested apk, you are close but this is not exactly what mastermind is about @Still-learning When 4 colors are chosen you have to inform the player whether he found the combination of colors or if he has found any colors and also if they were placed in the correct order or not. For doing that you may use up to 4 black or white pins.

  • A black clue means that there is a correct color in the correct place.
  • A white clue means that a correct color is in the wrong place.
  • An empty clue slot means that a wrong color has been placed

If for example with the first try I found only one color and I placed in the wrong position then I get informed about that and I continue from that point with a white clue and 3 empty slots. I change my combinations of colors and then I get informed that I have one in wrong position and one in correct, one white clue, one black, two empty slots and so on … In original board game I have 12 attempts to get the correct combination

1 Like

I got the point of the game… thanks mam

I am going to buy it for my kinds .


Great, thank you @dora_paz ! It was because of my color codes that it didn’t work then.

Now I will see how to do all the mechanics of the game, compare the combinations etc … :smiley:

1 Like

@dora_paz , Mam, As per your suggestion added in the post. i made a sample app… If possible just try (anyone, it is offline app with no permission) and let me know…

In VSA, if your attempt crosses more than 6 means, then i would like to hide the preceding things… and it can be viewable if your turn completes or finished… also, there is no term for repetition in the lists… You cannot pick up two colors during a attempt… i dont whether know repetition is allowed or not in this game…

Sorry, due to network connectivity, some of the blocks not saved properly… Now you try this…

CodeBreakerFun.apk (5.7 MB)

I dint make it much complicated, just for basic level i was tried, so easily can break up if you observe… :stuck_out_tongue_winking_eye: