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

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

?? field.java

?? 現在在國外大學里最流行的java學習軟件,同時還有大量的example,在名為project的文件里.安裝好后用bluej打開peoject的例子,可以進行你想要的任何變化.同時可以了解大量的源碼
?? JAVA
字號:
import java.util.Collections;import java.util.Iterator;import java.util.LinkedList;import java.util.List;import java.util.Random;/** * Represent a rectangular grid of field positions. * Each position is able to store a single animal. *  * @author David J. Barnes and Michael Kolling * @version 2006.03.30 */public class Field{    private static final Random rand = new Random();        // The depth and width of the field.    private int depth, width;    // Storage for the animals.    private Animal[][] field;    /**     * Represent a field of the given dimensions.     * @param depth The depth of the field.     * @param width The width of the field.     */    public Field(int depth, int width)    {        this.depth = depth;        this.width = width;        field = new Animal[depth][width];    }        /**     * Empty the field.     */    public void clear()    {        for(int row = 0; row < depth; row++) {            for(int col = 0; col < width; col++) {                field[row][col] = null;            }        }    }        /**     * Place an animal in the field.     * If there is already an animal at the same     * location it will be lost.     * @param animal The animal to be placed.     */    public void place(Animal animal)    {        Location location = animal.getLocation();        field[location.getRow()][location.getCol()] = animal;    }        /**     * Return the animal at the given location, if any.     * @param location Where in the field.     * @return The animal at the given location, or null if there is none.     */    public Animal getAnimalAt(Location location)    {        return getAnimalAt(location.getRow(), location.getCol());    }        /**     * Return the animal at the given location, if any.     * @param row The desired row.     * @param col The desired column.     * @return The animal at the given location, or null if there is none.     */    public Animal getAnimalAt(int row, int col)    {        return field[row][col];    }        /**     * Generate a random location that is adjacent to the     * given location, or is the same location.     * The returned location will be within the valid bounds     * of the field.     * @param location The location from which to generate an adjacency.     * @return A valid location within the grid area. This     *         may be the same object as the location parameter.     */    public Location randomAdjacentLocation(Location location)    {        int row = location.getRow();        int col = location.getCol();        // Generate an offset of -1, 0, or +1 for both the current row and col.        int nextRow = row + rand.nextInt(3) - 1;        int nextCol = col + rand.nextInt(3) - 1;        // Check in case the new location is outside the bounds.        if(nextRow < 0 || nextRow >= depth || nextCol < 0 || nextCol >= width) {            return location;        }        else if(nextRow != row || nextCol != col) {            return new Location(nextRow, nextCol);        }        else {            return location;        }    }        /**     * Try to find a free location that is adjacent to the     * given location. If there is none, then return the current     * location if it is free. If not, return null.     * The returned location will be within the valid bounds     * of the field.     * @param location The location from which to generate an adjacency.     * @return A valid location within the grid area. This may be the     *         same object as the location parameter, or null if all     *         locations around are full.     */    public Location freeAdjacentLocation(Location location)    {        Iterator<Location> adjacent = adjacentLocations(location);        while(adjacent.hasNext()) {            Location next = adjacent.next();            if(field[next.getRow()][next.getCol()] == null) {                return next;            }        }        // check whether current location is free        if(field[location.getRow()][location.getCol()] == null) {            return location;        }         else {            return null;        }    }    /**     * Generate an iterator over a shuffled list of locations adjacent     * to the given one. The list will not include the location itself.     * All locations will lie within the grid.     * @param location The location from which to generate adjacencies.     * @return An iterator over locations adjacent to that given.     */    public Iterator<Location> adjacentLocations(Location location)    {        int row = location.getRow();        int col = location.getCol();        List<Location> locations = new LinkedList<Location>();        for(int roffset = -1; roffset <= 1; roffset++) {            int nextRow = row + roffset;            if(nextRow >= 0 && nextRow < depth) {                for(int coffset = -1; coffset <= 1; coffset++) {                    int nextCol = col + coffset;                    // Exclude invalid locations and the original location.                    if(nextCol >= 0 && nextCol < width && (roffset != 0 || coffset != 0)) {                        locations.add(new Location(nextRow, nextCol));                    }                }            }        }        Collections.shuffle(locations, rand);        return locations.iterator();    }    /**     * Return the depth of the field.     * @return The depth of the field.     */    public int getDepth()    {        return depth;    }        /**     * Return the width of the field.     * @return The width of the field.     */    public int getWidth()    {        return width;    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲成人777| 久久精品欧美一区二区三区麻豆| 久久国产精品99久久人人澡| 午夜久久电影网| 亚洲美女在线一区| 亚洲欧美欧美一区二区三区| 久久久99精品免费观看不卡| 精品日韩99亚洲| 日韩欧美一级在线播放| 日韩一级大片在线观看| 日韩欧美在线1卡| 精品国产髙清在线看国产毛片| 91精品国产aⅴ一区二区| 欧美一级日韩一级| 精品1区2区在线观看| 国产日韩综合av| 自拍视频在线观看一区二区| 亚洲精品日韩综合观看成人91| 亚洲精品精品亚洲| 日韩av在线发布| 国产剧情一区二区| av中文字幕一区| 欧美日韩国产高清一区| 日韩一区二区精品| 中文一区二区在线观看| 亚洲男人天堂av| 免费的成人av| 成人激情午夜影院| 欧美猛男男办公室激情| 久久亚洲捆绑美女| 亚洲精品国产精华液| 美日韩一区二区| 成人av先锋影音| 欧美一区二区久久久| 中文字幕第一页久久| 亚洲成人免费观看| 成人性色生活片免费看爆迷你毛片| 91网站在线观看视频| 日韩一区二区三区免费看 | 亚洲小少妇裸体bbw| 日韩成人av影视| 99免费精品视频| 精品欧美黑人一区二区三区| 日韩伦理av电影| 经典三级视频一区| 在线亚洲免费视频| 国产日产欧美一区二区三区 | 欧美电影在哪看比较好| 久久色中文字幕| 亚洲成av人在线观看| 成人在线视频一区二区| 9191久久久久久久久久久| 1区2区3区精品视频| 蜜桃免费网站一区二区三区| 精品久久久久久久人人人人传媒| 最新国产精品久久精品| 九九久久精品视频| 欧美亚洲动漫制服丝袜| 国产精品每日更新在线播放网址| 久久国产精品99久久人人澡| 在线视频国内一区二区| 成人欧美一区二区三区黑人麻豆 | 国产精品精品国产色婷婷| 日本欧美在线观看| 欧美日韩国产综合一区二区| 自拍偷拍亚洲激情| 91美女片黄在线观看| 国产精品乱码一区二三区小蝌蚪| 国产米奇在线777精品观看| 欧美va日韩va| 久久国产精品第一页| 日韩精品中文字幕一区| 日韩av中文在线观看| 欧美一区国产二区| 日韩高清国产一区在线| 欧美剧情电影在线观看完整版免费励志电影 | 激情六月婷婷综合| 欧美成人精精品一区二区频| 蜜臀精品一区二区三区在线观看| 欧美伦理影视网| 日韩 欧美一区二区三区| 欧美久久久久中文字幕| 青青草国产精品97视觉盛宴| 欧美一区二区视频在线观看2022| 日韩美女视频一区| 99精品视频免费在线观看| 中文字幕第一区综合| 91影院在线观看| 亚洲卡通动漫在线| 7777精品伊人久久久大香线蕉超级流畅 | 国产精品一区一区| 国产精品久久久久久久裸模 | 亚洲一区二区美女| 欧美日韩高清一区二区三区| 日韩激情一二三区| 久久丝袜美腿综合| 99精品久久久久久| 香蕉加勒比综合久久 | 国产乱码精品一区二区三区忘忧草| 精品国产乱码久久久久久闺蜜 | 亚洲小说春色综合另类电影| 欧美日韩久久一区| 色噜噜夜夜夜综合网| 午夜精品福利视频网站| xnxx国产精品| 99视频一区二区| 天天av天天翘天天综合网| 欧美精品一区二区久久久| 成人一区二区三区在线观看| 一区二区欧美在线观看| 欧美电影免费观看高清完整版在线| 国产成人啪午夜精品网站男同| 亚洲免费视频成人| 26uuu亚洲综合色欧美| 91久久精品国产91性色tv| 理论片日本一区| 亚洲日本在线天堂| 日韩欧美高清dvd碟片| aaa欧美日韩| 久久国内精品自在自线400部| 亚洲精品日韩综合观看成人91| 日韩欧美国产午夜精品| 色成年激情久久综合| 国产精品一级片| 视频一区二区中文字幕| 中文字幕日韩欧美一区二区三区| 日韩免费观看2025年上映的电影| 91麻豆精东视频| 国产乱码精品一区二区三区五月婷| 性做久久久久久免费观看| 国产精品看片你懂得| 精品国偷自产国产一区| 欧美天堂亚洲电影院在线播放 | 国产精品麻豆视频| 日韩免费成人网| 精品视频一区二区不卡| 色综合色狠狠天天综合色| 岛国av在线一区| 国产麻豆欧美日韩一区| 麻豆精品一区二区三区| 午夜av区久久| 亚洲一卡二卡三卡四卡五卡| 国产精品久久久久久久久动漫 | 欧洲亚洲精品在线| 成人av网站在线观看| 国产夫妻精品视频| 国产精品白丝av| 国产一区二区精品久久99| 日韩avvvv在线播放| 图片区小说区国产精品视频| 亚洲一区二区中文在线| 亚洲电影在线播放| 亚洲制服丝袜av| 亚洲福利一二三区| 日韩精品亚洲一区| 免费在线观看成人| 精品一区二区三区香蕉蜜桃| 青青草国产成人99久久| 久久99国产精品尤物| 国产制服丝袜一区| 国产美女久久久久| 成人性色生活片免费看爆迷你毛片| 国产成人免费视频| 不卡视频一二三| 91激情在线视频| 欧美日韩成人激情| 精品美女在线观看| 中文久久乱码一区二区| 国产精品久久一级| 一区二区三区四区在线| 天堂va蜜桃一区二区三区 | 国产精品亚洲综合一区在线观看| 国产高清精品网站| 91激情在线视频| 欧美一区二区三区免费视频| 亚洲精品一线二线三线无人区| 久久嫩草精品久久久精品| 中文字幕制服丝袜成人av| 亚洲午夜视频在线| 国内精品在线播放| 99久久久精品免费观看国产蜜| 欧美午夜精品久久久久久超碰| 日韩一级欧美一级| 中文字幕在线免费不卡| 日本va欧美va精品| caoporn国产精品| 欧美一区永久视频免费观看| 久久综合久久综合久久| 一区二区三区免费看视频| 麻豆91精品视频| 色噜噜狠狠色综合中国| 日韩视频一区二区三区在线播放 | 91麻豆免费观看| 日韩一区二区三区电影| 国产精品人人做人人爽人人添| 亚洲国产日韩av| 不卡在线视频中文字幕| 5566中文字幕一区二区电影| 国产精品久久看| 精品制服美女丁香|