Stefan
Legend
Hmm. I'd really like to have it optimal and please everyone, but sadly I don't see how to do this without bloating the code too much...I do, sometimes staring at the time or taking a deep breath before looking up.
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.
Hmm. I'd really like to have it optimal and please everyone, but sadly I don't see how to do this without bloating the code too much...I do, sometimes staring at the time or taking a deep breath before looking up.
But yeah, actually I intend to implement this, though maybe not in Javascript at first as I'm not yet comfortable enough with it.
Maybe I'll put Herbert's stuff in there again, but another issue is that I'd have to find out how I'm allowed to do it.
Ah, very nice! I'm familiar with that in general, but didn't think of it here.eval vs function: JavaScript has anonymous functions and they are often used for this: setTimeout( function () { document.keyup = startTime; }, 1000 );.
Ugh. I've seen that before. Probably when you mentioned it before. I really don't want to go through that. My understanding is that working with integers in floats is exact as long as they're relatively small (fit in the significand part) and there's no rounding.Need to read this some day.
Whoa, wait... <thinks.../>... ok, that is cool, but it leads to accidental timer restarts by hitting and releasing two keys (or the same key twice). I really want the one second delay. I'm considering this:What about replacing
window.setTimeout( 'document.onkeyup = startTimer', 1000 );
with
document.onkeyup = function () { document.onkeyup = startTimer; };
? Seems to work here.
I agree, it would be very nice. I'm thinking of using Thistlethwaite with tables for bi-directional search for each step, so eight tables of rather small size (a few thousand entries). Then just combine those tables.Javascript is clearly not the natural choice for implementing a computer solver, but I think building a good one in js would be of great benefit to the cubing community.
Humm, you're doing it wrong. The cube states are supposed to take zero space. This is the whole point of indexing; you only store the values in an array, and find the one that corresponds to a given cube state using table[cubeToIndex(cubeState)].... I'm going to modify the implementation to store cube-state in the lookup tables as strings. A single cube can be stored in a minimum of 7 characters in javascript.
I'll be really impressed if you find anything good that doesn't rely on precomputed tables. I haven't given it much thought, but it just seems really hard/impossible.Another project I've been working on is finding a heuristic which provides an accurate measure of a cube state's distance from the solved state. A perfect heuristic should lead to an optimal solver which runs in linear time. I've had some ideas and limited success, but I've as yet found nothing good enough for a direct route to the solution.
That was stupid. My old Thisthethwaite implementation did do four bi-directional BFS searches, but of course I can only precompute tables for the backwards searches, as the goal is always the same but the start isn't.I'm thinking of using Thistlethwaite with tables for bi-directional search for each step, so eight tables of rather small size (a few thousand entries). Then just combine those tables.
... good point, move tables store cube state in coordinate formHumm, you're doing it wrong. The cube states are supposed to take zero space. This is the whole point of indexing; you only store the values in an array, and find the one that corresponds to a given cube state using table[cubeToIndex(cubeState)].... I'm going to modify the implementation to store cube-state in the lookup tables as strings. A single cube can be stored in a minimum of 7 characters in javascript.
A string with 10^7 characters (all '.'), on the other hand, uses only one byte per character.
I'll be really impressed if you find anything good that doesn't rely on precomputed tables. I haven't given it much thought, but it just seems really hard/impossible.Another project I've been working on is finding a heuristic which provides an accurate measure of a cube state's distance from the solved state. A perfect heuristic should lead to an optimal solver which runs in linear time. I've had some ideas and limited success, but I've as yet found nothing good enough for a direct route to the solution.
Cride5 and Stefan would probably be interested in this, and I hope Jeremy doesn't mind me linking to it.
Jeremy wrote a 3x3x3 RSS hack at the beginning of October. Problem is, he never got it to be fully cross-browser (essentially Chrome, FF, Safari, IE - both on Windows and Mac).
(This was supposed to work better, but fails for me.)
And, once again, the actual memory usage can be more than 10 times that. Try it yourself.Still, the values stored in the move tables are natural numbers with ranges significantly lower than is justified by using 64-bit numbers.
You're right, from the ECMAScript standard: "A string value is a member of the type String and is a finite ordered sequence of zero or more 16-bit unsigned integer values.". The implementation I tested is apparently from 2007, but it definitely used 8 bits.In js I'm quite sure 16-bits are used for each character, to allow for unicode.
And nothing else? Is Javascript on?I cant get the timer to do anything. It is a black screen that says begin.
And, once again, the actual memory usage can be more than 10 times that. Try it yourself.Still, the values stored in the move tables are natural numbers with ranges significantly lower than is justified by using 64-bit numbers.