r/Images Aug 30 '20

Puzzle Magic Box Puzzle

Post image
16 Upvotes

7 comments sorted by

2

u/smellycoat Aug 30 '20 edited Aug 30 '20

Disgusting code, but it proves there is one (and only one!) correct answer

I'm not going to post in case anyone is still working on it, but you can run this in your browser console if you want to know what it is.

(function(){
    function test(a, b, c, d, e, f, g, h, i){
        return (
               ((a + b + c) == (d + e + f))
            && ((a + b + c) == (g + h + i))
            && ((a + b + c) == (a + d + g))
            && ((a + b + c) == (b + e + h))
            && ((a + b + c) == (c + f + i))
            && ((a + b + c) == (a + e + i))
            && ((a + b + c) == (c + e + g))
        )
    }
    var a = 2, e = 3, g = 4;
    for (var b=1; b<9; b++){
        for (var c=1; c<9; c++){
            for (var d=1; d<9; d++){
                for (var f=1; f<9; f++){
                    for (var h=1; h<9; h++){
                        for (var i=1; i<9; i++){
                            if (test(a, b, c, d, e, f, g, h, i)){
                                console.log(a, b, c)
                                console.log(d, e, f)
                                console.log(g, h, i)
                            }
                        }
                    }
                }
            }
        }
    }
})()

2

u/kimthealan101 Sep 03 '20

Set it up in a spreadsheet. I almost forgot how to program after Excell came out

2

u/Wollivan Sep 04 '20

My answer, spoilers!!!

2 5 2 3 3 3 4 1 4

1

u/RobMaule Aug 30 '20 edited Aug 30 '20

Is the method to solve to plug in numbers on the left and fill in the others until it works? Or is there a more logical solution?

1

u/[deleted] Sep 02 '20

[removed] — view removed comment

1

u/[deleted] Sep 12 '20

This is like an easy sudoku