Mindblaster

Over the holidays, in between stuffing my face and playing XIII, I decided to build a web-based game for this site. Bearing in mind my Flash and Director skills are not that hot, I chose to replicate Mindblaster, one of the puzzle games on my mobile phone (a Sony j70).

If you’ve never played it, it’s basically a variation of the classic Mastermind board game from the 70’s, created by Mordecai Meirowitz. The rules are quite simple, the computer (or script in this example) generates a 5 digit number and you have to figure it out through detection and guesswork.

Anyway, I’ve knocked up a quick beta for public consumption, so if you’ve some time to kill and you like a good puzzle, feel free to have a crack at it. Bear in mind it’s a beta, so please let me know if anything is amiss or if you’ve any suggestions to improve it.

Posted 6 years, 2 months ago

I’ve been trying to work out how many possible combinations there would be for 5 different digits, ranging from 0-9.

I think it may go something like - 9 x 8 x 7 x 6 x 5, which equals 15,120 combinations.

I’ve yet to check that this is right, but if you know a bit more maths than me - feel free to correct me!

Phil · 6 years, 2 months ago

He he... I rock.

Mal · www · 6 years, 2 months ago

Way to go Mal - I reckon that’ll take some beating ;-)

Phil · 6 years, 2 months ago

I reckon there are 30,240 possible combinations.

There are three factors affecting how many possible combinations there are. The obvious two; how many digits (in this case 5), and how many possibilities for each digit (in this case 10). The third is that the numbers can go in any order i.e. 12345, 12354, 12534 and so on are considered different.

I managed to get a forumla by trial and error of n!*nCr.

n is the number of digits (i.e. 5), r is the number of possibilities (i.e. 10) and the C is part of the notation; nCr (written properly) is some function of n and r, can’t remember what it’s called, but scientific calculators should have an nCr button!

But i’m not a mathematician so i’m not that convinced myself.

Tim · 6 years, 2 months ago

>> I reckon there are 30,240 possible combinations

Hmm, which is exactly double the figure I thought. I wonder where I went wrong...

Mucho kudos Tim on generating a formula though. I reckon your method was a bit more resolved than mine!

Phil · 6 years, 2 months ago

Firstly my formula is wrong. In my notation it should be n! * rCn, the common notation is nCr I just got muddled up, you can call your variables what you like anyhow.

Secondly the reason why your value was half mine: Your estimate of 9x8x7x6... is equal to n! in my formula. But for the values here (r=10, n=5), rCn just happens to equal 2 :-)

rCn actually finds values from Pascal’s Triangle. This is a pyramid of numbers that starts with 1, the second row is 121, the third 1331. If you draw it out each succesive number is found by adding the numbers above it.

Maths is very difficult to explain in words, or that could be me, either way apologies if it doesn’t make much sense, it works.

Tim · 6 years, 2 months ago

Hello everybody,
Our maths is fresh! We’ve just done permutations + combinations in AS Maths and we think you’re way off ;-)
We’re going to stick to common notation: nCr.
n is the number of numbers to choose from.
r is the number of numbers to finish with.
Ans = nCr
Ans = 10C5
Ans = 252

Dave + Cat + Beef · www · 6 years, 2 months ago

Try it out with a smaller game e.g. n=3, r=2.

Your nCr would give an answer of 3 but you can quickly jot down 6 possible combinations - 12, 13, 31, 32, 23, 21.

:-p

Tim · 6 years, 2 months ago

uh-oh

Dave · www · 6 years, 2 months ago

I think your earlier posting was right first time:
10 options for the first position
AND
9 for the second (assuming no repeats)
AND
8 etc

ie 10! - 5! = 30,240

But if you are allowed repeats the answer is 10^5

Dave's Dad · www · 6 years, 2 months ago

uh-oh

Dave · www · 6 years, 2 months ago

10!-5! would be the more elegant way of putting it.

After each go the game gets easier as you have more information available. In what number of goes, in theory, would it be guaranteed that you could get the correct combination?

Tim · 6 years, 2 months ago

I think I understood the Dizzee Rascal thread more.

Matt · www · 6 years, 2 months ago

Combinations don’t have regard to the order of the elements.
http://dictionary.reference.com/search?q=combination
You should be using permutations. So 10P5 is the correct way to work it out:

10 P 5 = 30240

Tim was right all along (+ Dave’s Dad).

Dave's Maths Teacher · www · 6 years, 1 month ago

hello

pford · 6 years, 1 month ago

From the standpoint of a Finite Mathematics teacher:

Actually, the answer here is 100,000 (or 10^5). There are 5 digits and each one could be 1 of 10 different numbers (0-9). The Multiplication Principle for Counting says to multiply the options of each group. 10*10*10*10*10.

Now, as far as thinking about permutations, that would imply that NO NUMBER could be repeated. However, you CAN have a number such as 33333.

In regard to combinations (nCr), that is not right, because combinations are in regard to digits where ORDER DOES NOT MATTER. However, in a five digit number, the number 19999 is not the same as, say, 91999. Therefore, we can not use Combinations, either.

Hope this helps.

pford · 6 years, 1 month ago

in my class we were given a five digit number using 4 numbers 3,4,5,6 but only one of the numbers can be used twice. I would like to know how many different possibilities are there for these numbers. if someone knows the awnswer please email me at jeff_new1@hotmail.com thank you

jeff · www · 5 years, 7 months ago

and what are they if you know them please

jeff · www · 5 years, 7 months ago

I think Phil was on the right track. The reason he ended up with with 15,120 instead of 30,240 is that he started multiplying with 9 instead of 10 : 10 x 9 x 8 x 7 x 6 . He didn’t consider 0 as being a number you could use to start the sequence. I’m working a problem with zipcodes and their can not be any repeating digits. Where 0 could be the first digit. Which in turn means you would have 10 choices for your 1st number. I think Phil would be right if the 1st number could not be 0 and their are no repeating digits.

Jim · www · 5 years, 5 months ago

After reviewing my answer I realized that Phil isn’t right because you could still go: 9 x 10 x 8 x 7 x 6.
So the only answer I could come up with is: 10 x 9 x 8 x 7 x 6 = 30,240

Jim · www · 5 years, 4 months ago

Come on guys!

nPr = n! / r!
so 10P5 = 10! divided by 5! = 10*9*8*7*6
= 30240

The reason Phil was wrong initially is that he used the actual digits rather than the NUMBER of digits (i.e. he was thinking in terms of 0-9 instead of 1-10, there being 10 possible digits).

tOpCaT · 5 years, 2 months ago

Commenting on this post has been disabled.

My name is Phil Lindsay, a web guy from Scotland, now living in Newcastle upon Tyne in England. I also run a web design company called Presence. You can email me at phil@xlab.co.uk, read more ramblings on my Twitter stream and view my photos on Flickr. You can grab the RSS feed for this weblog here.