/*------------------------------------------------------------------------------
Development Notes:
Greedy Snake Game Testing Version
Based on LinkList StrUCture
Direction Control Keys are: w a s d
@DanielNW2004-----------------------------------------------------------------*/
import Javax.swing.*; // the Java eXtensions "Swing" graphics kit
import java.awt.*; // the Java Abstract Windowing Toolkit
import java.awt.image.*;// the AWT image package
import java.awt.geom.*; // AWT geometry
import java.io.*; // I/O package
import java.awt.event.*;
public class snake extends JFrame implements KeyListener
{
public static final int DISPLAY_WIDTH = 640;
public static final int DISPLAY_HEIGHT = 640;
public static final int BLOCKNUM = 80;
public int currDir = 1;
public CanvasArea ca = new CanvasArea(DISPLAY_WIDTH/8,DISPLAY_HEIGHT/8);
public Container con = null;
public int flag = 0, foodNum = 4, speed = 80;
public CellItem temp = new CellItem();
public static void main(String[] args)
{
new snake();
}
public snake() {
super("Greedy Snake Program Testing");
setDefaultCloseOperation(EXIT_ON_CLOSE);
setResizable(false);
con = getContentPane();
con.setLayout(null);
addKeyListener( this ); // make this object be the one to listen to keyboard
//----------------------------------------------------------------
//Matrix of the canvas
//----------------------------------------------------------------
ca.canvasInit();
ca.addFood(ca.caStr[30][32],2);
ca.addFood(ca.caStr[18][9],2);
ca.addFood(ca.caStr[10][20],2);
ca.addFood(ca.caStr[10][15],2);
//ca.displayMatrix();
ca.addCell(ca.caStr[1][0],1);
ca.addCell(ca.caStr[1][1],1);
ca.addCell(ca.caStr[1][2],1);
ca.addCell(ca.caStr[1][3],1);
ca.addCell(ca.caStr[1][4],1);
ca.addCell(ca.caStr[2][4],1);
ca.moveLeft();
//ca.moveUp();
//ca.moveUp();
//ca.moveUp();
//ca.moveUp();
//ca.moveUp();
//ca.moveUp();
ca.displaySnake();
//----------------------------------------------------------------
DisplayArea da =
new DisplayArea( new Rectangle( 0, 0, DISPLAY_WIDTH, DISPLAY_HEIGHT ) );
con.add ( da );
setVisible(true);