亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
免费观看久久久4p| 成人h动漫精品一区二区| 国产一区二区久久| 欧美性感一区二区三区| 久久影音资源网| 亚洲gay无套男同| av在线播放不卡| 日韩精品一区二区三区四区| 亚洲精选免费视频| 国产传媒日韩欧美成人| 日韩欧美国产成人一区二区| 亚洲精品久久7777| 成人美女视频在线看| 精品成人私密视频| 天堂精品中文字幕在线| 99精品热视频| 中文字幕五月欧美| 国产一区二区三区免费看| 777a∨成人精品桃花网| 夜色激情一区二区| 成人动漫av在线| 日本一区二区三区四区在线视频| 奇米一区二区三区av| 欧美日韩在线观看一区二区 | 综合色天天鬼久久鬼色| 久久99国产精品免费| 欧美军同video69gay| 夜夜精品浪潮av一区二区三区| 成人avav在线| 国产精品国产自产拍高清av| 国产999精品久久久久久绿帽| 精品三级在线看| 久久国产人妖系列| 精品国产一区久久| 国产美女在线观看一区| 久久久欧美精品sm网站 | 亚洲国产视频一区| 欧美在线啊v一区| 一区二区三区免费在线观看| 91官网在线免费观看| 亚洲乱码中文字幕| 欧美吞精做爰啪啪高潮| 亚洲高清免费视频| 日韩免费一区二区三区在线播放| 日韩中文欧美在线| 日韩免费一区二区| 国产成人av电影在线观看| 国产精品午夜在线观看| 97久久精品人人澡人人爽| 亚洲色图制服诱惑| 欧美精品自拍偷拍动漫精品| 日本午夜精品一区二区三区电影| 日韩欧美一二三区| 国产激情偷乱视频一区二区三区| 国产精品美日韩| 欧美在线视频日韩| 蜜臀a∨国产成人精品| 久久精品人人做人人爽人人| 成人免费毛片片v| 亚洲狠狠爱一区二区三区| 日韩欧美成人午夜| 成人妖精视频yjsp地址| 亚洲资源中文字幕| 欧美成人激情免费网| 成人在线综合网| 亚洲福利国产精品| 国产亚洲欧美色| 欧美日本一区二区在线观看| 蜜臀久久久99精品久久久久久| 国产亚洲精品7777| 欧美精品一卡二卡| 成人污污视频在线观看| 亚洲成a人在线观看| 国产亚洲欧洲997久久综合| 91丨porny丨国产| 久久精品国产99国产| 国产精品传媒入口麻豆| 日韩一区二区在线观看视频 | 久久99国产精品成人| 国产精品久久久久久久裸模| 欧美一卡二卡三卡四卡| 成人国产精品免费观看| 免费在线视频一区| 一区二区三区日韩欧美精品| 久久一二三国产| 欧美男女性生活在线直播观看| 国产一区二区三区精品欧美日韩一区二区三区 | 日本一区二区三区在线不卡| 欧美日韩在线观看一区二区| 国产乱人伦偷精品视频免下载 | 久久久综合九色合综国产精品| 在线视频亚洲一区| 国产成人av一区二区| 天天操天天干天天综合网| 国产精品福利一区二区| 欧美成人福利视频| 欧美另类久久久品| 波多野结衣精品在线| 久久av老司机精品网站导航| 亚洲一卡二卡三卡四卡五卡| 国产精品入口麻豆九色| 精品对白一区国产伦| 欧美日韩精品欧美日韩精品一| 不卡的av中国片| 国产乱子轮精品视频| 五月开心婷婷久久| 亚洲国产wwwccc36天堂| 亚洲欧美成人一区二区三区| 欧美激情一区不卡| 国产三级精品在线| 久久久精品影视| 精品福利一区二区三区免费视频| 欧美精品一卡二卡| 777久久久精品| 91精品国产乱| 欧美一级在线观看| 91精品国产一区二区三区| 欧美日本一区二区| 欧美中文字幕亚洲一区二区va在线| av在线一区二区三区| 成人avav在线| 色综合久久久久综合| 色婷婷激情久久| 91黄视频在线| 欧美在线不卡一区| 欧美乱熟臀69xxxxxx| 欧美精品在线视频| 日韩视频免费观看高清完整版在线观看 | 亚洲一二三四久久| 亚洲一级片在线观看| 亚洲成av人片在线观看无码| 亚洲一区中文在线| 蜜臀精品一区二区三区在线观看| 免费一级片91| 国产黄色精品网站| 白白色亚洲国产精品| 欧洲亚洲精品在线| 日韩三级在线免费观看| 国产偷国产偷亚洲高清人白洁| 日本一区二区三级电影在线观看 | 色美美综合视频| 4438x成人网最大色成网站| 欧美大片一区二区| 亚洲国产精品99久久久久久久久| 欧美激情综合五月色丁香小说| 国产精品国产精品国产专区不片| 亚洲黄色av一区| 另类小说欧美激情| av一区二区三区在线| 在线成人免费观看| 欧美精品一区二区三区在线播放| 久久久99精品免费观看不卡| 日本一区二区视频在线观看| 尤物视频一区二区| 日韩电影网1区2区| 风流少妇一区二区| 精品视频1区2区| 日韩久久精品一区| 一区在线观看视频| 久久国产精品区| 色偷偷成人一区二区三区91 | 国产精品乱码一区二三区小蝌蚪| 亚洲国产毛片aaaaa无费看 | 天堂av在线一区| 成人免费三级在线| 91精品国产免费久久综合| 国产精品夫妻自拍| 久久99精品久久只有精品| 日本电影欧美片| 国产精品免费丝袜| 久久国产婷婷国产香蕉| 色狠狠桃花综合| 亚洲国产激情av| 九色porny丨国产精品| 色综合天天综合网国产成人综合天| 91精品国产综合久久精品app| 久久久www成人免费毛片麻豆| 亚洲午夜视频在线观看| 成人丝袜18视频在线观看| 日韩免费高清视频| 婷婷六月综合网| 色88888久久久久久影院按摩| 久久久久久久综合色一本| 日本不卡视频在线观看| 欧美午夜精品一区| 亚洲精品亚洲人成人网在线播放| 国产精品亚洲午夜一区二区三区 | 男男gaygay亚洲| 欧美性生活一区| 亚洲男人的天堂在线aⅴ视频| 国产麻豆精品在线| 26uuu亚洲综合色| 久久国产福利国产秒拍| 色视频欧美一区二区三区| 中文字幕日韩av资源站| 国产成人精品在线看| 欧美不卡123| 日韩av电影免费观看高清完整版 | 日韩成人午夜电影| 欧美日韩国产首页|