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

📄 square.java

📁 我自己写的一个java tetrix。是上学期的作业
💻 JAVA
字号:
import java.util.*;
import java.io.*;

/** the square class. include its generate method  and the check methods. */
public class square extends block
{
 /** generate new block using the row[4],col[4] to store the location of the new block. */
       public square()
      {
		  tile[0][4]='*';
		  tile[0][5]='*';
		  tile[1][4]='*';
		  tile[1][5]='*';

		  row[0]=0; col[0]=4;
		  row[1]=0; col[1]=5;
		  row[2]=1; col[2]=4;
		  row[3]=1; col[3]=5;

          left = true;
          right = true;
          down = true;
	  }

/** square block does not need rotate. */
	public void rotate()
	{
	}

/** unlike the Move_Downward,Left,Right methods,Check and Rotation is different depend on the shape and position of the block. */
   public void  check()
    {

       if(col[0]==0)
          left =false;
       else if((tile[row[0]][col[0]-1]!=' ')||(tile[row[2]][col[2]-1]!=' ') )
          left = false;


       if(col[1]==bwidth-1)
         right = false;
	   else if((tile[row[1]][col[1]+1]!=' ')||(tile[row[3]][col[3]+1]!=' ') )
	      right = false;

       if(row[2]==bheight-1)
          down = false;
	   else if((tile[row[2]+1][col[2]]!=' ')||(tile[row[3]+1][col[3]]!=' ') )
	      down = false;

	}




}

⌨️ 快捷键说明

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