Ok, here is the code I started with (652), the first 3 'For' loops create the 'Key' to shifting the marbles then the rest shifts them around.
The 'Key' that is created for the input of 1, 2 and 3 is:
W1 B2 W1
W1 B2 B1 W2 W2 B1 B2 W1
W1 B2 B1 W2 W2 W1 B2 B2 B2 W1 W2 W2 B1 B2 W1
The W and B refer to the color to be moved and the number 1 means move the marble 1 space and 2 means jump the marble next to it (move 2 spaces).
White marbles will always move right and Black will always move left, so no need for a direction.
Code:
Function s($z)
Dim $a,$b,$c,$d,$e,$f,$g,$h,$i
$b=' '
$c=$z
$d=$c
For $a=1 to $z
$b='W'+$b+'B'
$d=''+$c+' '+$d+' '+$c+''
$c=$c-1
$h=$h+'2 '
Next
$d=Split($d)
$c=$z-1
For $a=1 to $z
$h='1 '+$h+'1 '
For $f = 1 to $c
$h='2 '+$h+'2 '
Next
$c=$c-1
Next
$h=Split(Trim($h))
$a=1
For Each $c in $d
For $f = 1 to $c
$e=IIf($a mod 2,'B','W')
$g=$g+$e+$h[$i]+' '
$i=$i+1
Next
$a=$a+1
Next
$d=Split(Trim($g))
ReDim $g[UBound($d)+1]
$g[0]=$b
$a=1
For Each $c in $d
$f=Split($b)[0]
$h=Split($b)[1]
$e=Right($c,1)
$b=IIf(Left($c,1)='W',
IIf($e=1,SubStr($f,1,Len($f)-1)+' W',SubStr($f,1,Len($f)-2)+
' '+Right($f,1)+'W')+$h,$f+
IIf($e=1,'B '+SubStr($h,2,Len($h)-1),'B'+Left($h,1)
+' '+SubStr($h,3,Len($h)-2)))
$g[$a]=$b
$a=$a+1
;Next
$s=$g
EndFunction
Then I changed the to this process (412), the idea is to shift marbles based on the color of the two marbles to the left and right of the center space.
Code:
Function s($z)
Dim $a,$,$c,$d,$e,$f,$g,$h[1],$i
$=' '
$c=' '
For $a=1 to $z
$='W'+$+'B'
$c='B'+$c+'W'
Next
$h[0]=$
Do
$=Split($)
$d=$[0] ;Left
$e=$[1] ;Right
$f=Right($d,2) ;Right chrs of Left Half
$g=Left($e,2) ;Left chrs of Right Half
Select
Case $f='WB'
$=Left($d,Len($d)-2)+' BW'+$e
Case $g='WB'
$=$d+'BW '+Right($e,Len($e)-2)
Case Not($f='W' Or $f='WW') And Left($g,1)='B'
$=$d+'B '+Right($e,Len($e)-1)
Case 1
$=Left($d,Len($d)-1)+' W'+$e
EndSelect
$i=$i+1
ReDim preserve $h[$i]
$h[$i]=$
Until $=$c
$s=$h
EndFunction