チェンジセット 1371
- コミット日時:
- 2008/09/24 09:35:17 (4 年前)
- ファイル:
-
- as3/GameAI/trunk/src/TreeTest.as (更新) (1 diff)
- as3/GameAI/trunk/src/jp/dip/hael/gameai/graph/Graph.as (更新) (1 diff)
- as3/GameAI/trunk/src/jp/dip/hael/gameai/tree/Tree.as (更新) (4 diffs)
- as3/GameAI/trunk/src/jp/dip/hael/gameai/tree/searcher (追加)
- as3/GameAI/trunk/src/jp/dip/hael/gameai/tree/searcher/Negamax.as (追加)
- as3/GameAI/trunk/src/jp/dip/hael/gameai/tree/searcher/Searcher.as (追加)
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
as3/GameAI/trunk/src/TreeTest.as
r1292 r1371 15 15 [0, 1, [2, 3]], 16 16 [1, 2, [4, 5]], 17 [1, 3, [6, 7, 8]]); 18 trace(t.rootIdx == 0); 17 [1, 3, [6, 7, 8], 18 [2, 4, [9, 10], 19 [2, 5, [11, 12], 20 [3, 7, [13, 14]]]]]); 21 trace(t.rootIndex == 0); 19 22 for(var i:int = 0; i <= 8; i++){ 20 trace(i, t.parentI dx(i), t.childNodeIdxs(i), t.hasChild(i));23 trace(i, t.parentIndex(i), t.childNodeIndexs(i), t.hasChild(i)); 21 24 } 22 25 } as3/GameAI/trunk/src/jp/dip/hael/gameai/graph/Graph.as
r1292 r1371 50 50 { 51 51 isDigraph_ = isDigraph; 52 nodes_ = []; 53 edges_ = []; 52 nNodes_ = 0; 53 nodes_ = []; 54 edges_ = []; 54 55 } 55 56 57 58 public function clear():void 59 { 60 nNodes_ = 0; 61 nodes_ = []; 62 edges_ = []; 63 } 56 64 57 65 /** as3/GameAI/trunk/src/jp/dip/hael/gameai/tree/Tree.as
r1293 r1371 11 11 public class Tree extends Graph 12 12 { 13 public function get rootI dx():int { return rootIdx_; }13 public function get rootIndex():int { return rootIdx_; } 14 14 15 15 16 16 17 17 18 public function parentI dx(idx:int):int { return (nodes_[idx] as TreeNode).parentIdx; }18 public function parentIndex(index:int):int { return (nodes_[index] as TreeNode).parentIdx; } 19 19 20 public function childNodeI dxs(idx:int):Array {20 public function childNodeIndexs(index:int):Array { 21 21 var i:Array = []; 22 var e:Array = edges_[i dx];22 var e:Array = edges_[index]; 23 23 for each(var e1:Edge in e){ 24 24 i.push(e1.dst); … … 27 27 } 28 28 29 public function hasChild(i dx:int):Boolean { return (edges_[idx] as Array).length != 0; }29 public function hasChild(index:int):Boolean { return (edges_[index] as Array).length != 0; } 30 30 31 31 … … 36 36 { 37 37 super(false); 38 rootIdx_ = addNode(new TreeNode( 0));38 rootIdx_ = addNode(new TreeNode(-1)); 39 39 } 40 40 … … 42 42 public function addChild(parentIdx:int):int 43 43 { 44 var idx:int = addNode(new TreeNode(parentIdx));45 if( super.addEdge(new Edge(parentIdx, idx))){46 return idx;44 var added:int = addNode(new TreeNode(parentIdx)); 45 if(addEdge(new Edge(parentIdx, added))){ 46 return added; 47 47 }else{ 48 48 return -1;

