1、画 MAP 类:package s1java.xmal1;public class Map int map=new int100; /0:普通int luckyTurn=6,23,40,55,69,83; /1:幸运轮盘int landMine=5,13,17,33,38,50,64,80,94;/2:地雷int pause=9,27,60,93; /3:暂停int timeTunnel=20,25,45,63,72,88,90; /4:时空隧道/给 map写入各种符号public void createMap()for(int i=0;i=start;i-)System.out.print(
2、getGraph(mapi,i,playerPos1,playerPos2);System.out.println();public void showLLine(int start,int end,int playerPos1,int playerPos2)for(int i=start;i99)return 99;switch(map.mapposition)case 0:/普通格if(no=1System.out.println(“:-D 哈哈哈.踩到了!“);else if(no=2System.out.println(“:-D 哈哈哈.踩到了!“);break;case 1:/幸运轮
3、盘System.out.println(“n欢迎进入幸运轮盘“);System.out.println(“请选择一种运气:“);System.out.println(“1.交换位置 2.轰炸对手“);int choice=input.nextInt();int temp;switch(choice)case 1: /交换位置if(no=1)temp=position;position=playerPos2;playerPos2=temp;else if(no=2)temp=position;position=playerPos1;playerPos1=temp;break;case 2: /轰
4、炸对手if(no=1)if(playerPos2_99)return 99;elsereturn position;public void judge()if(playerPos1playerPos2)System.out.println(“玩家 1“+playerName0+“最先到达终点,获得胜利。恭喜!恭喜!“);elseSystem.out.println(“玩家 2“+playerName1+“最先到达终点,获得胜利。恭喜!恭喜!“);public void play()System.out.println(“nnnn“);System.out.println(“nn“);Syste
5、m.out.println(“ Game Start n“);System.out.println(“nn“);System.out.println(“_“+playerName0+“的士兵: A“);System.out.println(“_“+playerName1+“的士兵: Bn“);System.out.println(“n 图例:“+“ 暂停 幸运轮盘 地雷 时空隧道 普通n“);map.showMap(playerPos1, playerPos2);int step;while(playerPos199System.out.println(“n-“);System.out.pri
6、ntln(“骰子数“+step);playerPos1=getCurPos(1,playerPos1,step);System.out.println(“你“+playerName0+“当前的位置:“+playerPos1);System.out.println(“对手“+playerName1+“当前的位置:“+playerPos2);System.out.println(“n-“);map.showMap(playerPos1, playerPos2);if(playerPos1=99)break;elseSystem.out.println(“n“+playerName0+“停掷一次。n
7、“);goAndStop0=“on“;System.out.println(“nnnn“);if(goAndStop1.equals(“on“)step= throwShifter(2);System.out.println(“n-“);System.out.println(“骰子数“+step);playerPos2=getCurPos(2,playerPos2,step);System.out.println(“你“+playerName1+“当前的位置:“+playerPos2);System.out.println(“对手“+playerName0+“当前的位置:“+playerPos
8、1);System.out.println(“n-“);map.showMap(playerPos1, playerPos2);if(playerPos2=99)break;elseSystem.out.println(“n“+playerName1+“停掷一次。n“);goAndStop1=“on“; System.out.println(“nnnn“);System.out.println(“nnnn“);System.out.println(“n*n“);System.out.println(“ Game Over n“);System.out.println(“*nn“);judge(
9、); public void start()init();System.out.println(“n“);System.out.println(“/ /“);System.out.println(“/ /“);System.out.println(“/ 骑士飞行棋 /“);System.out.println(“/ /“);System.out.println(“/ /“);System.out.println(“);System.out.println(“两人对战“);System.out.println(“请选择角色:1.比尔 2.奥巴马 3.普京 4.布朗“);System.out.println(“请玩家 1 选择角色:“);int role1=input.nextInt();int role2;doSystem.out.println(“请玩家 2 选择角色:“);role2=input.nextInt();while(role2=role1);setRole(1,role1);setRole(2,role2);play();主方法类:package s1java.xmal1;public class StartGame public static void main(String args) Game game=new Game();game.start();