Wow! Thanks. I feel silly now bc I did look closely and didn’t notice ![]()
I’m literally 6 alcoholic drinks in and it didn’t take me that long to figure it out lmao.
Once again here to shamelessly seek help for a question…
Mammad Javad’s Birthday Decorations
Let’s call him MJ for short. MJ’s birthdays are always disastrous, and there is no exception for this year as well. The date is near and Shaazzz’s cursed pals shall hold the best birthday party possible for MJ. The first thing to do is to light up the party room. Giving MJ’s interest in circles, Shaazzz pals decided to put n bulbs on a circle. But as Mehrdad was in charge of doing it again, not all bulbs were properly circuited. Some were emitting and some were not emitting any light; But MJ hates disorder and won’t stand some of his birthday lights to be off: He’ll kill Mehrdad in revenge.Each light has a switch, and pressing it will change the state of its respective light and the two lights adjacent to it. You should prove that there is a method to turn every light on by differing the state of the switches, and save Mehrdad’s life… :DDD
Note that there is no limit on the order and the count of switching operations.
I tried induction but it doesn’t seem to work with this one.
Putting first thoughts into it, it should not be possible with at least n = 2. If
Some were emitting and some were not emitting any light
then you can only alternate between which of the two bulbs are emitting light with the given rules.
1: on, 2: off => 1: off, 2: on
…and reversed, no matter which switch is flipped.
However, if the rule
change the state of its respective light and the two lights adjacent to it
is interpreted as the other bulb counts twice (it is “left” and "right of the bulb you switch), it is also xor’d twice. In that sense the second bulb remains at the given state, making it possible for n=2.
However on n=3 it does not work for sure:
1: on, 2: on, 3: off => 1: off, 2: off, 3: on
…and reversed, no matter which switch is flipped.
I only am able to light all bulbs with n=4. And even if all other configurations with 1 or at least 4 bulbs can be all lighted up, it does not work with n=3 and, depending on the rule definition, n=2, so I’d say I’d refuse to prove that’d be possible. ![]()
Good point, I think the writer forgot to add a limit, n > 3, other than that Shaazzz is a quite a strong team ![]()
(Shaazzz = Iran’s computer gold medalists)
In that case let me look at my draft if I can conclude a proof for that case. ![]()
Nope I seem to come to no proof. I bruteforced n=5 and can confirm that one is solvable but I could not see a pattern. If I was you I would try to formalize what that ring looks like and what you can do with it. I tried focusing on segments you can rotate:
- A segment is part of the ring
- If you rotate the ring, the bulbs in your segments shift to a side
- At one side, rotating results in a bulb to disappear
- At the other side, rotating results in a bulb to appear
- If the ring is larger than your segment, the new bulb was not yet in the segment and can be either on or off
- If the ring is as large as your segment, the appearing bulb has the state of the disappearing bulb
- If the ring is smaller than your segment, the appearing bulb has the state of a bulb that is still in your segment (left bulb = right bulb if the segment is 1 larger than the ring)
That way you can focus on these key actions:
- rotate left
- rotate right
- toggle the switch in the middle
And work with the bulb pattern and see if you can set all you can see to on. That’d be the proof. Because if the ring is larger, you can always rotate to the remaining bulbs and apply the algorithm again.
But I did not succeed to do that. ![]()
Rotating is actually what I was thinking of. I did not come to a proper proof for it but for any set of bulbs, rotating the segments can lead to a single bulb off. Then I tried to see whether I can do anything with rings that only have one bulb off, and I also considered the value n mod 3 as the switching changes the state of 3 bulbs.
If you can wait some more, I will look at it today again. Gonna write a test script that brutforces the shortest steps for lighting up a 8bit ring. Maybe the steps show a good approach you can conclude a proof from. ![]()
I Appreciate it. No need to rush though, it’s been a few weeks already.
Was interested setting the script up so it is done already. ![]()
It generates unique starting situations (unique even when comparing rotated settings) and prints the shortest solution for a ring of 8 bulbs.
This is the result
00000000 > 00000111 > 00001001 > 00010101 > 00101101 > 01011101 > 10111101 > 01111100 > 11111111
00000001 > 00000110 > 00111110 > 11111111
00000011 > 00011111 > 11111111
00000101 > 00000010 > 00001100 > 01111100 > 11111111
00000111 > 00001001 > 00010101 > 00101101 > 01011101 > 10111101 > 01111100 > 11111111
00001001 > 00010101 > 00101101 > 01011101 > 10111101 > 01111100 > 11111111
00001011 > 00001100 > 01111100 > 11111111
00001101 > 00000011 > 00011111 > 11111111
00001111 > 00001000 > 00000110 > 00111110 > 11111111
00010001 > 00011111 > 11111111
00010011 > 00010100 > 00011010 > 00000110 > 00111110 > 11111111
00010101 > 00101101 > 01011101 > 10111101 > 01111100 > 11111111
00010111 > 00010000 > 00001100 > 01111100 > 11111111
00011001 > 00011110 > 00010000 > 00001100 > 01111100 > 11111111
00011011 > 00010101 > 00101101 > 01011101 > 10111101 > 01111100 > 11111111
00011101 > 00011010 > 00000110 > 00111110 > 11111111
00011111 > 11111111
00100101 > 00100010 > 00111110 > 11111111
00100111 > 00011111 > 11111111
00101011 > 00101100 > 00100010 > 00111110 > 11111111
00101101 > 01011101 > 10111101 > 01111100 > 11111111
00101111 > 00101000 > 00110100 > 00001100 > 01111100 > 11111111
00110011 > 00110100 > 00001100 > 01111100 > 11111111
00110101 > 00111011 > 00100111 > 00011111 > 11111111
00110111 > 00110000 > 00111110 > 11111111
00111011 > 00100111 > 00011111 > 11111111
00111101 > 00111010 > 00110100 > 00001100 > 01111100 > 11111111
00111111 > 00110001 > 00101101 > 01011101 > 10111101 > 01111100 > 11111111
01010101 > 01010010 > 01001110 > 00111110 > 11111111
01010111 > 01101111 > 00011111 > 11111111
01011011 > 01011100 > 01010010 > 01001110 > 00111110 > 11111111
01011111 > 01011000 > 01000100 > 01111100 > 11111111
01101111 > 00011111 > 11111111
01110111 > 01111001 > 01100101 > 01011101 > 10111101 > 01111100 > 11111111
01111111 > 01111000 > 01110110 > 01001110 > 00111110 > 11111111
11111111
If you are interested, this is the script.
I kinda optimized it so it should not (always) time out if you hit Run.
You can try to find a pattern from that and generalize it to rings of other sizes. It seems the maximum number of toggles is equal to the number of bulbs.
This is amazing
The results pattern will definitely help proving it. I’ll try converting the script to c++, for more possible optimizations.
Also I didn’t know that Discourse, thanks for being helpful.
Why, does it bother you to wait 2.5 seconds including compile time?
Rust is on the same level of C++ performance wise. I guess your time is better spent on finding a pattern in the result.
Note that my script is not a proof for anything but a ring of 8 bulbs. If you conclude an algorithm for other sized rings from that, you have to proof that is actually working for any ring.
Nah, I’m just more familiar with c++, That’s all. Why use print() when there’s the mighty cout<< ![]()
Oh I see, then sorry to make you deal with Rust.
if you have questions regarding my code, write me a DM or in Discord.
Would anyone want to voice an NPC in my latest H3 cartoon? You should have the accent that they have in Dartmoor, England (or be able to convincingly fake it). And a good mic. I can’t pay you because I’m broke, but you would get a mention in the credits. It would be like maybe 3 sentences and them freaking out over seeing something. Thought it might be worth asking here. It could be fun. ![]()
Its a shame im dutch so my accent will always obviously be dutch. But i do hope you find someone for your animation. Its gonna be amazing
I do have a good mic though I don’t think you’d accept deep Mazandaranian accent lol. As far from Bri’ish as possible.
I’d be up for it. I’ve got a good mic at least.
Might depend on what kind of accent from Dartmoor you might want, but I know RP and cockney so it shouldn’t be too difficult if I just need a reference from the level itself ![]()
Oh blimey!!! That sounds like it would be just aces.
Sadly I haves a fairly heavy American midwest with a bit of Chicago mixed in accent.
