# 1 in a million with two games

Actually might be 1 and a million

Same here as well

2 Likes

Tell me if you think this might be a million
Take a pic

Fun!

Both games would average out to one chance in a million to win, yes. For the first one, youâ€™re nesting three `1% chance` conditions. Thatâ€™s 1/100 x 1/100 x 1/100, which is 1/1,000,000.

For the second one, youâ€™re pulling numbers that range between 1 and 1,000,000. There is roughly[1] one chance in a million to pull any single number, so, yes, there is one chance in a million that the numbers will match.

For the first game, you could simplify the logic a little bit:

For the second game, youâ€™re only interested in comparing the two numbers when `value2` changes, so you donâ€™t need that comparison in the `on game update` loop. You only need to check when `value2` changes:

Nice work! That was a lot of fun! No, I didnâ€™t win in either game.

[1] For those who dig a little deeper, MakeCode Arcade, I believe, relies on JavaScriptâ€™s `math.random()` function which, according to Mozilla, is a pseudo-random generator that approximates uniform distribution: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random

1 Like

Thanks @AlexK! The changes in the game sound better. Iâ€™m someone who is usually on the safe side. I tried making a 1 in a million game about in July I believe. Thanks for the feedback! I feel like Iâ€™m over doing it but thanks for simplifying it!

1 Like

Honestly like short games with short code or long games with long code

Is the first game a template?

1 Like

No its the game. Press and hold A to roll and the chances of getting to it is actually 1/1000000

I have a messy desk, and happened to have the necessary parts for a test jig at hand. Iâ€™ll let you know how long it takes:

Jeff

5 Likes

That is the best thing ever! How long do you plan on running that for?

I left it running while I left my office for a bit, and over the course of about an hour, it had tried 15,778 tries without a win. I do need my computer again before the day is out, though, so I stopped it. As fun as mechanical testing is, I think automated testing in software will probably be faster

Jeff

Yeah, automated testing will usually be a bit faster If anyone wants to run it in dev tools, under the `---simulator`:

``````const board = pxsim.board();
let on = true;
setInterval(() => {
board.setButton(5 /** A **/, on);
on = !on;
}, 10 /** ms **/);
``````

(just a general note for anyone reading, note that running things in dev tools can be a safety concern if youâ€™re e.g. running something on a site with a log in - itâ€™s best to avoid running any code you do not understand / you didnâ€™t write yourself there / just be cautious in general that you arenâ€™t sending your data to someone or anything of the sort.)

5 Likes

Man everyone is looking for (well I donâ€™t want to say cheats) new ideas to beat this game.

2 Likes

I mean you may not want to say cheats but Iâ€™m not against it; name of the gif in my post:

2 Likes

But seriously, I donâ€™t know javascript or python but that is cool!

1 Like

Big Brains!! Iâ€™m not against your javascript but robotics or javascript is a good way to put it.

1 Like

Here is the problem with both of your ideas @jwunderl and @FlyingFox, when you spam A, who knows when you will win? Then there is the part where you do win but never get to see the victory

Ah good point, hereâ€™s a version that will rain confetti and say you win when itâ€™s over without restarting:

1 Like

That solves the A button problem

Have you been leaving it on all night

Question: Does it delete the number you roll after you roll it so you get a higher chance of winning as you go on?