From 2d1094685ee5ec632601b771e36cd5f83ba92571 Mon Sep 17 00:00:00 2001 From: 李进峰 Date: Wed, 28 Nov 2018 12:26:20 +0800 Subject: [PATCH] neighbour matrix implement question --- src/GameEnvironment/GameEnv.java | 50 +++++++++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/src/GameEnvironment/GameEnv.java b/src/GameEnvironment/GameEnv.java index 738a471..533c5e2 100644 --- a/src/GameEnvironment/GameEnv.java +++ b/src/GameEnvironment/GameEnv.java @@ -68,36 +68,43 @@ public class GameEnv implements Serializable{ int x = this.mapNames.get(placeMapTmp.get(tmp)); int y = this.mapNames.get(placeMapTmp.get(idName)); this.mapGraph[x][y] = 1; + // 有方向的添加 + // this.mapGraph[y][x] = 1; } placeIndex.get(placeMapTmp.get(tmp)).setAbleGo(ableGos); } + + // 映射index -> map name + this.mapIndexName = new String[mapGraph.length]; for(i=0; i map name - this.mapIndexName = new String[mapGraph.length]; + + System.out.println("\n"); + System.out.print("\t"); for(i=0; i queryCanGoBySite(String site){ List ableGoString = new ArrayList(); - Place place = this.placeIndex.get(site); - List ableGos = place.getAbleGo(); - for(int i=0; i