亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? hexinfinity.java

?? good project for programmer,,
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
////////////////////////HexInfinity Lux Map Generator//Generates maps for Lux like those of the Hex series//Greg McGlynn//////////////////////package org.mcglynns.lux;import com.sillysoft.lux.*;import java.awt.*;import java.awt.geom.*;import java.util.*;import java.io.*;public class HexInfinity implements LuxMapGenerator {  //used in making names  static char[] consonants = new char[]{'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm',                                        'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'z'};  static char[] vowels = new char[]{'a', 'e', 'i', 'o', 'u'};  static int numConsonants = consonants.length;  static int numVowels = vowels.length;  Random rand;  int width, height, numContinents;  Vector[] continents;  Vector connections;  Vector countryPolygons;  Point[] contCenters;  int[] contIndices;  static final double tRad = 30;  static final double tHeight = 3*tRad/2;  static final double tWidth = Math.sqrt(3)*tRad;  PrintWriter out;  public boolean generate(PrintWriter out, String choice, int seed, MapLoader loader) {    rand = new Random(seed);    this.out = out;    int variation;    if(choice == CHOICE_SMALL) {      width = 600;      height = 400;      numContinents = 10;      variation = 1;    } else if(choice == CHOICE_MEDIUM) {      width = 750;      height = 500;      numContinents = 14;      variation = 2;    } else if(choice == CHOICE_LARGE) {      width = 900;      height = 600;      numContinents = 20;      variation = 3;    } else { //(choice == CHOICE_HUGE)      width = 1000;      height = 700;      numContinents = 30;      variation = 4;    }    numContinents += rand.nextInt(2*variation + 1) - variation;    contCenters = new Point[numContinents];    continents = new Vector[numContinents];    loader.setLoadText("Creating map.... (this can take a few seconds)");    out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +              "<luxboard>\n" +              "<version>1.0</version>\n" +              "<width>" + width + "</width>\n" +              "<height>" + height + "</height>\n" +              "<theme>Air</theme>\n" +              "<author>HexInfinity Generator (by Greg McGlynn)</author>\n" +              "<email>greg@mcglynns.org</email>\n" +              "<webpage>www.sillysoft.net</webpage>\n" +              "<title>" + choice + " #" + seed + "</title>\n" +              "<description>This map was made by the HexInfinity LuxMapGenerator. Type: " + choice +                       ",  Number of continents: " + numContinents  + "</description>\n");    loader.setLoadText("Creating map.... (this can take a few seconds)");    debug("making seeds");    makeContinentSeeds();    growContinents();    countryPolygons = new Vector();    connections = new Vector();    contIndices = new int[numContinents+1];    for(int i = 0; i < numContinents; i += 1) {      contIndices[i] = countryPolygons.size();      for(int j = 0; j < continents[i].size(); j += 1) {        countryPolygons.add((Polygon)continents[i].get(j));        connections.add(new Vector());      }      for(int j = contIndices[i]; j < countryPolygons.size(); j += 1) {        for(int k = contIndices[i]; k < countryPolygons.size(); k += 1) {          if(j != k && dist(polygonCenter((Polygon)countryPolygons.get(j)),                            polygonCenter((Polygon)countryPolygons.get(k))) < tRad*1.5) {            ((Vector)connections.get(j)).add(new Integer(k));          }        }      }    }    contIndices[numContinents] = countryPolygons.size();    debug("connecting continents");    Vector lines = makeConnectionsBetweenContinents();    debug("writing...");    for(int i = 0; i < numContinents; i += 1) {      writeContinent(i);    }    for(int i = 0; i < lines.size(); i += 1) {      writeLine((Line2D.Double)lines.get(i));    }    out.write("</luxboard>\n");    return true;  }  //output the xml of a continent  //start and end are indices in the polygon and connection Vectors  private void writeContinent(int cont) {    int start = contIndices[cont];    int end = contIndices[cont+1];    String continentName = makeContinentName();    int countries = end-start;    int numBorders = 0;    for(int i = start; i < end; i += 1) {      Vector theseConns = (Vector)connections.get(i);      boolean isABorder = false;      for(int j = 0; j < theseConns.size(); j += 1) {        int connIndex = ((Integer)theseConns.get(j)).intValue();        if(connIndex < start || connIndex >= end) {          isABorder = true;        }      }      if(isABorder) numBorders += 1;    }    int bonus = (int)Math.round((numBorders + countries/3.0)/2);    out.write("<continent>\n" +	"  <continentname>" + continentName + "</continentname>\n" +	"  <bonus>" + bonus + "</bonus>\n");    for(int i = start; i < end; i += 1) { //write out each country      out.write("  <country>\n" +		"    <id>" + i + "</id>\n" +		"    <name>" + makeCountryName(continentName) + "</name>\n");      writeConnections((Vector)connections.get(i));      writePolygon((Polygon)countryPolygons.get(i));      out.write("  </country>\n");    }    out.write("</continent>\n");  }  private void makeContinentSeeds() {    double minDist = 100;    contCenters = new Point[numContinents];    contplacement:    while(true) {  //loops until we have a valid arrangement      for(int i = 0; i < numContinents; i += 1) { //place the conts one at a time        boolean success = false; //whether we successfully placed this cont        placetry:        for(int k = 0; k < 15; k += 1) { //try to place this cont 15 times          contCenters[i] = new Point(50+rand.nextInt(width-100), 50+rand.nextInt(height-100));          //expandedI creates a buffer between continents          for(int j = 0; j < i; j += 1) {            if(dist(contCenters[j], contCenters[i]) < minDist)  //overlap              continue placetry; //try again...          }          success = true; //no intersections          break; //success in placing this cont        }        if(!success) continue contplacement; //couldn't place this cont, start over      }      break; //made it through all conts: done    }    for(int i = 0; i < numContinents; i += 1) {      continents[i] = new Vector();      continents[i].add(upTriangleAround(contCenters[i]) );    }  }  private void growContinents() {    for(int i = 0; i < 50; i += 1) {      for(int j = 0; j < numContinents; j += 1) {        addOneCountryToContinent(rand.nextInt(numContinents));      }    }  }  private boolean addOneCountryToContinent(int cont) {    trytoplace:    for(int i = 0; i < 40; i += 1) {      int parentIndex = rand.nextInt(continents[cont].size());      Polygon parent = (Polygon)continents[cont].get(parentIndex);      Polygon child = makeAdjoiningTriangle(parent);      for(int j = 0; j < numContinents; j += 1) {        for(int k = 0; k < continents[j].size(); k += 1) {          //debug("child = " + child + ", continents[j] = " + continents[j] + ", continents = " = continents);          if(trianglesIntersect(dilatePolygon(child, (cont == j ? 1.0: 1.2)),                                dilatePolygon((Polygon)continents[j].get(k), (cont==j ? 1.0 : 1.2))) ||             !polygonFitsOnScreen(child) ||             (j != cont && dist(polygonCenter(child), polygonCenter((Polygon)continents[j].get(k))) < tRad*2))            continue trytoplace;        }      }      //valid, add it      continents[cont].add(child);      return true;    }    return false;  }  private Polygon makeAdjoiningTriangle(Polygon p) {    Polygon ret = new Polygon();    if(trianglePointsUp(p)) {      switch(rand.nextInt(3)) {        case 0:          ret.addPoint(p.xpoints[0], (int)(p.ypoints[0]-2*tHeight));          ret.addPoint(p.xpoints[1], p.ypoints[1]);          ret.addPoint(p.xpoints[2], p.ypoints[2]);          ret.translate(0, -5);          return ret;        case 1:          ret.addPoint(p.xpoints[1], p.ypoints[1]);          ret.addPoint(p.xpoints[1]-(int)(tWidth/2), p.ypoints[0]);          ret.addPoint(p.xpoints[0], p.ypoints[0]);          ret.translate(-5, 0);          return ret;        case 2:          ret.addPoint(p.xpoints[2], p.ypoints[2]);          ret.addPoint(p.xpoints[0], p.ypoints[0]);          ret.addPoint(p.xpoints[2]+(int)(tWidth/2), p.ypoints[0]);          ret.translate(5, 0);          return ret;      }    } else {      switch(rand.nextInt(3)) {        case 0:          ret.addPoint(p.xpoints[0], p.ypoints[0]+(int)(2*tHeight));          ret.addPoint(p.xpoints[1], p.ypoints[1]);          ret.addPoint(p.xpoints[2], p.ypoints[2]);          ret.translate(0, 5);          return ret;        case 1:          ret.addPoint(p.xpoints[1], p.ypoints[1]);          ret.addPoint(p.xpoints[1]-(int)(tWidth/2), p.ypoints[0]);          ret.addPoint(p.xpoints[0], p.ypoints[0]);          ret.translate(-5, 0);          return ret;        case 2:          ret.addPoint(p.xpoints[2], p.ypoints[2]);          ret.addPoint(p.xpoints[0], p.ypoints[0]);          ret.addPoint(p.xpoints[2]+(int)(tWidth/2), p.ypoints[0]);          ret.translate(5, 0);          return ret;      }    }    return null;  }  //connect up the continents so that any country can reach any other country.  //the algorithm is to make the shortest valid connection at each step until  //all continents are reacheable. we return a Vector of lines that should be  //drawn representing the connections we made  private Vector makeConnectionsBetweenContinents() {    //an array saying whether there is a direct connection between any two continents    boolean[][] contsConnected = new boolean[numContinents][numContinents];    for(int i = 0; i < numContinents; i += 1) {      for(int j = 0; j < numContinents; j += 1) {        contsConnected[i][j] = false;      }    }    boolean[][] countriesConnected = new boolean[connections.size()][connections.size()];    for(int i = 0; i < connections.size(); i += 1) {      for(int j = 0; j < connections.size(); j += 1) {        countriesConnected[i][j] = false;      }    }    Vector lines = new Vector();    //connect continents until they are all connected    boolean more = true;    while(more && !allContsReachableFrom(0, contsConnected, numContinents)) {//      more = false;      double shortestGap = 10000;      int contA = rand.nextInt(numContinents);//      debug("contIndices[contA+1] - contIndices[contA] = " + (contIndices[contA+1] - contIndices[contA]));      int countryA = contIndices[contA] + rand.nextInt(contIndices[contA+1] - contIndices[contA]);      int contB = -1;      int countryB = -1;      int xxx = 0;      for(int i = 0; i < numContinents; i += 1) {        if(i != contA) {          for(int j = contIndices[i]; j < contIndices[i+1]; j += 1) {            if(!countriesConnected[countryA][j] && countriesConnectable(countryA, j)) {//              debug("xxx = " +  j);              xxx += 1;              double gap = dist(polygonCenter((Polygon)countryPolygons.get(countryA)),                                polygonCenter((Polygon)countryPolygons.get(j)));//              debug("gap = " + gap);              if(gap < shortestGap) {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线观看精品一区| 国产在线观看一区二区| 色婷婷综合久久久| 亚洲三级免费电影| 97久久精品人人爽人人爽蜜臀| 国产欧美日韩在线| 成人黄色大片在线观看| 综合久久给合久久狠狠狠97色| 91免费版pro下载短视频| 一区二区三区欧美久久| 欧美理论电影在线| 精品一区二区三区不卡| 中文字幕精品一区 | 国产一区二区三区香蕉| 国产精品久久久久一区二区三区共| 9i看片成人免费高清| 亚洲自拍偷拍av| 日韩免费一区二区三区在线播放| 国产精品性做久久久久久| 最新久久zyz资源站| 欧美优质美女网站| 美美哒免费高清在线观看视频一区二区 | 欧美一级黄色大片| 国产精品99久久久| 亚洲激情网站免费观看| 日韩欧美二区三区| 色婷婷精品大视频在线蜜桃视频| 午夜一区二区三区在线观看| 久久久久国产精品麻豆| 色老汉av一区二区三区| 久久精品国产亚洲一区二区三区| 国产精品水嫩水嫩| 欧美日韩黄色影视| 国产成人精品亚洲日本在线桃色 | 成人app网站| 亚洲国产视频一区二区| 久久久91精品国产一区二区精品| 色呦呦国产精品| 国产一区二区三区香蕉| 亚洲国产欧美一区二区三区丁香婷 | 国产精品亚洲а∨天堂免在线| 亚洲精品国产一区二区精华液| 日韩三级免费观看| 99久久伊人久久99| 国精产品一区一区三区mba视频| 一二三区精品视频| 国产精品免费看片| 日韩欧美卡一卡二| 欧美日韩电影在线播放| 99国产欧美另类久久久精品| 蜜桃av噜噜一区二区三区小说| 亚洲精品视频在线观看网站| 久久精品水蜜桃av综合天堂| 666欧美在线视频| 91黄色小视频| 91热门视频在线观看| 国产成人免费xxxxxxxx| 精品在线观看免费| 日韩成人一区二区| 婷婷一区二区三区| 一区二区三区四区国产精品| 国产欧美一区二区三区在线老狼| 日韩精品在线一区二区| 6080亚洲精品一区二区| 欧美性色综合网| 在线中文字幕不卡| 91亚洲精品乱码久久久久久蜜桃| 成人美女视频在线观看| 国产精品88888| 黑人精品欧美一区二区蜜桃| 免费观看成人av| 日本中文字幕一区二区视频 | 国产精品一区久久久久| 韩国av一区二区三区四区| 久久成人免费网| 久久国产乱子精品免费女| 奇米在线7777在线精品| 日韩av中文字幕一区二区三区| 亚洲第一激情av| 午夜精品一区二区三区免费视频 | 国产欧美日韩视频在线观看| 久久久久久免费毛片精品| 久久老女人爱爱| 国产亚洲一区二区在线观看| 国产日韩精品一区| 亚洲欧美在线高清| 国产精品久久久久久久久久久免费看| 久久久久高清精品| 久久久久88色偷偷免费| 欧美国产精品专区| 亚洲蜜臀av乱码久久精品| 有坂深雪av一区二区精品| 亚洲电影你懂得| 久久99久久99精品免视看婷婷| 美国十次了思思久久精品导航| 国产一区二区导航在线播放| 成人精品高清在线| 91免费在线播放| 欧美伊人久久久久久久久影院| 欧美美女直播网站| 久久综合色婷婷| 国产精品免费久久| 亚洲超碰97人人做人人爱| 久久精品国产在热久久| 国产成人午夜视频| 日本久久一区二区三区| 精品久久久久久综合日本欧美| 国产清纯白嫩初高生在线观看91 | 欧美三区在线观看| 欧美刺激午夜性久久久久久久| 久久精子c满五个校花| 亚洲图片欧美激情| 日韩不卡在线观看日韩不卡视频| 国产专区综合网| 色成年激情久久综合| 日韩一级大片在线观看| 中文字幕在线不卡视频| 亚洲成国产人片在线观看| 国产精品亚洲一区二区三区在线 | 日日欢夜夜爽一区| 欧美视频在线不卡| 久久九九全国免费| 亚洲妇女屁股眼交7| 国产综合久久久久影院| 精品视频在线看| 国产午夜久久久久| 视频精品一区二区| a美女胸又www黄视频久久| 欧美一级高清大全免费观看| 最新久久zyz资源站| 免费欧美在线视频| 在线一区二区三区四区| 久久亚洲精精品中文字幕早川悠里| 亚洲综合免费观看高清完整版在线| 韩国av一区二区| 制服丝袜av成人在线看| 亚洲欧美日韩一区二区三区在线观看| 久久国产精品99久久人人澡| 欧美午夜精品一区二区三区| 国产欧美日韩另类一区| 裸体一区二区三区| 欧美精品在线一区二区| 日韩理论电影院| 风间由美性色一区二区三区| 日韩欧美在线123| 亚洲五码中文字幕| 色综合视频一区二区三区高清| 久久久久久久网| 麻豆精品久久精品色综合| 欧美视频在线观看一区二区| 亚洲欧洲中文日韩久久av乱码| 国产成人在线影院| 久久久三级国产网站| 麻豆91免费观看| 欧美一区二区精品在线| 日韩国产欧美视频| 欧美色中文字幕| 亚洲综合久久av| 色94色欧美sute亚洲线路二| 亚洲欧美激情视频在线观看一区二区三区 | 99国产精品一区| 久久久久久久久蜜桃| 国产一区美女在线| 欧美不卡一二三| 久久国产精品色婷婷| 精品国产91亚洲一区二区三区婷婷| 日本视频一区二区| 欧美草草影院在线视频| 日韩精品欧美成人高清一区二区| 欧美日韩中文另类| 亚洲一级片在线观看| 欧美色电影在线| 日韩国产欧美一区二区三区| 日韩亚洲欧美高清| 国产一区欧美一区| 欧美高清一级片在线观看| 不卡高清视频专区| 中文字幕欧美一| 欧美在线一区二区三区| 婷婷中文字幕综合| 欧美v亚洲v综合ⅴ国产v| 国产在线精品一区二区三区不卡| 久久精品视频免费| 色婷婷久久99综合精品jk白丝| 亚洲制服丝袜av| 欧美一级理论片| 国产精品88888| 一区二区在线电影| 884aa四虎影成人精品一区| 国产在线精品视频| 国产精品高清亚洲| 欧美日韩视频在线第一区| 日日嗨av一区二区三区四区| 久久亚洲影视婷婷| 95精品视频在线| 日韩精品免费视频人成| 久久久久久久久久久久久夜| 92国产精品观看| 日本成人中文字幕| 国产精品天干天干在线综合|