贪吃蛇*要点分析: *1)数据结构:matrix[][]用来存储地图上面的信息,如果什么也没有设置为false, * 如果有食物或蛇,设置为true;nodeArray,一个LinkedList,用来保存蛇的每 * 一节;food用来保存食物的位置;而Node类是保存每个位置的信息。 *2)重要函数: * changeDirection(int newDirection) ,用来改变蛇前进的方向,而且只是 * 保存头部的前进方向,因为其他的前进方向已经用位置来指明了。 其中newDirection * 必须和原来的direction不是相反方向,所以相反方向的值用了同样的奇偶性。在测试 * 的时候使用了direction%2!=newDirection%2 进行判断。 * moveOn(),用来更新蛇的位置,对于当前方向,把头部位置进行相应改变。如果越界, * 结束;否则,检测是否遇到食物(加头部)或身体(结束);如果什么都没有,加上头部, * 去掉尾部。由于用了LinkedList数据结构,省去了相当多的麻烦。
上传时间: 2014-06-14
上传用户:cjf0304
ACM Programming contest activity at Stony Brook is sponsored by a grant from Salomon Smith Barney. In the 2002 Greater New York Regional, Stony Brook s teams finished 2nd and 5th with 54 teams competing! In the 2003 Greater New York Regional, Stony Brook finished 4th of 60 teams. In the 2004 Greater New York Regional, three of Stony Brook s teams finished in the top 15 positions!
标签: Programming sponsored activity contest
上传时间: 2013-12-13
上传用户:wff
用VC和SQL Server开发的固定资产管理系统,包括系统信息管理,固定资产管理和统计查询管理三个大模块-VC and SQL Server development of the fixed asset management system, including system information management, fixed asset management and statistics for the three management module
上传时间: 2016-06-29
上传用户:SimonQQ
Run the SQL script given to you to create a Library database. Note that each row in the Book table denotes a book copy. Thus, if the library carries three copies of the title "DBMS", there will be three rows in the Book table, one for each copy. Write the SQL statements to do the following against the database
标签: the database Library script
上传时间: 2014-08-29
上传用户:nanxia
看n2实例 #Create a simulator object set ns [new Simulator] #Define different colors for data flows #$ns color 1 Blue #$ns color 2 Red #Open the nam trace file set nf [open out-1.nam w] $ns namtrace-all $nf set f0 [open out0.tr w] set f1 [open out1.tr w] #Define a finish procedure proc finish {} { global ns nf $ns flush-trace #Close the trace file close $nf #Execute nam on the trace file exit 0 } #Create four nodes set n0 [$ns node] set n1 [$ns node] set n2 [$ns node] set n3 [$ns node] #Create links between the nodes $ns duplex-link $n0 $n2 1Mb 10ms
标签: simulator Simulator different Create
上传时间: 2016-07-02
上传用户:wfl_yy
我所采用的内存管理思想是链表管理思想,内存分配方案是最佳适应方案(best fit)。其主要的数据结构为 struct node { char* p int memosize int flag struct node* next } 这是一个链表的结点的数据结构,用它来管理内存的分配与回收。P 表示所指的分配的内存的首地址,memosize 表示分配的内存块的大小,flag 为一个标志量,表示内存块是否被占用。用 1 和 0 来表示被占用和不被占用。next 表示下一个结点的首地址。 内存管理包括一个分配内存的mm_request(unsigned int)函数,一个初始化所要管理的内存的mm_init()函数,一个空闲列表排序函数sort(),一个释放内存的mm_release(void* )函数和一个判断内存是否被占用的IsFree(int)函数。
标签: 内存管理
上传时间: 2016-07-06
上传用户:qunquan
300 km 传输线和功率补偿仿真 The circuit below represents an equivalent power system feeding a 300 km transmission line. The line is compensated by a shunt inductor at its receiving end. A circuit breaker allows energizing and de-energizing of the line. To simplify matters, only one of the three phases is represented. The parameters shown in the figure are typical of a 735 kV power system.
标签: equivalent represents 300 transmis
上传时间: 2016-07-14
上传用户:15736969615
While resting-state fMRI is drawing more and more attention, there has not been a software for its data analysis. Based on MATLAB, we developed a package named REST. Currently REST has three main functions: function connectivity, ReHo and ALFF.
标签: more resting-state attention software
上传时间: 2016-07-19
上传用户:cmc_68289287
ThreeColorFlags问题最早由E.W.Dijkstra所提出,塔所使用的用语为Dutch Nation Flag(Dijkstra为荷兰人),而多数的作者则使用Three-Color Flag来说明。 假设有一条绳子,上面有红,白,蓝三种颜色的旗子,起初绳子上的旗子颜色并没有顺序,您希望将之分类,并排列蓝,白,红的顺序,要如何移动次数才会最少,注意您只能在绳子上进行这个动作,而且一次只能调换两个旗子。
上传时间: 2016-07-30
上传用户:zhangyi99104144
操作系统课程设计_进程调度演示源程序 #include "stdio.h" #include "stdlib.h" #include "string.h" typedef struct node { char name[10] /*进程标识符*/ int prio /*进程优先数*/ int round /*进程时间轮转时间片*/ int cputime /*进程占用CPU时间*/ int needtime /*进程到完成还要的时间*/ int count /*计数器*/ char state /*进程的状态*/ struct node *next /*链指针*/ }PCB
标签: include typedef stdlib string
上传时间: 2016-08-09
上传用户:凤临西北