# Press The Grue Button

[This puzzle is inspired by the webpage https://apparenthorizons.com/2017/10/12/the-grue-problem-and-deep-learning/]

55 workers have got a chance to double their pay, as said by their boss. So, the boss gives them a challenge.

Every afternoon, a random worker will go to a 'game room' with a counter which can take values from 0 to 9 (both-ends inclusive), a blue button and a green button.

'Press the grue button and your pay will be doubled', the boss said, 'but press the bleen button... and your pay will stay the same forever.'

Speaking of grue and bleen, one means green and the other means blue, but which means which is random every day, and no one but the boss has any way of knowing what it means on any day.

However, the counter gives a clue. There are two switches next to the counter, one which adds one to the counter, modulo ten (A) and a 'mystery' one (M).

Here is what switch M does:

If grue means green when it is pressed, the counter will be set to zero on the next day when grue means blue.

But if grue means blue, the counter will be set to 9 on the next day when grue means green.

Each worker can press either switch next to the counter, (exclusive) or press the green or blue buttons on each visit to the 'game room'.

The workers want to double their pay as soon as possible, and NEVER press a button unless they are 100% SURE what grue and bleen mean on any day.

Question: How can the workers double their pay as soon as possible?

EDIT: For clarity, no workers have any knowledge of visits aside from their own, and the counter starts at 0.

EDIT: The counter's value is displayed next to the switches.

• If the meaning of "grue" is assigned at random every day, then how do you know the next day it'll switch? Nov 19 at 20:59
• @msh210 You will have to use switch M. Nov 19 at 21:03
• The workers know everything we do, are allowed to agree on a strategy beforehand, but are not allowed to talk to each other between visits, correct? Nov 20 at 10:38
• Does the counter increment by one each day if no switch is pressed or does it stay the same? Nov 20 at 10:38
• Can a worker that already has their pay doubled be picked again? In case, can such worker double their pay again? Nov 20 at 17:08

The fastest way to achieve success is:

Press switch M every day, unless the counter reads 9, in which case you should press the green button to win.

There is no need to increment the counter using switch A, it's just guaranteeing that you waste a day rather than hoping for a 50% chance that you pressed switch M while grue=blue. The game can only be won when the counter reads 9 and the grue button is green, since it's impossible for any worker to distinguish the counter reading zero because the grue button is green, and the counter reading zero because it's the first day. The workers need a 9 to show up on the counter, and can achieve fastest that by pressing the M switch as often as they can.

• This strategy requires an average of 4 days. I think it is optimal and aligned to the probability of getting a 9. If one could exploit the day counter (ie, on first day press A switch, so you can use both 0 and 9 as discriminator), the optimal average would be still 4. Nov 21 at 0:40

The strategy that each worker adheres to:

• If the counter shows 0, press the switch A.
• If the counter shows 1, press the switch M always. (Therefore, the counter has no chance to show 2~8)
• If the counter shows 9, it can be sure that grue means green, and therefore press the green button.
• This strategy is good but still not optimal. It requires an average of 7 days for any worker to press the grue button. This is due to the fact that encountering a 0 will make workers wasting an additional day just to press the switch A. Nov 21 at 0:45