- Visual C++源码
- Visual Basic源码
- C++ Builder源码
- Java源码
- Delphi源码
- C/C++源码
- PHP源码
- Perl源码
- Python源码
- Asm源码
- Pascal源码
- Borland C++源码
- Others源码
- SQL源码
- VBScript源码
- JavaScript源码
- ASP/ASPX源码
- C#源码
- Flash/ActionScript源码
- matlab源码
- PowerBuilder源码
- LabView源码
- Flex源码
- MathCAD源码
- VBA源码
- IDL源码
- Lisp/Scheme源码
- VHDL源码
- Objective-C源码
- Fortran源码
- tcl/tk源码
- QT源码
Eight.java
资源名称:Java.rar [点击查看]
上传用户:liming9091
上传日期:2014-10-27
资源大小:3376k
文件大小:2k
源码类别:
Java编程
开发平台:
Java
- package russiagame;
- public class Eight extends Root
- {
- private GameTable gTable;
- private int x,y;
- private int direct=1;
- private int[] store;
- public Eight()
- {
- store=new int[15];
- }
- public boolean begin()
- {
- if(gTable.myTable[(gTable.x-1)/2][0]==0)
- {
- x=(gTable.x-1)/2;
- y=0;
- gTable.myTable[x][y]=1;
- return true;
- }
- else
- {
- return false;
- }
- }
- public boolean down()
- {
- if(y<=gTable.y-2)
- {
- store[0]=gTable.myTable[x][y+1];
- if(isGo(1))
- {
- gTable.myTable[x][y]=0;
- gTable.myTable[x][y+1]=1;
- y+=1;
- return true;
- }
- else
- {
- return false;
- }
- }
- else
- {
- return false;
- }
- }
- public boolean left()
- {
- if(x>=1)
- {
- store[0]=gTable.myTable[x-1][y];
- if(isGo(1))
- {
- gTable.myTable[x][y]=0;
- gTable.myTable[x-1][y]=1;
- x-=1;
- return true;
- }
- else
- {
- return false;
- }
- }
- else
- {
- return false;
- }
- }
- public boolean right()
- {
- if(x<=gTable.x-2)
- {
- store[0]=gTable.myTable[x+1][y];
- if(isGo(1))
- {
- gTable.myTable[x][y]=0;
- gTable.myTable[x+1][y]=1;
- x+=1;
- return true;
- }
- else
- {
- return false;
- }
- }
- else
- {
- return false;
- }
- }
- public boolean change()
- {
- return true;
- }
- public void downTo()
- {
- boolean canDown=true;
- while(canDown)
- {
- canDown=down();
- }
- }
- public boolean isGo(int n)
- {
- for(int i=0;i<=(n-1);i++)
- {
- if(store[i]!=0)
- return false;
- }
- return true;
- }
- public static void main(String args[])
- {
- new Eight();
- }
- }