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

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

?? grid.java

?? j2me下的方塊游戲 直接放到wtk下即可運行
?? JAVA
字號:
package Maze;import java.util.Random;import java.util.Vector;/** * This class contains the data necessary to draw the maze. * * @author Carol Hamer */public class Grid {  /**   * Random number generator to create a random maze.   */  private Random myRandom = new Random();  /**   * data for which squares are filled and which are blank.   * 0 = black   * 1 = white   * values higher than 1 are used during the maze creation    * algorithm.   * 2 = the square could possibly be appended to the maze this round.   * 3 = the square's color is not yet decided, and the square is    * not close enough to be appended to the maze this round.   */  int[][] mySquares;  //--------------------------------------------------------  //  maze generation methods  /**   * Create a new maze.   */  public Grid(int width, int height) {    mySquares = new int[width][height];    // initialize all of the squares to white except a lattice     // framework of black squares.    for(int i = 1; i < width - 1; i++) {      for(int j = 1; j < height - 1; j++) {	if((i % 2 == 1) || (j % 2 == 1)) {	  mySquares[i][j] = 1;	}      }    }    // the entrance to the maze is at (0,1).    mySquares[0][1] = 1;    createMaze();  }  /**   * This method randomly generates the maze.   */  private void createMaze() {    // create an initial framework of black squares.    for(int i = 1; i < mySquares.length - 1; i++) {      for(int j = 1; j < mySquares[i].length - 1; j++) {	if((i + j) % 2 == 1) {	  mySquares[i][j] = 0;	}      }    }    // initialize the squares that can be either black or white     // depending on the maze.    // first we set the value to 3 which means undecided.    for(int i = 1; i < mySquares.length - 1; i+=2) {      for(int j = 1; j < mySquares[i].length - 1; j+=2) {	mySquares[i][j] = 3;      }    }    // Then those squares that can be selected to be open     // (white) paths are given the value of 2.      // We randomly select the square where the tree of maze     // paths will begin.  The maze is generated starting from     // this initial square and branches out from here in all     // directions to fill the maze grid.      Vector possibleSquares = new Vector(mySquares.length 					* mySquares[0].length);    int[] startSquare = new int[2];    startSquare[0] = getRandomInt(mySquares.length / 2)*2 + 1;    startSquare[1] = getRandomInt(mySquares[0].length / 2)*2 + 1;    mySquares[startSquare[0]][startSquare[1]] = 2;    possibleSquares.addElement(startSquare);    // Here we loop to select squares one by one to append to     // the maze pathway tree.    while(possibleSquares.size() > 0) {      // the next square to be joined on is selected randomly.      int chosenIndex = getRandomInt(possibleSquares.size());      int[] chosenSquare = (int[])possibleSquares.elementAt(chosenIndex);      // we set the chosen square to white and then       // remove it from the list of possibleSquares (i.e. squares       // that can possibly be added to the maze), and we link       // the new square to the maze.      mySquares[chosenSquare[0]][chosenSquare[1]] = 1;      possibleSquares.removeElementAt(chosenIndex);      link(chosenSquare, possibleSquares);    }    // now that the maze has been completely generated, we     // throw away the objects that were created during the     // maze creation algorithm and reclaim the memory.    possibleSquares = null;    System.gc();  }  /**   * internal to createMaze.  Checks the four squares surrounding    * the chosen square.  Of those that are already connected to    * the maze, one is randomly selected to be joined to the    * current square (to attach the current square to the    * growing maze).  Those squares that were not previously in    * a position to be joined to the maze are added to the list    * of "possible" squares (that could be chosen to be attached    * to the maze in the next round).   */  private void link(int[] chosenSquare, Vector possibleSquares) {    int linkCount = 0;    int i = chosenSquare[0];    int j = chosenSquare[1];    int[] links = new int[8];    if(i >= 3) {      if(mySquares[i - 2][j] == 1) {	links[2*linkCount] = i - 1;	links[2*linkCount + 1] = j;	linkCount++;      } else if(mySquares[i - 2][j] == 3) {	mySquares[i - 2][j] = 2;	int[] newSquare = new int[2];	newSquare[0] = i - 2;	newSquare[1] = j;	possibleSquares.addElement(newSquare);      }    }    if(j + 3 <= mySquares[i].length) {      if(mySquares[i][j + 2] == 3) {	mySquares[i][j + 2] = 2;	int[] newSquare = new int[2];	newSquare[0] = i;	newSquare[1] = j + 2;	possibleSquares.addElement(newSquare);      } else if(mySquares[i][j + 2] == 1) {	links[2*linkCount] = i;	links[2*linkCount + 1] = j + 1;	linkCount++;      }    }     if(j >= 3) {      if(mySquares[i][j - 2] == 3) {	mySquares[i][j - 2] = 2;	int[] newSquare = new int[2];	newSquare[0] = i;	newSquare[1] = j - 2;	possibleSquares.addElement(newSquare);      } else if(mySquares[i][j - 2] == 1) {	links[2*linkCount] = i;	links[2*linkCount + 1] = j - 1;	linkCount++;      }    }     if(i + 3 <= mySquares.length) {      if(mySquares[i + 2][j] == 3) {	mySquares[i + 2][j] = 2;	int[] newSquare = new int[2];	newSquare[0] = i + 2;	newSquare[1] = j;	possibleSquares.addElement(newSquare);      } else if(mySquares[i + 2][j] == 1) {	links[2*linkCount] = i + 1;	links[2*linkCount + 1] = j;	linkCount++;      }    }     if(linkCount > 0) {      int linkChoice = getRandomInt(linkCount);      int linkX = links[2*linkChoice];      int linkY = links[2*linkChoice + 1];      mySquares[linkX][linkY] = 1;      int[] removeSquare = new int[2];      removeSquare[0] = linkX;      removeSquare[1] = linkY;      possibleSquares.removeElement(removeSquare);    }  }  /**   * a randomization utility.    * @param upper the upper bound for the random int.   * @return a random non-negative int less than the bound upper.   */  public int getRandomInt(int upper) {    int retVal = myRandom.nextInt() % upper;    if(retVal < 0) {      retVal += upper;    }    return(retVal);  }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99久久免费国产| 国产视频在线观看一区二区三区| 欧洲日韩一区二区三区| 91亚洲精华国产精华精华液| 成人av片在线观看| k8久久久一区二区三区| 91蝌蚪porny| 欧美少妇性性性| 这里只有精品免费| 日韩欧美中文字幕公布| 2020日本不卡一区二区视频| 久久久精品天堂| 欧美国产日产图区| 日韩毛片高清在线播放| 一区二区三区精品在线观看| 亚洲国产精品久久人人爱| 婷婷亚洲久悠悠色悠在线播放| 天天av天天翘天天综合网| 青青草国产精品亚洲专区无| 激情综合色综合久久综合| 国产成人av电影在线观看| 色综合视频在线观看| 精品婷婷伊人一区三区三| 91精品啪在线观看国产60岁| 久久久无码精品亚洲日韩按摩| 国产欧美日韩视频一区二区 | 久久综合久色欧美综合狠狠| 欧美精品一区二区三区久久久| 久久精品人人做| 亚洲免费三区一区二区| 午夜影院久久久| 久久99久久99精品免视看婷婷 | 欧美色爱综合网| 欧美片网站yy| 久久久午夜精品理论片中文字幕| 椎名由奈av一区二区三区| 亚洲成a人v欧美综合天堂下载| 蜜桃一区二区三区在线| 国产91丝袜在线观看| 欧美亚洲动漫精品| 欧美精品一区二区三区蜜桃视频 | 韩国精品在线观看| 99v久久综合狠狠综合久久| 欧美日韩另类一区| 亚洲国产成人自拍| 首页国产欧美日韩丝袜| 国产不卡一区视频| 欧美精品久久天天躁| 亚洲国产岛国毛片在线| 视频在线观看一区二区三区| 成人免费黄色在线| 欧美一区二区三区成人| 国产精品私人自拍| 免费观看在线综合| 97se亚洲国产综合自在线不卡 | 亚洲国产精品激情在线观看| 亚洲午夜久久久久久久久电影院 | 色爱区综合激月婷婷| wwwwww.欧美系列| 性做久久久久久| 豆国产96在线|亚洲| 制服丝袜中文字幕亚洲| 亚洲三级免费电影| 国产一区高清在线| 欧美日韩国产经典色站一区二区三区 | 久久久一区二区三区捆绑**| 亚洲国产精品视频| 99久精品国产| 国产日本亚洲高清| 久久国产精品免费| 欧美顶级少妇做爰| 亚洲精品美国一| 成人高清伦理免费影院在线观看| 精品少妇一区二区三区在线播放| 亚洲愉拍自拍另类高清精品| 大美女一区二区三区| 久久久亚洲精华液精华液精华液| 午夜精品久久久久久不卡8050| 99久久99久久精品国产片果冻| 久久精品日产第一区二区三区高清版| 日韩电影在线看| 欧美日韩一区二区不卡| 中文字幕中文乱码欧美一区二区| 国产一区二区91| 一区二区三区中文字幕| av在线播放成人| 国产女同互慰高潮91漫画| 久久国产精品露脸对白| 欧美一级高清片| 日韩va亚洲va欧美va久久| 欧美性大战xxxxx久久久| 亚洲人成伊人成综合网小说| 成人免费黄色在线| 国产精品视频一区二区三区不卡| 国产高清成人在线| 日本一区二区在线不卡| 国产99久久久久| 国产日韩欧美精品综合| 国产精品亚洲综合一区在线观看| 精品国精品国产| 国产精品主播直播| 久久蜜桃av一区精品变态类天堂| 国产一区二区三区在线观看精品 | 石原莉奈在线亚洲二区| 欧美精品xxxxbbbb| 日韩高清欧美激情| 欧美一区二区三区在线视频| 日本不卡的三区四区五区| 日韩欧美色电影| 国模套图日韩精品一区二区| 欧美变态tickling挠脚心| 国产精品一级片| 国产精品丝袜黑色高跟| 91麻豆产精品久久久久久| 亚洲图片欧美一区| 欧美高清dvd| 久久超碰97人人做人人爱| 久久久久久影视| 成人av中文字幕| 一区二区三区在线观看国产| 欧美亚洲自拍偷拍| 奇米一区二区三区av| 久久久久久夜精品精品免费| 成人午夜精品在线| 一区二区三区四区不卡在线| 欧美日韩不卡一区| 黄网站免费久久| 亚洲欧美综合网| 欧美三级在线播放| 国产在线观看一区二区| 专区另类欧美日韩| 欧美精品第一页| 国产成人鲁色资源国产91色综| 亚洲精品日产精品乱码不卡| 欧美片网站yy| 丁香天五香天堂综合| 一区二区三区在线免费观看| 欧美一级专区免费大片| 成人国产一区二区三区精品| 亚洲综合色婷婷| 日韩精品最新网址| 99亚偷拍自图区亚洲| 青青草成人在线观看| 国产精品久久久久国产精品日日| 欧美男女性生活在线直播观看| 久久91精品久久久久久秒播| 中文字幕一区二区三区乱码在线 | 亚洲成av人影院| 久久久精品日韩欧美| 自拍av一区二区三区| 欧美精品xxxxbbbb| av高清久久久| 麻豆成人91精品二区三区| 国产精品久久毛片av大全日韩| 欧美肥妇free| 99精品热视频| 精品一区二区日韩| 亚洲自拍偷拍麻豆| 久久久午夜精品| 欧美老女人第四色| 成人激情校园春色| 久久99久久99小草精品免视看| 悠悠色在线精品| 欧美激情一区二区三区| 91精品国产综合久久婷婷香蕉 | 91精品国产综合久久精品麻豆 | 成人免费在线播放视频| 精品少妇一区二区三区日产乱码| 91网页版在线| 国产乱码精品1区2区3区| 婷婷丁香久久五月婷婷| 亚洲天堂久久久久久久| 久久蜜臀精品av| 日韩视频在线一区二区| 欧美在线999| 99久久婷婷国产综合精品电影| 久久精品国产亚洲a| 亚洲成av人片观看| 综合激情网...| 中文字幕av一区 二区| 精品国产一区二区精华| 欧美日韩一区三区四区| 91在线观看成人| 国产69精品久久久久毛片| 极品少妇xxxx精品少妇偷拍| 日本中文字幕一区二区有限公司| 亚洲一区在线观看视频| 综合网在线视频| 中文字幕中文字幕一区| 中文字幕欧美激情| 国产亚洲欧美一区在线观看| 日韩午夜精品视频| 91精品久久久久久久99蜜桃| 欧美日韩一区高清| 在线观看精品一区| 91国在线观看| 91福利精品视频| 一道本成人在线| 色婷婷亚洲精品| 欧美中文字幕久久|