⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gameworld.java

📁 控制移到机器人的例子程序
💻 JAVA
字号:
import java.lang.*;
import java.util.*;
import java.io.*;

public class GameWorld extends java.lang.Object implements Serializable
{
    static final long serialVersionUID = 501;
    public int maze[][][];
    public int height; /* aligned with north, direction 0 */
    public int width;
    public int teamHeadCount;
    public int[] myLocation; /* array: {x,y,direction} */
    public Vector nuggets; /*
                nuggets in a cell are arrays: {x,y}
                nuggets on a wall are described by the two
                    cells the wall separates: {x1,y1,x2,y2} */
    public Vector ports; /* port positions; array: {x,y} */
    
    /* constructor: give it a maze to create a gameworld */
    public GameWorld(int maze[][][]) {
        this.maze = maze;
        this.myLocation = new int[] {0,0,0};
        this.teamHeadCount = 1;
        this.nuggets = new Vector();
        this.ports = new Vector();
    }
    /* another constructor: give it everything except onions */
    public GameWorld(int maze[][][], int[] myLocation, int teamHeadCount,
                     Vector nuggets, Vector ports) {
        this.maze = maze;
        this.myLocation = new int[] {myLocation[0], myLocation[1], myLocation[2]};
        this.teamHeadCount = teamHeadCount;
        this.nuggets = (Vector) nuggets.clone();
        this.ports = (Vector) ports.clone();
    }
} /* end of class GameWorld */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -