2

I'm trying to design a puzzle for a game I'm making, and the puzzle is fairly similar to the one from the power plant in Myst. The idea is that I have 9 buttons, and each button supplies an amount of power to the "system". The solution to the puzzle is to press three specific buttons (order doesn't matter) to reach a specific power threshold.

Obviously, I have to be careful about how I choose how much power each button provides since if a number can be reached by more than a single combination, that can destroy the complexity of the puzzle somewhat. My first naive idea was to use the first 9 prime numbers, but a quick check through a program showed that that wasn't going to fly. It had occurred to me that I could just choose a number that only occurs once in the list of results, but I would prefer it if I could choose which 3 buttons to press at random.

How do I go about generating this list of 9 numbers such that adding any 3 of the numbers together results in a unique value? Is there some statistics/probability thing that I can use or do I just have to trial-and-error it?

Abion47
  • 263
  • 1
    If the numbers are all on different scales, this property holds immediately. For example, if the first number is in ${0,\ldots,9},$ the next is in ${0,10,20,\ldots,90},$ and so on, this amounts to choosing the digits in a nine-digit number. This isn't restricted to powers of ten, though: ${0,1,2},$ ${0,3,6},$ ${0,9,18},$ and so on would work equally well, but would be harder since the player can't just read off the digits. – RideTheWavelet Oct 12 '17 at 19:01
  • 1
    It should be easy to see that powers of ten ($1, 10, 100, \ldots, 10^8$) work. More generally, powers $a^0,\ldots,a^8$ for any $a>0$ should work as well. – angryavian Oct 12 '17 at 19:01
  • @RideTheWavelet That's actually a pretty cool property, but I'm hesitant about using 9 numbers in different magnitudes like that as it would result in each of the 9 numbers being vastly different to each other. That would probably make the puzzle relatively easy to solve, as all the player would have to do is give a ballpark estimate based on the magnitude of the desired result. – Abion47 Oct 12 '17 at 19:14
  • @angryavian See above. – Abion47 Oct 12 '17 at 19:14
  • If you changed signs, this would be much harder to guess based on size, but should still give unique combinations. – RideTheWavelet Oct 12 '17 at 19:31
  • @RideTheWavelet That's an idea, though if its possible I'd prefer a solution that didn't deal with negative numbers. (It wouldn't make much sense for a button to remove power from the "system".) – Abion47 Oct 12 '17 at 19:32
  • If the system starts with several machines already on, but the power level isn't the right amount, some switches could turn machines on while others turn machines off? – RideTheWavelet Oct 12 '17 at 19:35
  • @RideTheWavelet I was able to create a generalized solution based on your advice. Thanks for the help. – Abion47 Oct 13 '17 at 05:41

2 Answers2

0

Partial answer.

Just starting a brute force greedy algorithm, the sequence $$ 1,2,4,6,10,16 $$ works as far as it goes. The pattern continues adding $8$, $10$ and $12$ $$ 24, 34, 46 $$ to give you nine numbers with distinct sums of threes. The totals range from $1+2+4=7$ to $24+34+46=104$.

You should check this.

I wonder if this greedy solution is optimal in some sense. I wonder if there's a systematic way to generalize.

Ethan Bolker
  • 95,224
  • 7
  • 108
  • 199
  • The first 6 numbers work, but adding on the $24$ to the list introduces a duplicate: $1+10+16=1+2+24$ – Abion47 Oct 14 '17 at 16:27
  • @Abion47 Right. Glad I asked you to check. I suspect $26$ instead of $24$ will work; then continue with the next even number that works, and so on. – Ethan Bolker Oct 14 '17 at 17:54
0

I ended up taking an approach that generalizes the powers approach suggested by RideTheWavelet and angryavian. What I did was I took each number from $[1,9]$, and used it as the power to a given base, then multiplied the result by a random number from $[1,9]$. (I omitted $0$ as a multiplier because having one of the buttons add $0$ power invariably results in non-unique combinations, and it doesn't really make sense from a game standpoint anyway.) I'm not sure what the full function would look like in LaTeX notation here, but perhaps something like this:

Let $b$ be a given base number and $r$ be a random integer in $[1,9]$. For each $i$ in $[1,9]$:

$$ f(i)=rb^i $$

I used progressively lower base numbers, testing how often the program resulted in a set of 9 numbers that satisfy my requirements. Due to my restriction that the numbers be positive integers, it took some trial and error to find a base number that didn't lose its uniqueness due to truncation. I eventually settled on $1.29$ as a good base that generated unique combinations but didn't have a huge distance between the smallest and largest number.

I then took this program and ran it until I had 50 such lists of $9$ numbers. Then I went through each of those lists and picked the one with the smallest average distances between adjacent numbers. What I ended up with, then, is a list of 9 numbers whose numbers contain the property of unique combinations from being powers of a base number (offset by a random multiplier) but are close enough to not A) be completely outlandish in the spread from smallest to largest, and B) have the magnitudes be so apparent that the solution can be guessed without actually doing any math and/or experimentation.

Here are a few example lists that I was able to generate:

$[2,3,4,6,24,41,47,53]$

$[3,4,5,7,11,17,30,53]$

$[4,6,8,19,25,41,46,53]$

$[3,4,5,7,10,18,29,53]$

$[2,4,5,6,11,28,41,53]$

(There definitely are some numbers that seem to pop up in quite a few lists I generate. That's an interesting effect.)

Abion47
  • 263