📄 gameoflife.java
字号:
package gameoflife;
import java.util.Random;
import graphics.GraphicsFrame;
public class GameOfLife
{
public static void main(String[] args) throws InterruptedException
{
int a = 10;
int b = 20;
int c;
c = (b == a ? b : a);
System.out.println(c);
if(1 == 1) return ;
// The size of the world
int columns = 300;
int rows = 180;
// Each cell will have width and length = cellPadding
int cellPadding = 3;
// The number of LifeForms to begin with
int numLifeForms = 10;
// Set this to false to run the game sequentially.
// If the game is run on a computer with multiple cores, then the
// speed difference should obvious.
boolean parallel = true;
Xenomorph[] lifes = new Xenomorph[numLifeForms];
Random rand = new Random();
// Generate some xeno that will be placed randomly
for(int i = 0; i <numLifeForms; i++)
{
int x = rand.nextInt(5);
int y = rand.nextInt(5);
switch(i % 4) {
case 0:
lifes[i] = Xenomorph.createChestburster(x, y);
break;
case 1:
lifes[i] = Xenomorph.createDrone(x, y);
break;
case 2:
lifes[i] = Xenomorph.createRunner(x, y);
break;
case 3:
lifes[i] = Xenomorph.createPraetorian(x, y);
break;
}
}
// Start the Game of life
GraphicsFrame fr = new GraphicsFrame("Game of Life (Xeno Tactic V.me)" ,
new GamePanel(columns, rows, cellPadding, lifes, parallel));
fr.setVisible(true);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -