<P>我这里有一个Mathematica实现的方法<BR>你自己去改成matlab的吧,我没那么多时间<BR><BR>a[1]={0,0}; a[2]={0,1}; a[3]={0,2}; a[4]={0,3}; a[5]={3,0}; <BR>a[6]={3,1}; a[7]={3,2}; a[8]={3,3}; a[9]={1,1}; a[10]={2,2}; <BR>d[1]={0,2}; d[2]={2,0}; d[3]={1,1}; d[4]={0,1}; <BR>d[5]={1,0}; i=1; j=1; k=1; s[0]=s[1]={3, 3};<BR>Print[" 南岸 ---- 船上 ----北岸 "]<BR>Do[<BR> Do[s[i + 1] = s + (-1)^i*d[j];<BR> t = 0;<BR> Do[If[s[i + 1] == a[k], t = 1], {k, 1, 10}];<BR> If[t == 0, Continue[]];<BR> 1 == Mod[i + 1, 2]; m = 1; u = 0;<BR> If[i + 1 >= 3,<BR> Do[If[s[i + 1] == s[m], u = 1; Break[]], {m, 1, i - 1, 2}]];<BR> If[u == 0, c[i + 1] = d[j]; Break[]], {j, 1, 5}];<BR> If[t == 0, Print[No Result]; Break[]];<BR> b[i + 1] = {3, 3} - s[i + 1];<BR> Print[s, "----", c[i + 1], "----", b[i + 1]];<BR>If[s[i + 1] == {0, 0}, Break[]], <BR>{i, 1, 12}]</P> |