2008 年文章归档
共 137 篇文章
被动——主动——被动,否定的否定……
最近发现,在这个引擎的使用上,越来越油滑了。 这个引擎是个好引擎,只可惜他不是用来做网游的,遇到种种效果很好,但是成本颇大的东西的时候,过去我们无所适从,现在,逐渐的,我们已经开始不满足于自己的命运,开始主动寻求改变了。 其实,作为本职工作,只需要说,“这东西完成不了这个功能”,就可以把责任抛到脑后,尽情地享受欢乐。每天费尽心思去改它,去改变很多,结果只不过是让回来作外包的时候疲惫交加,无所适从。数次因为无法按时按质完成而备受煎熬。一旦改错了,被同事逼问的窘迫,造成同事麻烦的尴尬,这并不是我这种人喜欢的。但是,难道那种把所有的责任归结为别人,将自己的责任抛诸脑后的行为,就是我喜欢的么? 精力…
2008-12-30 23:12
上帝之光(God Ray)
God Ray,看起来很牛,实际上很简单,现在几乎没有游戏不用了。今年四五月份,我也尝试在项目中作了一个这个,确实,比想象中的容易多了。一直想写一篇,一直没时间,终于有点空了,写下来,反正不是什么困难的东西。您要是做也就是一两天的事情吧。 感谢我的同事Aman Jiang,他优化了我之前God Ray的处理方式,使之更符合需要了。而且,介绍了好几篇不错的文章,虽然有些方法由于引擎的限制不能做,但是最后还是一起想办法绕出来了。 (唉,要能多给我点时间多好啊……我就自己做了T_T ) 图片节选自Crysis。感谢Crytech这部好游戏。 感叹,无论如何,游戏的图形已经进入了一个新的时代,妄图通…
2008-12-30 22:10
LBA
LBA(Logical Block Addressing)逻辑块寻址模式。在 LBA 模式下,我们知道硬盘上的一个数据区域由它所在的磁头、柱面(也就是磁道)和扇区所唯一确定。早期系统就是直接使用磁头柱面和扇区来对硬盘进行寻址(这称为CHS寻址),这需要分别存储每个区域的三个参数(这称为3D参数),使用时再分别读取三个参数,然后在送到磁盘控制器去执行。由于系统用8b来存储磁头地址,用10b来存储柱面地址,用6b来存储扇区地址,而一个扇区共有512B,这样使用CHS寻址一块硬盘最大容量为256 * 1024 * 63 * 512B = 8064 MB(1MB = 1048576B)(若按1MB=…
2008-12-30 15:46
在J2ME中获得手机IMEI的方法
手机的IMEI是每个手机的标识,全称:Internation mobile entity identification,在手机中输入*#06#可以显示该数字,长度为15位,全球唯一,可以作为识别每个手机的一个标识。 在J2ME中,并不是每个厂商都提供了获取J2ME的接口。但J2ME提供了获取IMEI的方法: String imei = System.getProperty("IMEI"); 下面是我收集的一些J2ME中获得IMEI的方法: 1、MOTO系列的手机可以通过读取系统的IMEI属性获得: String imei = System.getProperty("IMEI"); 或 Str…
2008-12-19 08:25
S60签名(一)
声明:本文讨论范围仅限于 Symbian OS v9.x 手机操作系统(包括 S60 3rd(及以上) and UIQ) Symbian OS v9.x (S60 3rd) 在安全性方面做了比较大的改善,对在系统中运行的程序等都有严格的规定。其中主要 措施就是所谓“能力”(Capabilities)的限制,也就是我们平时说得多的“权限”: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Symbian OS v9 把应用程序的能力细分为20项: 用户能力6项 NetworkServices: 用于使用移动网络,例如:拨打电话或发送文本消息。 …
2008-12-18 16:50
单源最短路径(四)————Dijkstra算法
packageom.eshore.sweetop.minpath; publicclassDijkstraextendsGraphics{ Dijkstra(Vertex...vs){ intindex=0; for(Vertexv:vs){ list.add(v); v.setIndex(index++); } } @Override publicbooleanminPath(Vertexv){ initSingleSource(v); for(inti=0;i<list.size();i++){ //可以在外循环中使用斐波那契堆实现获取第i个最小值 //这里考虑到Dijkstra只可以解…
2008-12-11 20:14
单源最短路径(三)————Dag实现
packageom.eshore.sweetop.minpath; importjava.awt.Color; importjava.util.LinkedList; publicclassDagextendsGraphics{ privateinttime=0; publicDag(Vertex...vs){ for(Vertexv:vs){ list.add(v); } } publicvoidsort(){ LinkedList<Vertex>list=newLinkedList<Vertex>(); for(Vertexu:this.list){ u.setColor(Color.W…
2008-12-11 16:37
单源最短路径(二)————BellmanFord算法
packageom.eshore.sweetop.minpath; publicclassBellmanFordextendsGraphics{ publicBellmanFord(Vertex...vs){ for(Vertexv:vs){ list.add(v); } } @Override publicbooleanminPath(Vertexv){ initSingleSource(v); for(inti=0;i<list.size()-1;i++){ for(Vertexu:list){ for(Vertexw:u.getV()){ this.relax(u,w); } } } …
2008-12-11 15:13
单源最短路径(一)————松弛技术
packageom.eshore.sweetop.minpath; importjava.util.ArrayList; importjava.util.List; publicabstractclassGraphics{ protectedList<Vertex>list=newArrayList<Vertex>(); publicvoidinitSingleSource(Vertexv){ for(Vertexu:list){ u.setD(Integer.MAX_VALUE); u.setParent(null); } v.setD(0); } publicvoidrelax(Vert…
2008-12-11 15:08
JOONE实现人工智能
packagecom.sweetop.test; importjava.io.Serializable; importjava.util.Arrays; importjava.util.Vector; importorg.joone.engine.FullSynapse; importorg.joone.engine.LinearLayer; importorg.joone.engine.Monitor; importorg.joone.engine.NeuralNetEvent; importorg.joone.engine.NeuralNetListener; importorg.joo…
2008-12-10 16:09
最小生成树Kruskal算法
数据结构使用不相交森林,复杂度 O(ElgV) packagecom.eshore.sweetop.mintree; importjava.util.ArrayList; importjava.util.Collections; importjava.util.List; importcom.eshore.sweetop.exdataframe.DisjointSetForest; publicclassKruskal{ privateDisjointSetForestdsf=newDisjointSetForest(); publicvoidmst(GraphicsDg){ List<Ed…
2008-12-09 10:43
最小生成树Prim算法
数据结构使用的是斐波那契堆,复杂度 O(E+VlgV) packagecom.eshore.sweetop.mintree; importcom.eshore.sweetop.exdataframe.FibHeap; publicclassPrim{ publicvoidmst(Graphicsg,Vertexr){ for(Vertexu:g){ u.setKey(Integer.MAX_VALUE); u.setParent(null); } r.setKey(0); FibHeapfh=newFibHeap(); for(Vertexu:g){ u.setCont(true); fh.…
2008-12-09 10:40
Peterson算法实现线程互斥
packagecom.eshore.sweetop.os; publicclassPeterson{ boolean[]interested=newboolean[2]; intturn; /** *@paramprocess */ publicvoidenter(intprocess){ intother; other=1-process; interested[process]=true; turn=process; while(turn==process&&interested[other]==true); System.out.println(process+"enter!"); }…
2008-12-05 18:15
图算法之强连通分支
packagecom.eshore.sweetop.mapbase; importjava.awt.Color; importjava.util.LinkedList; publicclassSCCTest{ privatestaticinttime; publicstaticvoidDFS(Graphicsg,LinkedList<Vertex>list){ for(Vertexu:g){ u.setColor(Color.WHITE); u.setParent(null); time=0; } while(list.peek()!=null){ Vertexu=list.peek(); …
2008-12-05 15:08
图算法之拓扑排序
/** * */ packagecom.eshore.sweetop.mapbase; importjava.awt.Color; importjava.util.LinkedList; /** *ClassTopoLogical *@authorwudongdong *TopoLogical.java *Dec5,2008 */ publicclassTopoLogical{ privatestaticinttime; publicstaticLinkedList<Vertex>sort(Graphicsg){ LinkedList<Vertex>list=newLinkedList<Ve…
2008-12-05 10:04
图算法之深度优先
/** * */ packagecom.eshore.sweetop.mapbase; importjava.awt.Color; /** *ClassDFSTest *@authorwudongdong *DFSTest.java *Dec5,2008 */ publicclassDFSTest{ privatestaticinttime; publicstaticvoidDFS(Graphicsg){ for(Vertexu:g){ u.setColor(Color.WHITE); u.setParent(null); time=0; } for(Vertexu:g){ if(u.get…
2008-12-05 09:55
j2me版的Preferences
packagecom.eshore.sweetop.preferences; importjava.io.ByteArrayInputStream; importjava.io.ByteArrayOutputStream; importjava.io.DataInputStream; importjava.io.DataOutputStream; importjava.io.IOException; importjavax.microedition.rms.RecordEnumeration; importjavax.microedition.rms.RecordStore; importj…
2008-12-04 18:35
身份证验证
packagecom.eshore.sweetop.sort; /** *ClassIDCard *@authorwudongdong *IDCard.java *Dec4,2008 */ publicclassIDCard{ //wi=2(n-1)(mod11) finalint[]wi={7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2,1}; //verifydigit finalint[]vi={1,0,'X',9,8,7,6,5,4,3,2}; privateint[]ai=newint[18]; /** * */ publicIDCard(){ } publ…
2008-12-04 18:33
图算法之广度优先搜索
packagecom.eshore.sweetop.mapbase; importjava.awt.Color; importjava.util.LinkedList; importjava.util.Queue; /** *ClassGTest *@authorwudongdong *GTest.java *Dec4,2008 */ publicclassGTest{ //构造广度优先树 /** *@paramg *@params */ publicstaticvoidBFS(Graphicsg,Vertexs){ for(Vertexu:g){ u.setColor(Color.WHIT…
2008-12-04 18:26
文件通道流两个实例
1. 两句话实现复制,通道连接 packagecom.eshore.sweetop.io; importjava.io.FileInputStream; importjava.io.FileOutputStream; importjava.nio.channels.FileChannel; publicclassTransferTo{ publicstaticvoidmain(String[]args)throwsException{ FileChannelin=newFileInputStream("test.out").getChannel(),out=newFileOutputStre…
2008-12-03 19:12