The suspected violation of this floor has been folded by the system   Hide this building view this building

public void changeback()

{

switch(MODE)

{

case 0:o[X+2][Y]--;

o[X+2][Y+1]--;

o[X+2][Y+2]--;

o[X+2][Y+3]--;

o[X][Y+1]++;

o[X+1][Y+1]++;

o[X+2][Y+1]++;

o[X+3][Y+1]++;

MODE=1;

break;

case 1:o[X][Y+1]--;

o[X+1][Y+1]--;

o[X+2][Y+1]--;

o[X+3][Y+1]--;

o[X+2][Y]++;

o[X+2][Y+1]++;

o[X+2][Y+2]++;

o[X+2][Y+3]++;

MODE=0;

break;

case 2:o[X+2][Y]--;

o[X+2][Y+1]--;

o[X+2][Y+2]--;

o[X+1][Y+2]--;

o[X][Y]++;

o[X][Y+1]++;

o[X+1][Y+1]++;

o[X+2][Y+1]++;

MODE=3;

break;

case 3:o[X][Y]--;

o[X][Y+1]--;

o[X+1][Y+1]--;

o[X+2][Y+1]--;

o[X+1][Y]++;

o[X+2][Y]++;

o[X+1][Y+1]++;

o[X+1][Y+2]++;

MODE=4;

break;

case 4:o[X+1][Y]--;

o[X+2][Y]--;

o[X+1][Y+1]--;

o[X+1][Y+2]--;

o[X][Y]++;

o[X+1][Y]++;

o[X+2][Y]++;

o[X+2][Y+1]++;

MODE=5;

break;

case 5:o[X][Y]--;

o[X+1][Y]--;

o[X+2][Y]--;

o[X+2][Y+1]--;

o[X+2][Y]++;

o[X+2][Y+1]++;

o[X+2][Y+2]++;

o[X+1][Y+2]++;

MODE=2;

break;

case 6:o[X+1][Y]--;

o[X+1][Y+1]--;

o[X+1][Y+2]--;

o[X+2][Y+2]--;

o[X+1][Y]++;

o[X+2][Y]++;

o[X+3][Y]++;

o[X+1][Y+1]++;

MODE=9;

break;

case 7:o[X][Y+1]--;

o[X+1][Y+1]--;

o[X+2][Y+1]--;

o[X+2][Y]--;

o[X+1][Y]++;

o[X+1][Y+1]++;

o[X+1][Y+2]++;

o[X+2][Y+2]++;

MODE=6;

break;

case 8:o[X+1][Y]--;

o[X+2][Y]--;

o[X+2][Y+1]--;

o[X+2][Y+2]--;

o[X][Y+1]++;

o[X+1][Y+1]++;

o[X+2][Y+1]++;

o[X+2][Y]++;

MODE=7;

break;

case 9:o[X+1][Y]--;

o[X+2][Y]--;

o[X+3][Y]--;

o[X+1][Y+1]--;

o[X+1][Y]++;

o[X+2][Y]++;

o[X+2][Y+1]++;

o[X+2][Y+2]++;

MODE=8;

break;

case 10:o[X+1][Y]--;

o[X+1][Y+1]--;

o[X+2][Y+1]--;

o[X+2][Y+2]--;

o[X+2][Y]++;

o[X+3][Y]++;

o[X+1][Y+1]++;

o[X+2][Y+1]++;

MODE=11;

break;

case 11:o[X+2][Y]--;

o[X+3][Y]--;

o[X+1][Y+1]--;

o[X+2][Y+1]--;

o[X+1][Y]++;

o[X+1][Y+1]++;

o[X+2][Y+1]++;

o[X+2][Y+2]++;

MODE=10;

break;

case 12:o[X+1][Y+1]--;

o[X+2][Y+1]--;

o[X+1][Y+2]--;

o[X+2][Y]--;

o[X+1][Y]++;

o[X+2][Y]++;

o[X+2][Y+1]++;

o[X+3][Y+1]++;

MODE=13;

break;

case 13:o[X+1][Y]--;

o[X+2][Y]--;

o[X+2][Y+1]--;

o[X+3][Y+1]--;

o[X+1][Y+1]++;

o[X+2][Y+1]++;

o[X+1][Y+2]++;

o[X+2][Y]++;

MODE=12;

break;

case 14:o[X+1][Y]=1;

o[X+2][Y]=1;

o[X+1][Y+1]=1;

o[X+2][Y+1]=1;

break;

}

}

public void keyPressed(KeyEvent e)

{

if (e.getKeyCode()==KeyEvent.VK_LEFT)left();

else if(e.getKeyCode()==KeyEvent.VK_RIGHT)right();

else if(e.getKeyCode()==KeyEvent.VK_UP) change();

else if(e.getKeyCode()==KeyEvent.VK_DOWN) down();;

repaint();

//nextMODE=(int)(Math.random()*14);

}

public void keyReleased(KeyEvent e) {}

public void keyTyped(KeyEvent e) {}

public void run()

{

while(true)

{

// int i=0;

this.repaint();

down();

try{

Thread.sleep(300/LEVEL);

}

catch (Exception e){};

//System.out.println(this.X);

}//true

}

public static void main(String[] args)

{

Els e=new Els();

Thread t=new Thread(e);

e.addKeyListener(e);

e.setVisible(true);

t.start();

}

private int o[][]={

{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},

{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},

}

;

private int p[][]=new int[4][4];

private int q[]=new int[12];

private int MODE=14;//(int)(Math.random()*14);

private int nextMODE=(int)(Math.random()*14);

private int X=5;

private int Y=0;

private int LEVEL=1;

private int SCORE=0;

}

Technology