博文

汇编通讯录系统[代码](2007-01-04 11:14:00)

摘要:                 汇编课程设计报告         题目: 通讯录系统             姓名: 何xx    学号: 2004xx       班级:计科04-x        指导老师: 郑xx         1.1   设计要求. 题目要求设计一个通讯录管理系统.需要具有以下功能和模块. (1) 输入模块: 输入新的通讯条目,包括:姓名,性别,电话,E-mail,通讯地址,邮编,QQ号 (2) 删除模块: 删除功能. (3) 查询模块: 查询,输入姓名可以查询该人其他信息. (4) 修改模块: 修改某一条记录. (5) 存储模块(附加功能,可以不完成): 能够将输入的信息存储到硬盘文件;并能读入存储在该文件中的信息. 1.2   环境. 软件: windows xp, masm 6.x, notepad 硬件: PC 1.3   分析,设计思想. 看到题目,感觉就像是个简单的数据库系统.支持数据的增/删/查/改操作.具有应用价值.在数据库系统中,数据是以数据库文件的形式存在.通过访问/操作数据库中的表或表中的字段,获取我们想要的信息. 本系统可以归结为4个功能: select, insert, update,delete. 在这里不可能建立一张数据表来维护这种关系型数据.必须要借助汇编中的结构类型.定义一个结构数组,用来维护数据条目及信息的处理. 如图: 修改和删除操作都要依赖查询功能. 故把整个程序分为4个模块是比较明智的. 1.4   模块说明 由于变量较多,故没有采用多模块设计方案. 几个功能分别在6个子过程中完成. (1)    In......

阅读全文(8801) | 评论:3

汇编冒泡排序算法(2006-12-11 14:11:00)

摘要:dseg segment    Array dw 10,9,8,7,6,5,4 dup(8)   Len = ($-Array)/2   addr dw ?dseg ends cseg segment   assume cs:cseg,ds:dseg  start:   mov ax,dseg   mov ds,ax      mov cx,Len-1   mov di,0   mov si,Len begin:   dec si    mov di,0   again:      mov bx,di      shl bx,1      mov ax,word ptr Array[bx]      inc di      cmp ax,Array[bx+2]      jna next      xchg ax,Array[bx+2]      mov Array[bx],ax     next:      cmp di,si      jb again         loop begin          mov ah,4ch     int 21h&nb......

阅读全文(10665) | 评论:8

简单五子棋人机对弈(19×19)二(2006-06-29 10:43:00)

摘要:上一页 8.void robot() 也是人机对弈五子棋最核心的部分,其中包括了评价机制,估值,搜索部分 搜索空格的八个方向,如:                         1       0      2   7      空格    3   6       5      4   最后将权值最大的几个点的位置信息保存于xposition[]与yposition[]数组中,如果极值权重相同,使用随机函数选择其中一点下棋。 void robot(void) {     int x, y, X, Y, i, j;     int *p, *mp;  //用于指向特定数组     long int xposition[38], yposition[38];  //存储相同得权值     long int max;  //当前最大权值 //将空格信息填入特定数组,用于bot评分并下子,将 360 度分成 8 个方向 //即同一个空格可能五子相连的八个方向,具体看 readme 文件     for( X = 0; X < 19; X++)   //0方向检查         for( Y = 18; Y > 4; Y--)       &nb......

阅读全文(5260) | 评论:0

简单五子棋人机对弈(19×19)一(2006-06-29 10:39:00)

摘要:【概述】五子棋是一种大众喜爱的游戏,其规则简单,变化多端,非常富有趣味性何消遣性。这里设计了一个简单的五子棋程序,采用对空格点进行评分排序的算法。 近来随着计算机的快速发展,各种棋类游戏被纷纷请进了电脑,使得那些喜爱下棋,又常常苦于没有对手的棋迷们能随时过足棋瘾。而且这类软件个个水平颇高,大有与人脑分庭抗礼之势。其中战胜过国际象棋世界冠军-卡斯帕罗夫的“深蓝”便是最具说服力的代表;其它像围棋的“手淡”、象棋的“将族”等也以其优秀的人工智能深受棋迷喜爱;而我也做了一个“无比”简单的五子棋算法。  总的来说(我们假定您熟悉五子棋的基本规则),要让电脑知道该在哪一点下子,就要根据盘面的形势,为每一可能落子的点计算其重要程度,也就是当这子落下后会形成什么棋型(如:“冲四”、“活三”等),然后通览全盘选出最重要的一点,这便是最基本的算法。 主程序模块包括:数据结构,评分规则,胜负判断,搜索最优空格的算法过程。 【关键字】人工智能,博弈树,五子棋,无禁手,评分,搜索,C,随机。 【环境】XP/TC3.0 【算法及解析】(无禁手) 一.   数据结构: 本程序中只使用了一个19×19的二元结构数组如下定义: Typedef  Struct {     int     player;             int     value[8][5];             long int  score;        }map[19][19]; 其中map[i][j]保存i行j列棋子信息,player为下棋方,value数组记录八个方向的连续5个棋子的信息,为以后评分服务。Score为空格评分。 以及数据结构可以满足初级人机对弈程序的功用。 对比其他程序结构: 王小春五子棋源码:该程序采用......

阅读全文(7570) | 评论:4

【转】五子棋人机对弈(C++)算法理解(2006-05-29 08:35:00)

摘要:五子棋是一种受大众广泛喜爱的游戏,其规则简单,变化多端,非常富有趣味性和消遣性。这里设计和实现了一个人机对下的五子棋程序,采用了博弈树的方法,应用了剪枝和最大最小树原理进行搜索发现最好的下子位置。介绍五子棋程序的数据结构、评分规则、胜负判断方法和搜索算法过程。 一、相关的数据结构   关于盘面情况的表示,以链表形式表示当前盘面的情况,目的是可以允许用户进行悔棋、回退等操作。   CList StepList;   其中Step结构的表示为:   struct Step   {    int m; //m,n表示两个坐标值    int n;    char side; //side表示下子方   }; 以数组形式保存当前盘面的情况, 目的是为了在显示当前盘面情况时使用:  char FiveArea[FIVE_MAX_LINE][FIVE_MAX_LINE];   其中FIVE_MAX_LINE表示盘面最大的行数。   同时由于需要在递归搜索的过程中考虑时间和空间有效性,只找出就当前情况来说相对比较好的几个盘面,而不是对所有的可下子的位置都进行搜索,这里用变量CountList来表示当前搜索中可以选择的所有新的盘面情况对象的集合:  CList CountList;   其中类CBoardSituiton为:  class CBoardSituation  {  CList StepList; //每一步的列表  char FiveArea[FIVE_MAX_LINE][FIVE_MAX_LINE];  struct Step machineStep;  //机器所下的那一步  double value; //该种盘面状态所得到的分数 } 二、评分规则   对于下子的重要性评分,需要从六个位置来考虑当前棋局的情况,分别为:-,¦,......

阅读全文(8703) | 评论:2

八皇后问题(C++)(2006-05-23 15:58:00)

摘要://autor:baker//email:baker1203@sina.com//course designing for data structure and c++ programming//time:23/5/06/*   discription:             place eight quenes onto a chessborad of 8*8 standard,if only that case take place.any one quene can not attack others   requiring:             1.output all feasible schemes     2.best of all,you can print the chessboard by graphic delineation,and play the progress dynamic    3.you programme can put into other chessboard.    */ #include"iostream.h"#include"conio.h"#include"graphics.h"#include"dos.h"#include"stdio.h"#include"stdlib.h"#define QUENE 8 int num; class quene{      public:             void addnew(int);             vo......

阅读全文(8551) | 评论:1

求树(森林)的高度(2006-04-29 11:07:00)

摘要:    简明算法:   int heigth(tree t) { if(t==NULL) return 0;   else return max(heigth(t->fistson)+1,heigth(t->nextbrother)); }......

阅读全文(4924) | 评论:0

计算几何算法实现-任意多边形的面积(2006-04-27 21:21:00)

摘要://time:  4.27 night   description: AREA Jerry, a middle school student, addicts himself to mathematical research. Maybe the problems he has thought are really too easy to an expert. But as an amateur, especially as a 15-year-old boy, he had done very well. He is so rolling in thinking the mathematical problem that he is easily to try to solve every problem he met in a mathematical way. One day, he found a piece of paper on the desk. His younger sister, Mary, a four-year-old girl, had drawn some lines. But those lines formed a special kind of concave polygon by accident as Fig. 1 shows. Fig. 1 The lines his sister had drawn "Great!" he thought, "The polygon seems so regular. I had just learned how to calculate the area of triangle, rectangle and circle. I'm sure I can find out how to calculate the area of this figure." And so he did. First of all, he marked the vertexes in the polygon with their coordinates as Fig. 2 shows. And then he found the result--0.75 effortless. ......

阅读全文(5913) | 评论:0

常微分方程数值解法 之 改进欧拉方法(2006-04-23 10:40:00)

摘要:// 改进欧拉方法 比常规欧拉方法 和梯形公式具有更高精度,也称为预测-校正算法 //时间   4.23  上午   //  f(x,y)=x-2*x/y // y(0)=1 #include"stdio.h"#include"iostream"#include"conio.h" using namespace std; double x0,x1,y0,y1; class mend_euler{      public:             mend_euler(double h,int n);             double f(double x,double y);                   private:              double h;              int n;                    }; mend_euler::mend_euler(double a,int b){   int i=1;    h=a;    n=b;    ......

阅读全文(8120) | 评论:2

guass-seidel算法程序实例(2006-04-20 10:31:00)

摘要://完成 时间:4.17 晚  7点     #include"stdio.h"#include"iostream"#include"conio.h"#include"math.h" using namespace std;                     int n;            // GUASSµü´úµÄ¹æÄ£               double e;                  double a[4][4]={{0,0,0,0},{0,10,-1,-2},{0,-1,10,-2},{0,-1,-1,5}};              double b[4]={0,7.2,8.3,4.2};     double x[4];     double y[4]; double max(){ double s=0.0000000000; for(int i=1;i<=3;i++)  if(fabs(x[i]-y[i])>s)s=fabs(x[i]-y[i]); return s;} void display(){ cout<<endl; for(......

阅读全文(4685) | 评论:0