电子生涯 游戏汉诺塔源代码

小说:电子生涯 作者:范含 更新时间:2024-08-06 07:17:23 源网站:顶点小说
  focalдbasicfortran

  01.01chanoibydec

  01.02cfromprogramminglanguages

  01.03clastchange:8/7/71

  01.04

  01.05cthisprogramworkswiththetowersofhanoiproblem.

  01.06cyouaregiventhreetowerswithvarioussizeddiscson

  01.07coneofthem.theobjectistoplaceallthediscson

  01.08canothertoweronatatime,withthestipulationthata

  01.09clargerdiscmayneverbeontopofasmallerone.this

  01.10cprogramisgoodforanynumberofdiscsandcanberun

  01.11ceitherinmanual(youtellitwheretomove)orautomatic

  01.12cmode.itwillalsoexplainitsmovesordrawtheforyou,

  01.13cdependingonhowyouanswerthemovesorplotsquestion.

  01.14c**outdiscisthedisc(1ontop)thatyouwanttomove

  01.15c**indiscistheposition(1ontop)whereyoumoveto

  01.16c**outtoweristhetower(1onleft)fromwhichyoumove

  01.17c**intoweristhetower(3onright)youmoveto

  01.18cthisprogramassumesnocheating,anddoesnotcheckforit.

  01.19

  01.29e

  01.30a"no.ofdisks"n,!

  01.40fi=1,n;sss(i)=i

  01.50sso=1;ssi=3

  01.60sno=n;sni=n;si=0

  01.70a"movesorplots",move,!

  01.80i(fabs(mo-0moves)),1.85;d23

  01.85a"autoormanual",a,!

  01.90i(fabs(a-0manual)),5.1;d2;t!!"done!",!!;q

  02.20i[ss<(so-1)*n no-1>]er,2.95

  02.30si=i 1;sno(i)=no;sso(i)=so;ssi(i)=si

  02.50ssi=6-so-si;sno=no-1;d3;ste(i)=ni;d2

  02.60ssi=si(i);sno=no 1;d3;d6

  02.70sso=6-so-si;sno=te(i);d3;d2

  02.80ssi=si(i);sso=so(i);sno=no(i);si=i-1

  02.90r

  02.95d3;d6;r

  03.10sni=n

  03.20i[ss((si-1)*n ni)]er,3.3;sni=ni-1;g3.2

  03.30r

  05.10a&quot;out-disc:&quot;,no,&quot;tower:&quot;,so

  05.20a!&quot;in-disc:&quot;,ni,&quot;tower:&quot;,si,!;d6

  05.30sa=0

  05.40fi=1,n*2;sa=a ss(i)

  05.50i(-a)5.1;t!&quot;welldone!&quot;!;q

  06.10sdo=(so-1)*n no

  06.20sdi=(si-1)*n ni

  06.30sss(di)=ss(do)

  06.40sss(do)=0

  06.50i(move)er,6.7;d23;r

  06.70t!%2,so,no,!si,ni,!

  23.10fj=1,n;t!;fk=0,70;d23.3

  23.20t!!!!;r

  23.30i[k-15 ss(j)*2]23.6;i(-k 15 ss(j)*2)23.6;t&quot;#

  23.60i(k-35 ss(j n)*2)23.7;i(-k 35 ss(j n)*2)23.7;t&quot;#

  23.70i(k-55 ss(j n n)*2)23.8;i(-k 55 ss(j n n)*2)23.77;t&quot;#

  23.77sk=100;r

  23.80t&quot;&quot;
为更好的阅读体验,本站章节内容基于百度转码进行转码展示,如有问题请您到源站阅读, 转码声明
八零电子书邀请您进入最专业的小说搜索网站阅读电子生涯,电子生涯最新章节,电子生涯 顶点小说!
可以使用回车、←→快捷键阅读
本站根据您的指令搜索各大小说站得到的链接列表,与本站立场无关
如果版权人认为在本站放置您的作品有损您的利益,请发邮件至,本站确认后将会立即删除。
Copyright©2018 八零电子书