Scratch汉诺塔创意编程源程序 汉若塔:由4-8个不同积木块和3根柱子组成 游戏规则: 1、一次只能移一个积木(柱子最上面) 2、积木只能在三个柱子上存放 3、任何时刻不允许大的压小的 案例完美的诠释了什么是汉诺塔游戏,非常生动形象的进行了展示 完整的视频可以查看:https://www.bilibili.com/video/BV11P411V7GX/?vd_source=ecba593ad849be62c0c7d642db53eaad 更多Scratch资源可以关注:https://blog.csdn.net/frank2102
汉诺塔C++
2022-10-30 14:06:08 252B c++
1
用VB编写的简单汉诺塔程序 Private Sub cmdStart_Click() n = Int(Text1.Text) ReDim Data(1 To n, 1 To 3) For i = 1 To n For j = 1 To 3 Data(i, j) = 0 Next j Next i For i = 1 To n Data(i, 1) = i Next i ColNow = 1 SelNum = 0 Call ShowPic End Sub Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) Select Case KeyCode Case vbKeyUp If SelNum = 0 Then SelNum = Data(1, ColNow): Call Pop Case vbKeyDown If SelNum <> 0 Then If Push = True Then SelNum = 0 If Data(n, 3) = n Then Call ShowPic: MsgBox "恭喜你通过!", vbOKOnly, "Pass" End If Case vbKeyLeft ColNow = ColNow - 1 If ColNow < 1 Then ColNow = 1 Case vbKeyRight ColNow = ColNow + 1 If ColNow > 3 Then ColNow = 3 End Select Call ShowPic End Sub
2022-09-28 12:44:11 11KB vb 汉诺塔
1
用于学习帮助,汉诺塔非递归演算程序代码 使用C语言编写的。供大家学习参考,希望能派上用场。
2022-09-24 23:38:51 1KB 程序
1
无论是用何种语言实现汉诺塔问题,其求解问题的核心算法和步骤还是大致相同的,下面总结了分别用JAVA/Python/C++ 实现汉诺塔问题的求解过程的代码和显示效果,可以体会一下不同语言下求解汉诺塔问题风格,下面我们来一起看一下吧。 C++实现汉诺塔问题求解 #include using namespace std; void move(char start,char end) { cout<<"move"<<start<<"to"<<end<<endl; } void hanoi(int n,char first,char second,char third) { if(n==
2022-09-20 10:00:42 55KB 汉诺塔
1
儿童编程源码Scratch趣味小游戏源码集合,Scratch汉诺塔游戏源码,Scratch火柴人大战游戏源码,Scratch华容道游戏源码等。6个scratch小游戏源码,scratch小游戏合集,适合小朋友自学。新颖、有趣的游戏制作。喜欢学习scratch编程的大儿童们也可以自行下载学习参考哦,对自己学习scratch编程帮助很大。
1
关于汉诺塔运算流程的一些个人解析
2022-07-28 09:00:46 4.51MB 汉诺塔
1
这是一个关于汉诺塔的flash小游戏,适合做各种设计
2022-07-01 17:03:37 147KB flash 汉诺塔
import javax.swing.*; import java.awt.*; import java.awt.event.*; public class HannoiWindow extends JFrame implements ActionListener{ Tower tower=null; int amountOfDisc=3; char []towerName={'A','B','C'}; JMenuBar bar; JMenu menuGrade; JMenuItem oneGradeItem,twoGradeItem,threeGradeItem; JButton renew=null; JButton autoButton=null; JPanel center=new JPanel(); HannoiWindow(){ tower=new Tower(towerName); tower.setAmountOfDisc(amountOfDisc); tower.setMaxDiscWidth(120); tower.setMinDiscWidth(50); tower.setDiscHeight(16); tower.putDiscOnTower(); add(tower,BorderLayout.CENTER); bar=new JMenuBar(); menuGrade=new JMenu("选择级别"); oneGradeItem=new JMenuItem("初级"); twoGradeItem=new JMenuItem("中级"); threeGradeItem=new JMenuItem("高级"); menuGrade.add(oneGradeItem); menuGrade.add(twoGradeItem); menuGrade.add(threeGradeItem); bar.add(menuGrade); setJMenuBar(bar); oneGradeItem.addActionListener(this); twoGradeItem.addActionListener(this); threeGradeItem.addActionListener(this); renew=new JButton("重新开始"); renew.addActionListener(this); autoButton=new JButton("自动演示"); autoButton.addActionListener(this); JPanel north=new JPanel(); north.add(renew); north.add(autoButton); String mess="将全部盘子从"+towerName[0]+"座搬运到"+towerName[1]+ "座或"+towerName[2]+"座"; JLabel hintMess=new JLabel(mess,JLabel.CENTER); north.add(hintMess); add(north,BorderLayout.NORTH); setResizable(false); setVisible(true); setBounds(60,60,460,410); validate(); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public void actionPerformed(ActionEvent e){ if(e.getSource()==oneGradeItem){ amountOfDisc=3; tower.setAmountOfDisc(amountOfDisc); tower.putDiscOnTower(); } else if(e.getSource()==twoGradeItem){ amountOfDisc=4; tower.setAmountOfDisc(amountOfDisc); tower.putDiscOnTower(); } else if(e.getSource()==threeGradeItem){ amountOfDisc=5; tower.setAmountOfDisc(amountOfDisc); tower.putDiscOnTower(); } else if(e.getSource()==renew){ tower.setAmountOfDisc(amountOfDisc); tower.putDiscOnTower(); } else if(e.getSource()==autoButton){ tower.setAmountOfDisc(amountOfDisc); tower.putDiscOnTower(); int x=this.getBounds().x+this.getBounds().width; int y=this.getBounds().y; tower.getAutoMoveDisc().setLocation(x,y); tower.getAutoMoveDisc().setSize(280,this.getBounds().height); tower.getAutoMoveDisc().setVisible(true); } validate(); } public static void main(String args[]){ new HannoiWindow(); } }
2022-06-29 14:58:39 3KB java 汉诺塔
1
数据结构常见问题:12单元18 汉诺塔问题.doc
2022-06-26 21:07:30 34KB 数据结构