-
农夫过河问题
农夫过河问题,用C++做
一个农夫带着—只狼、一只羊和—棵白菜,身处河的南岸。他要把这些东西全部运到北岸。他面前只有一条小船,船只能容下他和—件物品,另外只有农夫才能撑船。如果农夫在场,则狼不能吃羊,羊不能吃白菜,否则狼会吃羊,羊会吃白菜,所以农夫不能留下羊和白菜自己离开,也不能留下狼和羊自己离开,而狼不吃白菜。请求出农夫将所有的东西运过河的方案。
实现上述求解的搜索过程可以采用两种不同的策略:一种广度优先搜索,另一种深度优先搜索。这里介绍在广度优先搜索方法中采用的数据结构设计。
用状态表,程序应在屏幕上得到如表3所示的结果。
表3 测试结果
步骤 状态
南岸 北岸
0 农夫 狼 羊 白菜
1 狼 白菜 农夫 羊
2 狼 农夫 白菜 羊
3 农夫 狼 羊 白菜
4 羊 农夫 狼 白菜
5 农夫 羊 狼 白菜
6 农夫 狼 羊 白菜
- 2022-01-21 03:55:16下载
- 积分:1
-
Qt 中国象棋源码;简单人机博弈算法实现和实现socket网络对战
Qt5.8实现的中国象棋源码;可实现和电脑对战和网络对战版本
- 2022-01-21 19:22:31下载
- 积分:1
-
MEDIcal
VTK. This program reads a volume dataset,extracts an isosurface that
represents the skin and displays it.
- 2010-05-02 00:28:38下载
- 积分:1
-
hardware
在proteus中关于单片机的编程的例程(In proteus about microcontroller programming routines)
- 2013-11-14 16:18:25下载
- 积分:1
-
STM32-Software-simulation-I2C
基于STM32微处理器的软件模拟IIC 实现IIC总线通信(Software simulation I2C program using STM32)
- 2014-09-18 13:35:21下载
- 积分:1
-
wavelet-wavelep-filter
本程序实现小波和小波包滤波,,对高频部分进行处理对一维信号进行处理,得到重构去噪后的信号,代码调试通过(This procedure realize wavelet and wavelet packet filtering, and the high frequency part of the process of one dimensional signal processing, reconstruction after denoising signal, code debugging through)
- 2016-01-20 13:52:07下载
- 积分:1
-
Simplex method for linear programming
线性规划中的单纯形法的c实现,代码有测试类,(Simplex method for linear programming)
- 2017-08-25 11:03:43下载
- 积分:1
-
vxWorks实例开发:飞控代码源码
本程序为vxWorks飞控代码源码
- 2020-04-02下载
- 积分:1
-
LPLD_PWM
Kinetis_K60底层驱动开发包PWM部分开发,有助于此开发板的底层开发(Kinetis_K60 underlying driver development kit PWM part of the development, contribute to the bottom of this development board development)
- 2013-09-18 09:22:20下载
- 积分:1
-
21ic下载_msp430舵机测试程序
说明: 控制舵机,转动方向转动角度,控制舵机,转动方向(Two algorithms by comparing the experimental data, we can see that the speed of conventional PID control, PID control combined with fuzzy steering gear, whether in terms of reliability or speed are more outstanding)
- 2020-06-18 07:20:01下载
- 积分:1