Coding Games and Programming Challenges to Code Better
Send your feedback or ask for help here!
Created by @Lisa-Has-Ideas,validated by @Konstant,@Remi and @Rafarafa.
If you have any issues, feel free to ping them.
Coding Games and Programming Challenges to Code Better
Send your feedback or ask for help here!
Created by @Lisa-Has-Ideas,validated by @Konstant,@Remi and @Rafarafa.
If you have any issues, feel free to ping them.
I know I must have solved it some time ago.
Thatās it - Coding Games and Programming Challenges to Code Better
Very similar, yet not the same. Here I could invoke the great wizard āXorā. In the other puzzle the grid size could be too large for this approach.
And also (as I understand it), each button in that āVery Hardā puzzle all have the same effect.
In This puzzle here, there are 3 different effects based on the location of the button on the square.
The real difference is that you have to find only one button in this puzzle, whereas you a to find a real solution in the other, and with a variable size. That makes the difficulty āvery hardā.
Merlin Magic square solution is a easy one or difficult.
That has to be a record for number of Test cases.
Iām a bit confused, maybe Iām just missing something obvious?
If the initial sequence is
~ * ~
~ ~ ~
~ * ~
And you do a transformation by pushing 8 (the bottom row will transform)
~ * ~
~ ~ ~
* ~ *
If you push 8 again (it will reverse what it just did)
~ * ~
~ ~ ~
~ * ~
Then 4 (it will reverse the left most column)
* * ~
* ~ ~
* * ~
Then 6 (it will reverse the right most column)
* * *
* ~ *
* * *
Which does get the correct result, as the first test case is 8 8 4 6 ( with 6 being the answer ).
*** Edited for correctness as per @cedricdd
Hi,
When you push 4, the affected ones are 1,4,7 but in your example you are changing 1,4,7,8 & 9.
Why is the 4th, and 5th solution is ***, ***, *** ???
I mean, the solution should be ***, ~, ***ā¦
Hi Life ā
Iām not sure what you mean. Can you ask it a different way?
Hi everyone,
iām trying to solve this in python. Iām quite new to programing, and i have difficulties to find a way for solving this puzzle. For now, all i have done is :
Hi Halarikā
thanks for posting, and thanks for playing my puzzle.
Youāre going through a learning process for sure so āstruggling thru itā is good for you.
I would suggest you write in pseudocode first.
In other words, write out in plain simple English what you want the computer to do.
Then if you canāt figure out how to translate some of that into python just Google it with the word python at the end like ācheck if two lists match exactly pythonā
I also provided in the puzzle two links that will show you someone playing it or let you play it yourself in case that is helpful to inspire the pseudocode.
Thank you for your answer Lisa,
iāll try this
Hi there,
Iām trying to solve this puzzle in C++ but I wonder if there is an issue on it ?
Some of tests cases work (also some āhardā one) but some donāt. Really strange.
Let me show the inputs for Test case 2. For convenience, my program uses ā1ā for lit and ā0ā for non lit.
Each time a key is pressed, the program shows the input, the key pressed, and the output.
Initial input:
~ ~ *
* * ~
* * ~
Apply Lizzo pressed buttons
0 0 1
1 1 0
1 1 0
Key pressed : 4
1 0 1
0 1 0
0 1 0
1 0 1
0 1 0
0 1 0
Key pressed : 5
1 0 1
0 0 0
0 1 0
The test case said : Expected 8 .
This seems really strange. No single key can solve this puzzle in that state
Did I omit something ?
Hi,
When you press the button 5 it will reverse the position 2, 4, 5, 6 & 8
I missed that ! It was not so explicit for me. I read āreverse the button 5ā .
For the others cases, the text enumerated all the buttons that are invertedā¦ but not for the button ā5ā ā¦ :fear:
Many thanks @cedricdd
Hello, I am sure my problem has a absolutely obvious answer, but I seem to be overlooking it. I am coding in javascript btw. Here is some pseudocode:
MMS = MagicSquareSolver(StartSquare, All the buttons Lizzo presses)
for (let k go from 1 to 9){
Test = MagicSquareSolver(MMS, k)
if (Test == perfect){
answer=k
return answer;
}
}
function MagicSquareSolver (Square, arr){
alltheButtons=getalltheButtonsNeededtobepressed(arr);
for (let i 0 to alltheButtons.length){
if (Square[alltheButtons[i]=="*"){
Square[alltheButtons[i]="~";
} else{
Square[alltheButtons[i]="*";
}
return Square;
}
The Problem I have is that When going through the test process, the MMS array (which should always be the one that lizzo did) changes with the Tests I do, so when I test if 5 is the correct button, it tries it as if lizzo pressed all the buttons she did + 1 to 4. I donĀ“t know if this was clear, please let me know if it wasnĀ“t.
Hope someone can help!
You can compile/run it without error? ā when there is no closing square-bracket?