first commit
This commit is contained in:
155
CS1322/p6/Krystian/WallPiece.java
Normal file
155
CS1322/p6/Krystian/WallPiece.java
Normal file
@@ -0,0 +1,155 @@
|
||||
/**
|
||||
* CS1322: Programming Assignment #6 - Fall 2002
|
||||
*
|
||||
* <PRE>
|
||||
* IDBox for: WallPiece.java
|
||||
*
|
||||
* Revisions: 1.0 Nov. 21, 2002
|
||||
* Created the WallPiece class
|
||||
*
|
||||
* </PRE>
|
||||
*
|
||||
* Collaboration statement:
|
||||
* "I worked on the homework assignment alone, using only
|
||||
* course materials."
|
||||
*
|
||||
* @author
|
||||
<A HREF="mailto:gtg142g@mail.gatech.edu">Roland Krystian Alberciak</A>
|
||||
* @version Version 1.0, Nov. 21, 2002
|
||||
*/
|
||||
|
||||
// imports are listed above IDBox
|
||||
|
||||
/**
|
||||
* MODEL.
|
||||
* Gamepiece. Wallpiece extends GamePiece.
|
||||
* Adds the functionality of a wall on the game board.
|
||||
* Neither ghosts nor Pacman can travel on or through walls.
|
||||
* They can only travel on FloorPieces.
|
||||
*/
|
||||
|
||||
public class WallPiece extends GamePiece
|
||||
{
|
||||
/** Debug value for toggling System.out.* output */
|
||||
public static boolean DEBUG = false;
|
||||
public static boolean DEBUG_MAIN = false;
|
||||
|
||||
/*
|
||||
// =======================================================================
|
||||
// Constructors
|
||||
// =======================================================================
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructor 1. Specified default-overriding constructor for WallPiece.
|
||||
* @param void No parameters.
|
||||
* @return WallPiece instance/object.
|
||||
*
|
||||
public WallPiece()
|
||||
{
|
||||
|
||||
} //end of WallPiece()
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructor 1. Specified default-overriding constructor for WallPiece.
|
||||
* @param x the location along the x-axis.
|
||||
* @param y the location along the y-axis.
|
||||
* @return WallPiece instance/object.
|
||||
*/
|
||||
public WallPiece(int x, int y)
|
||||
{
|
||||
super(x,y); //Chains to the super constructor (GamePiece)
|
||||
} //end of WallPiece(int, int)
|
||||
|
||||
/*
|
||||
// =======================================================================
|
||||
// Methods which override class Object methods
|
||||
// =======================================================================
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Equal instance comparison. Compares if two instances are equal.
|
||||
* @param o object-type reference of (hopefully) an WallPiece.
|
||||
* @return boolean whether objects are equal.
|
||||
*
|
||||
public boolean equals (Object o)
|
||||
{
|
||||
|
||||
} //end of equals(Object)
|
||||
*/
|
||||
|
||||
/**
|
||||
* toString instance printer. Prints properties of WallPiece.
|
||||
* @return System.out.println(WallPiece instance) instance print.
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
String result="";
|
||||
|
||||
result= P6Constants.WALL;
|
||||
|
||||
result= result+" "; //cleanup, autoprepare for output
|
||||
return result;
|
||||
} //end of toString()
|
||||
|
||||
|
||||
/*
|
||||
// =======================================================================
|
||||
// Class specific methods local to this instance
|
||||
// =======================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
// =======================================================================
|
||||
// Methods dealing directly with the data within this instance
|
||||
// (accessors, modifiers, etc)
|
||||
// =======================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
// =======================================================================
|
||||
// Private Variables local to this instance
|
||||
// =======================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
// =======================================================================
|
||||
// Main method (overrides this commenting system for readibility reasons)
|
||||
// =======================================================================
|
||||
*/
|
||||
|
||||
/**
|
||||
* Debugging main for class WallPiece.
|
||||
* This method will rigorously test my code.
|
||||
*
|
||||
* <br><br>
|
||||
* @param args a String array of command line arguments.
|
||||
*/
|
||||
public static void main(String[] args)
|
||||
{
|
||||
|
||||
if ( (args.length==1) && (args[0].equals("-db") ) )
|
||||
DEBUG_MAIN=true; //else leave false: ignore input.
|
||||
|
||||
if (DEBUG_MAIN)
|
||||
{ // NOTE: This {} encapsulates most of main and is leftmost margin as a flag.
|
||||
// redundant ifs left in, in case the main if(DEBUG) statement was ommitted,
|
||||
// this would then print out neat output, as an example of real running.
|
||||
|
||||
WallPiece w1 = new WallPiece(1,5);
|
||||
|
||||
System.out.println(w1);
|
||||
|
||||
|
||||
|
||||
if (DEBUG) System.out.println("end main(String[] args) call:");
|
||||
} //end of DEBUG if
|
||||
|
||||
} //end of main(String[] args)
|
||||
|
||||
} //end of class WallPiece
|
||||
Reference in New Issue
Block a user