Helo koders i need help in some block ,
i have 17 buttons in a screen , 17’th button is a reset button. when reset (17’th) button click color of other 16 buttons want to change randomly , these color is selected from 16 color list.
my problem is each button need unique color at a time , don’t repeat a color for buttons.
Can you show what you have tried?
Maybe create a list with the colors. Before assigning them to the button, check if it already exists in that list, if not, assign the color to the button and store it in the list. If it already exists, create a new color randomly.
only tried geting color from a list. but
Did you try what I suggested?
i don’t get your logic,will you make a block for this
Blocks ? I didn’t use blocks … I used algorithm … I didn’t test…
Create a list
Each color created randomly, you check if it already exists in the list
If it already exists create another color randomly If not, insert it in the list and associate it with the component
i want a select color from a list randomly.not creating new color
So my friend… You create a color with the numbers, don’t you? That color is created … correct?
Red Green Blue , 3 numbers
1 random number for each Red Green and Blue. If that combination that already exists in the list you created, don’t use it. Make create 3 new random numbers …
Here is a snippet from Taifun about picking a random item from list without picking duplicates.
How to pick a random item from a list without picking duplicates?
See if it helps. You have to adapt it according to your needs.