first commit

This commit is contained in:
Jose Caban
2025-06-07 01:59:34 -04:00
commit 388ac241f0
3558 changed files with 9116289 additions and 0 deletions

View File

@@ -0,0 +1,233 @@
/**
* CS1322: Programming Assignment #6 - Fall 2002
*
* <PRE>
* IDBox for: FloorPiece.java
*
* Revisions: 1.0 Nov. 21, 2002
* Created the FloorPiece 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.
* Floorpiece. Floorpiece extends GamePiece.
* Adds the functionality of nibbles (The dots that Pacman eats).
* Each FloorPiece can have a regular nibble, a special nibble
* (one that allows Pacman to chase the ghosts),
* or neither (but not both).
*/
public class FloorPiece 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 FloorPiece.
* @param void No parameters.
* @return FloorPiece instance/object.
*
public FloorPiece()
{
} //end of FloorPiece()
*/
/**
* Constructor 2. Specified default-overloading constructor for FloorPiece.
* Takes in the location and storage of a FloorPiece::GamePiece object
* @param x the location along the x-axis.
* @param y the location along the y-axis.
* @param hasNibble whether this FloorPiece should have a nibble
* @param hasSpecial whether this FloorPiece should have a special
* @return FloorPiece instance/object.
*/
public FloorPiece(int x, int y, boolean hasNibble, boolean hasSpecial)
{
// STUB
//if then for if both are true? override with hasSpecial=true;
super(x,y); //Chains to the super constructor. (GamePiece)
this.setNibble(hasNibble);
this.setSpecial(hasSpecial);
} //end of FloorPiece(int, int, boolean, boolean)
/*
// =======================================================================
// Methods which override class Object methods
// =======================================================================
*/
/**
* Equal instance comparison. Compares if two instances are equal.
* @param o object-type reference of (hopefully) an FloorPiece.
* @return boolean whether objects are equal.
*
public boolean equals (Object o)
{
} //end of equals(Object)
*/
/**
* toString instance printer. Prints properties of FloorPiece.
* @return System.out.println(FloorPiece instance) instance print.
*/
public String toString()
{
String result="";
if ( (getNibble()==false) && (getSpecial()==false) )
result= P6Constants.FLOOR;
else if ( (getNibble()==true) && (getSpecial()==false) )
result= P6Constants.NIBBLE;
else if ( (getNibble()==false) && (getSpecial()==true) )
result= P6Constants.SPECIAL;
else //if ( (getNibble()==true) && (getSpecial()==true) )
result= "E"; //for error. Flag to programmer.
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)
// =======================================================================
*/
/**
* Get the value of hasNibble.
* @return value of hasNibble.
*/
public boolean getNibble()
{
return hasNibble;
}
/**
* Set the value of hasNibble.
* @param v Value to assign to hasNibble.
*/
public void setNibble(boolean v)
{
this.hasNibble = v;
}
/**
* Get the value of hasSpecial.
* @return value of hasSpecial.
*/
public boolean getSpecial()
{
return hasSpecial;
}
/**
* Set the value of hasSpecial.
* @param v Value to assign to hasSpecial.
*/
public void setSpecial(boolean v)
{
this.hasSpecial = v;
}
/*
// =======================================================================
// Private Variables local to this instance
// =======================================================================
*/
/**
* hasNibble. Whether floorpiece has a regular nibble.
* Represents whether or not this FloorPiece has a nibble that Pacman eats
* (the regular ones, not the ones that lets Pacman chase Ghosts)
*/
private boolean hasNibble;
/**
* hasSpecial. Whether floorpiece has a special nibble.
* Represents whether or not this FloorPiece has a special nibble
* (the special ones which allows Pacman to chase Ghosts.)
*/
private boolean hasSpecial;
/*
// =======================================================================
// Main method (overrides this commenting system for readibility reasons)
// =======================================================================
*/
/**
* Debugging main for class FloorPiece.
* 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.
FloorPiece f1 = new FloorPiece(4,7, false, false);
FloorPiece f2 = new FloorPiece(3,7, false, true);
FloorPiece f3 = new FloorPiece(2,7, true, false);
FloorPiece f4 = new FloorPiece(1,7, true, true);
System.out.println(f1);
System.out.println(f2);
System.out.println(f3);
System.out.println(f4);
if (DEBUG) System.out.println("end main(String[] args) call:");
} //end of DEBUG if
} //end of main(String[] args)
} //end of class FloorPiece