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

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

?? islandinfinity.java

?? good project for programmer,,
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
////////////////////////////////////////////   IslandInfinity.java//  Lux Map Generator//  Makes maps consisting of groups of connected islands////  Version: 1.0//  Date last modified: 5/28/2006//  By: Greg McGlynn//////////////////////////////////////////package org.mcglynns.lux;import com.sillysoft.lux.*;import java.io.*;import java.util.*;import java.awt.*;import java.awt.geom.*;public class IslandInfinity implements LuxMapGenerator {  Random rand;  //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;  Vector countryPolygons; //shapes of the countrys  Vector connections;     //vector of vectors of integers that say which countries a country connects to  //the game calls this when it wants a map  //write a map xml to out  public boolean generate(PrintWriter out, String choice, int seed, MapLoader m) {    //seed must completely determine our map    rand = new Random(seed);    countryPolygons = new Vector();    connections = new Vector();    //set size & conts based on user choice    int width = 600;    int height = 400;    int numContinents = 6;    if(choice == CHOICE_BIG) {      width = 700;      height = 480;      numContinents = 10;    } else if(choice == CHOICE_HUGE) {      width = 800;      height = 550;      numContinents = 17;    } else if (choice == CHOICE_REALLYHUGE) {      width = 1100;      height = 700;      numContinents = 25;    }    int contVariation = numContinents/6; //numContinents can vary (+/- 1/6)    numContinents += rand.nextInt(2*contVariation+1)-contVariation;    //the header of our xml file    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>Ocean</theme>\n" +              "<author>IslandInfinity 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 IslandInfinity LuxMapGenerator. Type: " + choice +                       ",  Number of continents: " + numContinents  + "</description>\n");    debug("placing continents...");    //determine where our continents will go    Rectangle[] contBounds = placeContinents(numContinents, width, height);    Point[] contCenters = getContCenters(contBounds);    int[] contIndices = new int[numContinents+1]; //the starting index of each cont's countries in the Vectors    for(int i = 0; i < numContinents; i += 1) {      debug("new cont: " + i);      contIndices[i] = countryPolygons.size();      addNewContinent(contBounds[i]); //determine the shapes and connections of the cont's countries    }    contIndices[numContinents] = countryPolygons.size();    debug("Making connections...");    //connect up the continents:    Vector lines = makeConnectionsBetweenContinents(contIndices, contCenters, contBounds, numContinents);    //now write the continents to out    for(int i = 0; i < numContinents; i += 1) {      debug("writing cont: " + i);      int start = contIndices[i];      int end = contIndices[i+1];      writeContinent(start, end, out);    }    debug("drawing lines");    //write the lines representing intercontinent connections    for(int i = 0; i < lines.size(); i += 1) {      writeLine(out, (Line2D.Double)lines.get(i));    }    //done    debug("done");    out.write("</luxboard>");    return true;  }  //this function places numContiennts rectangles in a box of size width-height  //so that none overlap. we use this to choose where our continents will go  private Rectangle[] placeContinents(int numContinents, int width, int height) {    //minimum and maximum sizes of the rectangles    int minWidth = 75;    int minHeight = 60;    int maxWidth = 150;    int maxHeight = 120;    contplacement:    while(true) {  //loops until we have a valid arrangement      Rectangle[] ret = new Rectangle[numContinents];      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          int contWidth = rand.nextInt(maxWidth-minWidth) + minWidth;          int contHeight = rand.nextInt(maxHeight-minHeight) + minHeight;          int x = rand.nextInt(width - contWidth);          int y = rand.nextInt(height - contHeight);          ret[i] = new Rectangle(x, y, contWidth, contHeight);          //expandedI creates a buffer between continents          Rectangle expandedI = new Rectangle(x-20, y-20, contWidth+40, contHeight+40);          for(int j = 0; j < i; j += 1) {            if(ret[j].intersects(expandedI))  //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      }      return ret; //made it through all conts: done    }  }  //determines the centerpoint of each continent  private Point[] getContCenters(Rectangle[] contBounds) {    Point[] ret = new Point[contBounds.length];    for(int i = 0; i < ret.length; i += 1) {      ret[i] = new Point(contBounds[i].x + contBounds[i].width/2,                         contBounds[i].y + contBounds[i].height/2);    }    return ret;  }  //pick a name for a continent (consonant - vowel - consonant)  private String makeContinentName() {    return new String(new char[]{Character.toUpperCase(consonants[rand.nextInt(numConsonants)]),                                  vowels[rand.nextInt(numVowels)],                                  consonants[rand.nextInt(numConsonants)]});  }  //pick a name for a country (contName - vowel - consonant)  private String makeCountryName(String continentName) {    return continentName + new String(new char[]{vowels[rand.nextInt(numVowels)],                                                 consonants[rand.nextInt(numConsonants)]});  }  //output the xml of a continent  //start and end are indices in the polygon and connection Vectors  private void writeContinent(int start, int end, PrintWriter out) {    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 = numBorders;    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(out, (Vector)connections.get(i));      writePolygon(out, (Polygon)countryPolygons.get(i));      out.write("  </country>\n");    }    out.write("</continent>\n");  }  //continent shapes  static final int CONT_RECT = 0;  static final int CONT_ELLIPSE = 1;  static final int numContTypes = 2;  //set up a continent's interior: countries and connections  private void addNewContinent(Rectangle bounds) {    //pick a shape:    int contType = rand.nextInt(numContTypes);    int indexStart = countryPolygons.size(); //starting index in the Vectors    //countries in continent = area/2000 +/- 1    int area = bounds.width*bounds.height;    int countries = area/2000 + rand.nextInt(3)-1;    if(countries < 1) countries = 1;    for(int i = 0; i < countries; i += 1) {      connections.add(new Vector());    }    //each country has a "center." the country consists of the locus of points    //within the continent boundary and closer to the country's center than to    //any other country's center. this means that boundaries consist of the cont    //boundaries and the perpendicular bisectors of segments between close centers    //pick center locations, ensuring that no two are two close,    //as this leads to tiny countries    Point[] centers = new Point[countries];    double minDist = Math.sqrt(area/(double)countries - 750);    boolean done = false;    centerplacement:    while(!done) {      for(int i = 0; i < countries; i += 1) {        centers[i] = getPointInContinent(bounds, contType);        for(int j = 0; j < i; j += 1) {          if(dist(centers[i], centers[j]) < minDist) continue centerplacement;        }      }      done = true;    }    //now create the country polygons. these consist of 100 points. the points have    //2*pi/100 radians between them angularly, but can be at different radii.    Polygon[] polygons = new Polygon[countries];    for(int i = 0; i < countries; i += 1) {      polygons[i] = new Polygon();      for(double theta = 0; theta < 2*Math.PI; theta += Math.PI/50) {        Point borderPoint = getPointOnContinentBorder(centers[i], theta, bounds, contType);        int lastNeighbor = -1;        //now cycle through the other centers and make sure this point is closer to        //this center than any other        for(int p = 0; p < countries; p += 1) {          if(dist(borderPoint, centers[p]) < dist(borderPoint, centers[i])) {            lastNeighbor = p;            int radius = (int)dist(borderPoint, centers[i]);            int movement = radius/2;            for(int j = 0; j < 40; j += 1) {              borderPoint = new Point((int)(centers[i].x + radius*Math.cos(theta)),                                      (int)(centers[i].y + radius*Math.sin(theta)));              if(dist(borderPoint, centers[p]) < dist(borderPoint, centers[i])) {                radius -= movement;              } else {                radius += movement;              }              movement /= 2;            }          }        }        //if this point is a boundary between two countries, make a connection between them        if(lastNeighbor != -1) {          ((Vector)connections.get(indexStart + lastNeighbor)).add(new Integer(indexStart + i));          ((Vector)connections.get(indexStart + i)).add(new Integer(indexStart + lastNeighbor));        }        polygons[i].addPoint(borderPoint.x, borderPoint.y);      }//      if(((Vector)connections.get(i)).size() == 0) debug("didn't connect " + i + " to anything");//      else debug("" + i + " connects to " + ((Integer)((Vector)connections.get(i)).get(0)).intValue());      countryPolygons.add(polygons[i]);    }  }  //pick a random point within the given cont shape  private Point getPointInContinent(Rectangle bounds, int contType) {    if(contType == CONT_RECT) {      return new Point(bounds.x + rand.nextInt(bounds.width),                       bounds.y + rand.nextInt(bounds.height));    } else if(contType == CONT_ELLIPSE) {      while(true) {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美大黄免费观看| 国内久久精品视频| 欧美久久一二三四区| 国产成人综合精品三级| 一区二区理论电影在线观看| 亚洲欧美区自拍先锋| 91激情在线视频| 一本色道久久综合狠狠躁的推荐 | 依依成人综合视频| 日本电影欧美片| 日韩一区二区影院| 欧美一卡2卡3卡4卡| 国产成人欧美日韩在线电影| 国产露脸91国语对白| 精品一区二区三区欧美| 国产在线视频一区二区三区| 国产自产高清不卡| 国产成都精品91一区二区三 | 久久精品视频在线看| 欧美专区日韩专区| 色婷婷久久综合| 91一区二区在线| 91女神在线视频| 在线免费观看视频一区| 91蝌蚪porny| 成人免费观看视频| 国产精品538一区二区在线| 久久99国产精品久久99| 国产一区在线视频| 4hu四虎永久在线影院成人| 欧美日韩国产123区| 在线国产电影不卡| 制服丝袜亚洲播放| 久久婷婷综合激情| 国产精品美女久久久久久| 亚洲欧美色一区| 免费一级片91| 成人午夜激情视频| 欧美日韩www| 欧美韩国一区二区| 午夜av一区二区三区| 黑人巨大精品欧美黑白配亚洲| aaa欧美大片| 欧美一区二区三区在线电影| 国产亚洲欧美一级| 亚洲一级二级三级| 国产一区二区精品久久99| 在线区一区二视频| 久久久精品黄色| 午夜视频在线观看一区二区三区| 国产在线播放一区二区三区| 色综合色综合色综合色综合色综合| 91精品国产一区二区三区蜜臀| 国产日韩成人精品| 视频在线观看国产精品| 不卡的av电影| 日韩欧美www| 有码一区二区三区| 国产 日韩 欧美大片| 欧美日韩精品欧美日韩精品一| 久久久一区二区三区捆绑**| 亚洲国产视频在线| 成人h动漫精品| 日韩久久久精品| 亚洲一区二区三区国产| 国产不卡在线一区| 日韩欧美国产一区在线观看| 综合自拍亚洲综合图不卡区| 国产麻豆精品久久一二三| 91精选在线观看| 亚洲另类春色国产| 成人免费三级在线| 久久久久久久久久久久久久久99 | 国产拍揄自揄精品视频麻豆| 亚洲另类色综合网站| 成人国产精品免费网站| 国产亚洲福利社区一区| 奇米在线7777在线精品| 欧美日韩亚洲不卡| 一级女性全黄久久生活片免费| 久久国产婷婷国产香蕉| 在线综合亚洲欧美在线视频| 亚洲一区二区三区四区五区黄 | 精久久久久久久久久久| 7777精品伊人久久久大香线蕉超级流畅 | 久久色中文字幕| 亚洲美女视频在线观看| 成人亚洲精品久久久久软件| 日韩视频免费观看高清完整版 | 亚洲美女免费在线| 国产精品一区二区免费不卡| 欧美午夜精品久久久久久超碰| 日韩精品久久理论片| 欧美美女网站色| 激情都市一区二区| 亚洲色大成网站www久久九九| 国产日韩欧美麻豆| 国产精品视频观看| 亚洲狼人国产精品| 91亚洲永久精品| 中文字幕一区二区三区在线观看| 国产精品资源网| 精品国产一二三区| 国产精品资源在线| 国产欧美久久久精品影院| 国产精品一区专区| 久久精品亚洲乱码伦伦中文| 国产一区二区91| 国产调教视频一区| 国产成人午夜精品影院观看视频 | 日本不卡在线视频| 日韩精品中文字幕一区二区三区 | 国产最新精品免费| 国产亚洲欧美日韩日本| 国产黄色成人av| 中文字幕不卡在线观看| 成人免费视频视频在线观看免费 | 成av人片一区二区| 亚洲视频一区二区免费在线观看| 93久久精品日日躁夜夜躁欧美| 国产精品电影院| 91国偷自产一区二区使用方法| 亚洲一二三专区| 日韩午夜小视频| 国产福利一区在线| 亚洲欧美日韩综合aⅴ视频| 色94色欧美sute亚洲线路一久| 亚洲综合色网站| 欧美日本韩国一区| 国产麻豆精品一区二区| 日韩一区在线播放| 欧美欧美欧美欧美| 精品一区二区三区香蕉蜜桃 | 亚洲综合在线视频| 日韩欧美一级特黄在线播放| 欧美视频在线观看一区二区| 色综合天天综合| 91视频com| 色婷婷久久99综合精品jk白丝| 国产在线精品一区二区| 奇米综合一区二区三区精品视频| 亚洲一区二区三区激情| 亚洲精品成a人| 亚洲精品乱码久久久久久黑人 | 亚洲图片你懂的| 久久久国产精品不卡| 久久网这里都是精品| 精品欧美乱码久久久久久| 精品成人免费观看| 亚洲伦理在线免费看| 自拍偷拍亚洲激情| 亚洲宅男天堂在线观看无病毒| 日韩精品在线看片z| 精品国产乱码久久久久久浪潮| 久久久国际精品| 免费高清不卡av| 久久综合色一综合色88| 成人综合婷婷国产精品久久| 欧美网站一区二区| 国产盗摄一区二区三区| 一级精品视频在线观看宜春院| 精品成a人在线观看| 精品视频一区二区不卡| 国产成人在线视频网站| 婷婷久久综合九色国产成人| 国产精品情趣视频| 日韩精品一区二区三区在线观看 | 91黄色在线观看| 正在播放亚洲一区| 亚洲色图都市小说| 午夜天堂影视香蕉久久| 懂色中文一区二区在线播放| 在线视频一区二区免费| 亚洲欧美色图小说| 欧美亚洲动漫另类| 国产乱码一区二区三区| 亚洲视频图片小说| 精品国产乱码久久久久久久久| 成人免费观看av| 久久精品国产**网站演员| 欧美一卡二卡在线| 日韩一区二区免费在线观看| 怡红院av一区二区三区| 精品欧美黑人一区二区三区| 99久久国产综合精品麻豆| 日韩精品三区四区| 亚洲少妇屁股交4| 精品国产一区二区三区久久影院| 色8久久人人97超碰香蕉987| 国产一区二区在线观看视频| 亚洲午夜久久久久| 亚洲国产高清aⅴ视频| 日韩欧美国产一区二区三区| 日本久久一区二区三区| 成人听书哪个软件好| 麻豆传媒一区二区三区| 日韩不卡免费视频| 日韩经典中文字幕一区| 亚洲一区自拍偷拍| 亚洲黄色片在线观看|