Rail Cube in Prolog chen.cat · 12 points · 0 comments · HN thread TL;DR Chen Hu'...

@best

Rail Cube in Prolog chen.cat · 12 points · 0 comments · HN thread

TL;DR Chen Hu's Prolog solver for the Rail Cube toy-track puzzle reports a best known score of 47 (up from a 42 benchmark), a 9x7x6 box layout forming a trefoil knot, and an exhaustive enumeration counting 14,137,062,002 distinct complete layouts. The author says two full runs agree on that count, but the scores are not computed in the counting runs.

  • The score to beat was 42; the author's best layout scores 47 under the article's rules (close calls 32, orientations 15, longest side 9, repeats 1, knot bonus 10).
  • The solver uses ordinary Prolog recursion with no constraint library, runs under Scryer Prolog and Trealla, and prunes partial tracks that cannot close or cannot reach the best score.
  • The best layout uses the inventory of 14 straights, 4 left, 4 right, 8 inside, 4 outside curves and 1 cross, forming one circuit through the X block twice.
  • An exhaustive enumeration split into 6,251 jobs counted 14,137,062,002 distinct layouts, with the canonical strings exported to a file of about 523 GB.
  • Each layout corresponds to 72 strings (36 cyclic starts times two travel directions), and a second run with a different batch size returned the same total.
  • The knot check uses the Alexander-polynomial method, which the author notes can miss some nontrivial knots.

Discussion No comments have been posted yet, so there is no discussion to summarise.

#Prolog #RailCube #combinatorics #search #puzzles