Tracking numbers to get in order

I'm making an app where, when you press a button, 2 numbers pop up on screen and if the same numbers pop up on both dice then you have an image come up. The problem that I'm having is to win the game, you have to have all the numbers come up in order. For example, if you get double 3's but you have not got double 2's and 1's yet no image comes up but if you get double 1's then double 2's and so on till 5, you will win.

Use a list to store winning dice
Use an if is in list condition to check for the previous number (you would need to check for an empty list for 1's)

For example

You roll two 3s. If 2s (and therefore 1s) are in the list, then add the 3s, if not try again. I would suggest just storing a single integer (1,2,3...) for easy checking

1 Like

I'm confused what components your talking about. I don't know how to make a list.

Learn about using lists:

General Tutorials

Can you show me the blocks I would need?

Create a variable. Set it to 1. Then wait until double-one will appear. Increment variable and wait until double-two will appear, ... When variable will 5 and double-five will appear, you win.

I believe these blocks just about cover this off

2 Likes

I only have 1 button to roll the dice and in yours you have a button1 and button 2.

Button2 is to start the game and clear the labels, you would not need this if you start the app again, but allows users to start again, at any time.

So if I just copy all those blocks above can I delete my other command that you showed me earlier, the one that is "When roll dice button click do set dice1 text to random integer 1-6, set dice2 text to random integer 1-6, if and dice1 text =1, dice2 text =1, set canvas 1 background image to blank.png? Can I delete that and replace it with the one above or do I need that?

Here is the aia project, test it and see if it does what you want.

diceImage2.aia (11.7 KB)

2 Likes

@TIMAI2 Yes that is what I want it to do except for I want a different image on every new dice double.

  • What is the probability that by rolling the pair of dice 6 times we obtain this sequence:

1 1
2 2
3 3
4 4
5 5
6 6

P = 1 / (6 * 6)^6 = 4.6E-10

1 Like

What is the hope that by rolling the pair of dice as indicated in the proposal of this topic we will arrive at 6 6.
That is to say:
x x
x x
1 1
x x
...
xx
2 2
x x
...
3 3
.....
6 6

It is: 216

For this I had to ask for help from the supermathematicians in this forum in Spanish.
https://foro.rinconmatematico.com/index.php?topic=118235.new#new

𝑃(𝑋=𝑚)=(𝑚−15)𝑝6(1−𝑝)𝑚−6

𝐸(𝑋)=∑𝑖=16𝐸(𝑋𝑖)=6⋅(36)=216

1 Like

This app is a quick adaptation of the @TIMAI2 app, it is in Spanish and I have simply copied blocks without using procedures.

  • When Click in "Automatic" roll the dice until you get 6 6. You get the number of rolls.

  • When Click "20 veces", you play 20 games and get the average.

diceImage2_B.aia (17.5 KB)

  • Proposal: simplify and improve my code.

@TIMAI2 How do I do 6 of them I found out how to change the image but how do I make six of them you only have 3...

You just need to extend the code to handle things up to 6 sixes. It is all there you just have to replicate it.
[EDIT]
Actually, all you should have to do is change the variable highNumber setting to 6

1 Like