2 buttons appearing in a random order

Hello,

I wonder if you could help me out. I am trying to build a quiz app which will enable users to store and retrieve data from Google Sheets. I would like them to enter 1 WRONG ANSWER and 1 CORRECT ANSWER. BUTTON 1 would always show the wrong answer and BUTTON 2 would show the correct answer. I don't want BUTTONS 1 and 2 to always appear in the same order.

Is there any way I can make these 2 buttons appear randomly - in Space 1 and Space 2 (for example, to the left and to the right, or bottom, top)?

Thank you,
Martina

This might be a good case for using the Any (generic) blocks, and a global list of your button components both_buttons (Button1, Button2).

Init a second global list of buttons, shuffled_buttons, copied from both_buttons then shuffled randomly.

Use item 1 from list shuffled_buttons as you would have used Button1, and
use item 2 from list shuffled_buttons as you would have used Button2.

Shuffle procedure(s) can be found in

Thank you for your reply. I'm sorry but I am not sure I understand how exactly to do this. Could you perhaps help me out a bit more?

Here is a sample app, shuffling button texts. The actual button component stay in place, so it's a bit of a fraud, a magic trick.
shuffling

I used a general purpose shuffle procedure, that you can use elsewhere too.
Draggable blocks:

Here are two necessary global variables:

Here is the Designer:
Designer

The shuffle button:


This was more complicated than expected, because a temporary copy of the button texts was needed to avoid overwriting input with output in a tangle.

Button1 and Button2 just announce their .Text values in Label1.Text:

The source:
shuffle_buttons.aia (3.7 KB)

All blocks:

1 Like