Stefan
Legend
Less than 2/3 of the 15-puzzle sim now. I guess 3x3 is easier to implement.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
edit: can save 6 bytes by moving to one line
EDIT: hey, if anything goes, why not just replace "document.body.innerHTML=h.join("")" with "alert(h)"? and while we're at it, remove the spaces from h too... that would bring it down to 251 or so.
Good job, but... nah, not ok.
For the 15-puzzle I'd say there is a natural and straight-forward minimum-requirements standard and we should follow it:
- Proper 4x4 view (like Tom's original).
- Properly laid out up/down/left/right keys (doesn't have to be the arrow keys, could be i/n/a/f, for example).
- Proper scrambling function (single key press), because proper hand-scrambling is hard. I suggest random state or at least 9999 random moves (maybe more, we should actually analyze this (this could be an interesting side project)).
- Proper net view
What exactly does that mean?
Indeed, and that's why I think my 15 puzzle is acceptable...I find it really hard to define a reasonable minimum standard.
Indeed, and that's why I think my 15 puzzle is acceptable![]()
The "proper 4x4 view" and "proper scrambling function" are the same kind of concessions we already made on the 3x3x3 sim without much complaint.
unless we have a very specific idea of what makes an acceptable scrambler (e.g. must be random state with randomly placed hole) it's only natural to keep saving bytes by making the scrambler worse or even absent.
There's an old saying among perl programmers. "Every program has one unnecessary line of code, and a bug."
According to that, you could reduce this program to a single line of code, with a bug.
Let me make this a proper challenge by defining the requirements:
- Must look like Tom's original or "equivalent" (you can for example make it graphical, or use 10..15 instead of A..F)
- Must have reasonably laid out up/down/left/right keys working like Tom's original (or use the mouse or whatever in a convenient way).
- Must have one-key/click random state scrambling.
- Optional: Timer, starting with the first move after scrambling, updating at least every 0.1 seconds during the attempt, stopping with a certain key/click, showing at least "seconds.centiseconds" (the time formatted like that, not that string) and "DNF" if stopped when puzzle not solved.
- Optional: Show a sub-10 solve (by anyone)
1 line of code with a bug ok. heres my 3x3sim in c++
main(){}
bug: doesnt actually simulate a 3x3
There's an old saying among perl programmers. "Every program has one unnecessary line of code, and a bug."
According to that, you could reduce this program to a single line of code, with a bug.