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

📄 mazemanager.java

📁 Java吃豆子游戏
💻 JAVA
字号:
package org.loon.test;
/**
 * 
 * <p>Title: LoonFramework</p>
 * <p>Description:</p>
 * <p>Copyright: Copyright (c) 2008</p>
 * <p>Company: LoonFramework</p>
 * <p>License: http://www.apache.org/licenses/LICENSE-2.0</p>
 * @author chenpeng  
 * @email:ceponline@yahoo.com.cn 
 * @version 0.1
 */
public class MazeManager {
	long build[] = {
	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
	0,3,5,5,5,7,5,5,5,6,0,3,5,5,5,7,5,5,5,6,0,
	0,10,0,0,0,10,0,0,0,10,0,10,0,0,0,10,0,0,0,10,0,
	0,10,0,0,0,10,0,0,0,10,0,10,0,0,0,10,0,0,0,10,0,
	0,10,0,0,0,10,0,0,0,10,0,10,0,0,0,10,0,0,0,10,0,
	0,11,5,5,5,15,5,7,5,13,5,13,5,7,5,15,5,5,5,14,0,
	0,10,0,0,0,10,0,10,0,0,0,0,0,10,0,10,0,0,0,10,0,
	0,10,0,0,0,10,0,10,0,0,0,0,0,10,0,10,0,0,0,10,0,
	0,9,5,5,5,14,0,9,5,6,0,3,5,12,0,11,5,5,5,12,0,
	0,0,0,0,0,10,0,0,0,10,0,10,0,0,0,10,0,0,0,0,0,
	0,0,0,0,0,10,0,3,5,13,5,13,5,6,0,10,0,0,0,0,0,
	0,0,0,0,0,10,0,10,0,0,0,0,0,10,0,10,0,0,0,0,0,
	0,0,0,0,0,10,0,10,0,0,0,0,0,10,0,10,0,0,0,0,0,
	5,5,5,5,5,15,5,14,0,0,0,0,0,11,5,15,5,5,5,5,5,
	0,0,0,0,0,10,0,10,0,0,0,0,0,10,0,10,0,0,0,0,0,
	0,0,0,0,0,10,0,11,5,5,5,5,5,14,0,10,0,0,0,0,0,
	0,0,0,0,0,10,0,10,0,0,0,0,0,10,0,10,0,0,0,0,0,
	0,0,0,0,0,10,0,10,0,0,0,0,0,10,0,10,0,0,0,0,0,
	0,3,5,5,5,15,5,13,5,6,0,3,5,13,5,15,5,5,5,6,0,
	0,10,0,0,0,10,0,0,0,10,0,10,0,0,0,10,0,0,0,10,0,
	0,9,5,6,0,11,5,7,5,13,5,13,5,7,5,14,0,3,5,12,0,
	0,0,0,10,0,10,0,10,0,0,0,0,0,10,0,10,0,10,0,0,0,
	0,0,0,10,0,10,0,10,0,0,0,0,0,10,0,10,0,10,0,0,0,
	0,3,5,13,5,12,0,9,5,6,0,3,5,12,0,9,5,13,5,6,0,
	0,10,0,0,0,0,0,0,0,10,0,10,0,0,0,0,0,0,0,10,0,
	0,9,5,5,5,5,5,5,5,13,5,13,5,5,5,5,5,5,5,12,0,
	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
	}; 

	long build2[] = {
	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
	0,3,5,5,5,7,5,5,5,6,0,3,5,5,5,7,5,5,5,6,0,
	0,10,0,0,0,10,0,0,0,10,0,10,0,0,0,10,0,0,0,10,0,
	0,10,0,0,0,10,0,0,0,10,0,10,0,0,0,10,0,0,0,10,0,
	0,10,0,0,0,10,0,0,0,10,0,10,0,0,0,10,0,0,0,10,0,
	0,11,5,5,5,15,5,7,5,13,5,13,5,7,5,15,5,5,5,14,0,
	0,10,0,0,0,10,0,10,0,0,0,0,0,10,0,10,0,0,0,10,0,
	0,10,0,0,0,10,0,10,0,0,0,0,0,10,0,10,0,0,0,10,0,
	0,9,5,5,5,14,0,9,5,6,0,3,5,12,0,11,5,5,5,12,0,
	0,0,0,0,0,10,0,0,0,2,0,2,0,0,0,10,0,0,0,0,0,
	0,0,0,0,0,10,0,3,5,5,5,5,5,6,0,10,0,0,0,0,0,
	0,0,0,0,0,10,0,10,0,0, 8,0,0,10,0,10,0,0,0,0,0,
	0,0,0,0,0,10,0,10,0,3,15,6,0,10,0,10,0,0,0,0,0,
	5,5,5,5,5,15,5,14,0,9,13,12,0,11,5,15,5,5,5,5,5,
	0,0,0,0,0,10,0,10,0,0,0,0,0,10,0,10,0,0,0,0,0,
	0,0,0,0,0,10,0,11,5,5,5,5,5,14,0,10,0,0,0,0,0,
	0,0,0,0,0,10,0,10,0,0,0,0,0,10,0,10,0,0,0,0,0,
	0,0,0,0,0,10,0,10,0,0,0,0,0,10,0,10,0,0,0,0,0,
	0,3,5,5,5,15,5,13,5,6,0,3,5,13,5,15,5,5,5,6,0,
	0,10,0,0,0,10,0,0,0,2,0,2,0,0,0,10,0,0,0,10,0,
	0,9,5,6,0,11,5,7,5,5,5,5,5,7,5,14,0,3,5,12,0,
	0,0,0,10,0,10,0,10,0,0,0,0,0,10,0,10,0,10,0,0,0,
	0,0,0,10,0,10,0,10,0,0,0,0,0,10,0,10,0,10,0,0,0,
	0,3,5,13,5,12,0,9,5,6,0,3,5,12,0,9,5,13,5,6,0,
	0,10,0,0,0,0,0,0,0,10,0,10,0,0,0,0,0,0,0,10,0,
	0,9,5,5,5,5,5,5,5,13,5,13,5,5,5,5,5,5,5,12,0,
	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
	};
	int width, height; 

  public MazeManager() {
	width = 21; height = build.length / width;
  }

  public void openTunnel() {
        build2[21*13+5] = 15;
        build2[21*13+15] = 15;
  }
  public void closeTunnel() {
      build2[21*13+5] = 11;
      build2[21*13+15] = 14;
  }

  public int onWay(int pos, int d) {
	int tg=0;
	if ((build2[pos]&1)==1) {if (d!=4) tg=tg+1;}
	if ((build2[pos]&2)==2) {if (d!=8) tg=tg+2;}
	if ((build2[pos]&4)==4) {if (d!=1) tg=tg+4;}
	if ((build2[pos]&8)==8) {if (d!=2) tg=tg+8;}
	return tg;
  }
  public int onWay2(int pos, int d) {
	int tg=0;
	if ((build[pos]&1)==1) {if (d!=4) tg=tg+1;}
	if ((build[pos]&2)==2) {if (d!=8) tg=tg+2;}
	if ((build[pos]&4)==4) {if (d!=1) tg=tg+4;}
	if ((build[pos]&8)==8) {if (d!=2) tg=tg+8;}
	return tg;
  }

  public int onWay(int x, int y, int d) {
	return onWay(x+y*width, d);
  }

}

⌨️ 快捷键说明

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