Debug: document.doctype.publicId = , typeof Worker = . Options: autoversion
Caution: This demonstration is for the enlightenment of the wise rather than the obedience of the un-enlightened. Things may be easier if you have have read my CREGJ articles on Gray codes and studied the Javascript that is running here. Essentially, this demo was written primarily for my own use.
There are no (essential) server-side scripts, only this HTML file, plus CSS and JS files, so the files can be downloaded and run locally, and you can edit the JavaScript file to suit. (Clearly you will need some knowledge of how to download and edit the files that comprise a web page). WARNING: As this is development code, it might not be fully functional (I might have left it in a non-working state), so you are advised to enable your browser's JS console so that you are warned of all errors.
Note: for N > 7 this program needs to run for many hours, and perform > 1E9 iterations. For $N = 19 the necklace search alone takes 10s, doubling (or worse) for each value of N above that.Show More...
Set the parameters below. Further options are available by editing the JS file.
First, the program searches for and lists all the necklace codes. Next, it tries to assemble the necklace codes into a valid Gray code. Currently, although it reports each result, it only lists the Gray codes for the longest predicted sequence. You can ask the program to halt after it has found a certain number of sequences.
For a necklace code of length N, Gray codes are multiples of 2N not exceeding 2^N (and there are other restrictions). To generate only the necklace codes, set the iterations to zero, as the iteration count applies only to the Gray code search.
/pub/cregj/more/j118/gray_code_demo.html, last modified Tue, 27 Sep 2022 16:12:23 +0100. Server: britiac4.british-caving.org.uk (31.25.186.126)