新建
上传
首页
助手
最?/div>
资料?/div>
工具

把数码问题就是把一串数字变成下面这个样?/p>

: 

1 

 

2 

 

3 

8 

 

0 

 

4 

 

 

7 

 

6 

 

5 

实现方法

 

 

1. 

过程表示

 

源代码:

 

#include<stdio.h> 

static int style[9]={1,2,3,6,7,4,5,8,0};//

输入的数?/p>

 

 

//2,5,4,3,0,7,1,8,6 

 

 

3,2,1,8,0,4,7,6,5 

 

1,0,4,2,7,3,8,5,6 

 

 

1,0,3,8,2,4,7,6,5 

 

static int arrayStep41[6]={5,4,3,6,7,8};//

第四步和第六步共用的数组,所以设为全局?/p>

 

static int arrayStep71[4]={3,6,7,4}; 

static int local;//

空格的位?/p>

 

int i,j;//

所用到的变?/p>

 

int number=0;//

记录移动步数

 

void print(); 

void step1(); 

void step2(); 

void step3(); 

void step4(); 

void step5(); 

void step6(); 

void step7(); 

void step8(); 

void step9(); 

void exchange(int x,int y); 

void judge(); 

void judge()//

判断空格位置

 

{ 

 

number = 0; 

 

for(i=0;i<9;i++) 

 

{ 

 

 

if(style[i]==0) 

 

 

{ 

 

 

 

local=i; 

 

 

 

return; 

 

 

} 

 

} 

} 

void exchange(int x,int y)//

交换两个?/p>

 

Ͼλ
新建
上传
首页
助手
最?/div>
资料?/div>
工具

把数码问题就是把一串数字变成下面这个样?/p>

: 

1 

 

2 

 

3 

8 

 

0 

 

4 

 

 

7 

 

6 

 

5 

实现方法

 

 

1. 

过程表示

 

源代码:

 

#include<stdio.h> 

static int style[9]={1,2,3,6,7,4,5,8,0};//

输入的数?/p>

 

 

//2,5,4,3,0,7,1,8,6 

 

 

3,2,1,8,0,4,7,6,5 

 

1,0,4,2,7,3,8,5,6 

 

 

1,0,3,8,2,4,7,6,5 

 

static int arrayStep41[6]={5,4,3,6,7,8};//

第四步和第六步共用的数组,所以设为全局?/p>

 

static int arrayStep71[4]={3,6,7,4}; 

static int local;//

空格的位?/p>

 

int i,j;//

所用到的变?/p>

 

int number=0;//

记录移动步数

 

void print(); 

void step1(); 

void step2(); 

void step3(); 

void step4(); 

void step5(); 

void step6(); 

void step7(); 

void step8(); 

void step9(); 

void exchange(int x,int y); 

void judge(); 

void judge()//

判断空格位置

 

{ 

 

number = 0; 

 

for(i=0;i<9;i++) 

 

{ 

 

 

if(style[i]==0) 

 

 

{ 

 

 

 

local=i; 

 

 

 

return; 

 

 

} 

 

} 

} 

void exchange(int x,int y)//

交换两个?/p>

 

">
新建
上传
首页
助手
最?/div>
资料?/div>
工具

把数码问题就是把一串数字变成下面这个样?/p>

: 

1 

 

2 

 

3 

8 

 

0 

 

4 

 

 

7 

 

6 

 

5 

实现方法

 

 

1. 

过程表示

 

源代码:

 

#include<stdio.h> 

static int style[9]={1,2,3,6,7,4,5,8,0};//

输入的数?/p>

 

 

//2,5,4,3,0,7,1,8,6 

 

 

3,2,1,8,0,4,7,6,5 

 

1,0,4,2,7,3,8,5,6 

 

 

1,0,3,8,2,4,7,6,5 

 

static int arrayStep41[6]={5,4,3,6,7,8};//

第四步和第六步共用的数组,所以设为全局?/p>

 

static int arrayStep71[4]={3,6,7,4}; 

static int local;//

空格的位?/p>

 

int i,j;//

所用到的变?/p>

 

int number=0;//

记录移动步数

 

void print(); 

void step1(); 

void step2(); 

void step3(); 

void step4(); 

void step5(); 

void step6(); 

void step7(); 

void step8(); 

void step9(); 

void exchange(int x,int y); 

void judge(); 

void judge()//

判断空格位置

 

{ 

 

number = 0; 

 

for(i=0;i<9;i++) 

 

{ 

 

 

if(style[i]==0) 

 

 

{ 

 

 

 

local=i; 

 

 

 

return; 

 

 

} 

 

} 

} 

void exchange(int x,int y)//

交换两个?/p>

 

Ͼλ">
Ͼλ
Ŀ

人工智能实验报告完整版八数码+验证 - 百度文库
新建
上传
首页
助手
最?/div>
资料?/div>
工具

把数码问题就是把一串数字变成下面这个样?/p>

: 

1 

 

2 

 

3 

8 

 

0 

 

4 

 

 

7 

 

6 

 

5 

实现方法

 

 

1. 

过程表示

 

源代码:

 

#include<stdio.h> 

static int style[9]={1,2,3,6,7,4,5,8,0};//

输入的数?/p>

 

 

//2,5,4,3,0,7,1,8,6 

 

 

3,2,1,8,0,4,7,6,5 

 

1,0,4,2,7,3,8,5,6 

 

 

1,0,3,8,2,4,7,6,5 

 

static int arrayStep41[6]={5,4,3,6,7,8};//

第四步和第六步共用的数组,所以设为全局?/p>

 

static int arrayStep71[4]={3,6,7,4}; 

static int local;//

空格的位?/p>

 

int i,j;//

所用到的变?/p>

 

int number=0;//

记录移动步数

 

void print(); 

void step1(); 

void step2(); 

void step3(); 

void step4(); 

void step5(); 

void step6(); 

void step7(); 

void step8(); 

void step9(); 

void exchange(int x,int y); 

void judge(); 

void judge()//

判断空格位置

 

{ 

 

number = 0; 

 

for(i=0;i<9;i++) 

 

{ 

 

 

if(style[i]==0) 

 

 

{ 

 

 

 

local=i; 

 

 

 

return; 

 

 

} 

 

} 

} 

void exchange(int x,int y)//

交换两个?/p>

 



ļ׺.doc޸Ϊ.docĶ

  • GMATʱ䲻ô죿СվdzƬʱ
  • SCI¼õһ
  • ڼеӢ
  • 꼶 Ľ̰ - ͼ
  • ˾Ҫǰõļ׼ÿһ(2015.1.16)
  • SCI¼õһ
  • ѧAϰ
  • 110KVվ ҵ ⱨ
  • Windows ۸ϰ
  • йִѧʮѧϰҪ

վ

԰ Ͼλ
ϵͷ779662525#qq.com(#滻Ϊ@)