If this is the script you are talking about you need to use J6 http://www.jsoftware.com/jwiki/Scripts/1D%20Rubik%27s%20Cube
2011/10/20 David Vaughan <[email protected]> > I saw a script for a 1D Rubik's cube on the wiki but I couldn't run it - I > seem to be missing the appropriate files - so I decided to write my own one > to be used in the browser. I am trying to allow you to see the move you've > made or choose not to see it. The idea is that: > > 0 move 1 > > moves the cube but doesn't show you while: > > 1 move 1 > 1 5 4 3 2 6 > > The default is 1 (based on my understanding of 1&$:). > > move=: 1&$: : (4 :0) NB. x is 0 > or 1 to show cube > select. y > case. 0 do. > cube=: (_2{. cube) ,~ |. (2-~#cube) {. cube NB. rotate > first section > case. 1 do. > cube=: ({:cube) ,~ ({.cube) , |. (2-~#cube) {. }.cube NB. rotate > middle section > case. 2 do. > cube=: (2{. cube) , |. (-2-~#cube) {. cube NB. rotate > end section > end. > if. x=1 do. cube end. NB. display > cube > ) > > The main reason I want to do this is so that my shuffle verb can shuffle > the row without displaying every move its made - only showing the last: > > shuffle=: 3 :'(((y-1)$0),1) move"0 ] 3|?~y' > > It would seem that in the case statements, whenever anything is assigned, > it is also displayed - can this be avoided? Also I would appreciate it if > anyone could clarify how the $: works here (I copied the idea from a verb > somewhere in the wiki). > > Thanks. > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > -- Björn Helgason, Verkfræðingur Fornustekkum II 781 Hornafirði, t-póst: [email protected] gsm: +3546985532 twitter: @flugfiskur http://groups.google.com/group/J-Programming Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans góður kennari getur stigið á tær án þess að glansinn fari af skónum /|_ .-----------------------------------. ,' .\ / | Með léttri lund verður | ,--' _,' | Dagurinn í dag | / / | Enn betri en gærdagurinn | ( -. | `-----------------------------------' | ) | (\_ _/) (`-. '--.) (='.'=) ♖♘♗♕♔♙ `. )----' (")_(") ☃☠ ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
