News for hackers. Stuff that matters.
Re:Brute-forcing a seemingly simple number puzzle by saagarjha on Wednesday December 05, 2018 @06:27AM (#18607348)
> Therefore we could use a two-dimensional byte[][] array. However, due to (most likely premature) optimization, I chose one-dimensional, unrolled array

Does the Java compiler optimize this to be equivalent?

As an aside, I really hate problems like this that seem like they have a nice solution but then you end up brute forcing them. A family friend had one recently that she tore her hair out over for at least a week before finally accepting that there was no “simple” solution after confirmation from no fewer than five other people that they thought the problem was hard.

Re:Brute-forcing a seemingly simple number puzzle by munificent on Wednesday December 05, 2018 @12:57PM (#18610683)
> Does the Java compiler optimize this to be equivalent?

No, it can't. `byte[][]` is an array of arrays, and that fact is user-visible because you can access any of the individual arrays, pass it to other functions, etc.

Re:Brute-forcing a seemingly simple number puzzle by saagarjha on Wednesday December 05, 2018 @05:05PM (#18613122)
But you can do this is C, which has flat arrays. To “access” an individual array just grab the base address+array sizeelement sizeindex.
Re:Brute-forcing a seemingly simple number puzzle by kej on Wednesday December 05, 2018 @01:51PM (#18611217)
>A family friend had one recently that she tore her hair out over for at least a week before finally accepting that there was no “simple” solution after confirmation from no fewer than five other people that they thought the problem was hard.

Is this something you can share? I'm curious what it was.

Re:Brute-forcing a seemingly simple number puzzle by saagarjha on Wednesday December 05, 2018 @05:01PM (#18613074)
Sure, it was the problem listed on this page: https://www.rain.org/~mkummel/stumpers/22sep00a.html. Basically it requires at least a bit of guess and checking, which made her feel as if she was doing it wrong since it seems like there would be a “formula” to do these that you could find if you did some algebra or something. I ended up writing a C++ program (yay, std::next_permutation) to brute force solutions but it could not find a pattern, especially if you try to increase the number of circles and look for patterns there.