Introduction to Computer Science II by James Tam Return to the course web page

CPSC 233: Assignment 5 (Worth 11%)

New concepts to be applied in this assignment

  1. Inheritance & software reuse 

 

Your mission for this assignment

You are to take your program from the previous assignment and to augment it by implementing special classes of ships that extend the basic star ship.  In the full version of the game the human player will control a Federation star ship while the computer controlled ships will include ones from: the Klingon empire, the Dominion and the Borg collective.

The Federation

The United Federation of Planets (or the Federation for short) is an egalitarian union of hundreds of different species and cultures.  To bring together such a large and often divisive number of races under one governing body requires that something other than combat is used to settle differences.  One of the founding races of the Federation and perhaps the most ubiquitous are humans.   Most humans are equal part explorer and diplomat providing the glue that holds the Federation together.   Their ships are well equipped with defensive and offensive weapons that are not designed to start conflicts but to end them.

WHY is this man SMILING!? (Amok)
The Federation is a peaceful union of numerous races.  Tagline: "To seek out new life, to explore new worlds."

The Klingon Empire

This warrior race has a genetic predisposition to hostility and a well-known streak of fatalism.   Klingons are also famous (or perhaps infamous) for their get-togethers in which there is a great deal of boasting, growling, wrestling and of course feasting and drinking (i.e., a lot of extroverted revelry) takes place.   If you look beyond their boisterous and aggressive exteriors the Klingons are perhaps the most noble race of all: they hold honor above their own life.  Klingon ships are designed with powerful offensive capabilities that suit their warlike natures.

A young Klingon warrior wielding a Bat'lethTagline: reH  Suvrup  tlhIngan  SuvwI'  ("A Klingon warrior is always prepared to fight.")

The Dominion

The Dominion is a mighty interstellar empire composed of  several hundred dominated races led by a race of shape shifters (know as the "Founders"), administered by the devious, cloned race (the "Vorta") and defended by genetically bred soldiers (the "Jem'Hadar").  The founders are the dominion and dominion is the founders.  The Dominion was created by the founders to impose (their) order on the galaxy.  Much like Klingon warships, the ships of the Dominion are built for a fight.  The dominion is in a different part of the galaxy ("The Gamma Quadrant") from where the Klingon empire and the Federation reside ("The Alpha Quadrant") and only the chance discovery of the Bajoran wormhole allowed for contact between the specifies from the different quarters of the galaxy.

A Jem'Hadar soldier on guard. Tagline: "Victory is life!"

The Borg collective

The Borg are a cybernetic life form which is part organic, part artificial life with a singular unifying goal, the consumption of useful technology.  They do this by "assimilating" other species (i.e., turning them into Borg) which they claim will, "..raise the quality of life for that species." The Borg skill at assimilating new technology allows their ships to adapt their defensive systems which will reduce the effectiveness of some enemy attacks over time.  Each attack on a Borg ship allows them to gain more information about the energy used in the attack which in turn allows the Borg to adapt their defenses to the attack.  Like the members of The Dominion the Borg are from another quadrant of the galaxy (in this case "The Delta Quadrant") and only the advanced Borg propulsion systems (the "transwarp drive") have made contact between humans and the Borg possible.  The Borg have an orderly machine society and their ships reflect this by their geometric designs: cubes, spheres and diamonds.  (However you only need to implement the cube for this assignment).

An attacking Borg drone. Tagline: "You will be assimilated."

 

Grading: Working submissions

Some of the new classes needed for this assignment

  1. FederationStarShip
  2. KlingonAttackCruiser
  3. JemHadarBattleship
  4. BorgCube

Basic submission (C):  

  1. All the required functions from the previous assignment have been implemented (-1 letter step for every two functions from the previous assignment that's missing in this assignment rounded down).
  1. Four new child classes of the StarShip class have been defined and instantiated.  Each class definition for the basic version of the assignment must include the capabilities listed below (the special capabilities of each ship (listed under the 'extra features') are separate from the basic submission requirements.
 
  1. FederationStarShip (replaces the basic StarShip controlled by the human player from the previous version of the game)
   
  • It appears onscreen as the 'F' character
  • It has the same hull value of the ships of the StarShip class but it has 15:1 shield to hull ratio (shield value = 6000 points)
 
  1. JemHadarBattleship (replaces one of the basic computer controlled ships from the previous version of the game)
   
  • It appears onscreen as the 'J' character
 
  1. BorgCube  (replaces one of the basic computer controlled ships from the previous version of the game)
   
  • It appears onscreen as the 'B' character
  • Borg cubes are significantly larger and more powerful than the other ships so they have a hull value of 4000 points and a shield value of 40000 points.  However the onscreen representation is not any larger than other ships (it sill occupies a single sector with the 'B' character).
 
  1. KlingonAttackCruiser (replaces one of the basic computer controlled ships from the previous version of the game)
   
  • It appears onscreen as the 'K' character
  A letter step will be lost for each of the above new ship classes that are incomplete or missing (down to a minimum grade of 'D' or 'D-').
     
  1. The cheat menu has been expanded to include three new options
 
  1. The photonic cannon (option 'p'): The player's ship discharges a high-energy burst that will totally destroy any ship anywhere in the galaxy (except for the player's ship).  This weapon is fired independently of the other weapons and like another option in the cheat menu firing the photonic cannon will not cause time to pass in the game.  When this function is invoked the player will be prompted to enter the row and column coordinates of the ship to be attacked (empty sectors or ones outside the bounds of the galaxy cannot be attacked).
 
  1. Quantum sensor (option 'q'): When invoked this function will display the following information about each computer controlled ship that has not been destroyed: the type of ship (Borg cube, Jem'Hadar battleship, Klingon attack cruiser), the current sector that the ship resides in, the hull value and the shield value.
 
  1. The slip stream drive (option 's'): A very high speed means of travel allowing the player's ship to move to any unoccupied sector in the galaxy.  When this function is invoked the player will be prompted to enter the row and column coordinates of the destination sector (occupied sectors or ones outside of the galaxy cannot be traveled to).  Similar to the photonic cannon, engaging the slip stream drive will not result in time passing in the game and this propulsion system can be used independently of the regular warp drive propulsion system.
  A letter step will be lost for each of the above cheat menu functions that are missing (down to a minimum grade of 'D' or 'D-').
   

Extra features

  1. Implement the special capabilities of the Federation star ship (worth 2 letter steps).   

A Sovereign class Federation star ship.

When debug mode is turned on the program should show the shield value of the targeted enemy before the torpedo was fired (point value before being hit by the torpedo) and the shield value after it was fired (it should now be zero).

  1. Implement the special capabilities of a Jem'Hadar battleship (worth 1 letter step). 

A Jem'Hadar battleship.

When the program is in debug mode it should show the amount of damage generated by the Jem'Hadar anti-proton beam, the shield and hull value of the player's ship before and after the attack.

  1. Implement the special capabilities of a Borg cube (worth 2 letter steps).

  0 1 2 3
0 F      
1        
2        
3       B
A Borg sphere ship traveling at transwarp (faster than warp) speed.

First hit by opponent during the game

No damage reduction

Second hit by same opponent

Damage is reduced by 25%

Third hit by same opponent

Damage is halved

Fourth and successive hits during a game

Damage is reduced by 75%

All fractional values are rounded when determining damage.  For example, if 355 points of damage were randomly generated by a phaser hit on a Borg cube and this were the 4th attack then the damage inflicted would equal 88 points (355 / 4 = 88.75 which is rounded to 89 points).  Note however that the Borg ability to adapt only applies to energy based weapons like the phaser.  It will have no effect on either the quantum torpedo or the photonic cannon. 

A Borg cube under attack by a Federation task force

When the program is in debug mode the program should show the full amount of damage generated by the player's phasers, the number of times that the Borg ship was hit by the player's ship and the damage that will actually be inflicted on the cube.

  1. Implement he special capabilities of a Klingon attack cruiser (worth 2 letter steps). 

Example: The human player is taking on a Klingon attack cruiser.

Human player's ship

Ship's system

Point value

Shields

600

Hull

400

The damage generated for the cruiser's disruptor fire is 700 points.  Because the disruptor fire has double the effect on shields, only 300 points of damage are required to cause the shields on the human player's ship to go down.  That leaves 400 points of disruptor energy left.  This damage is now deducted from the hull of the human player reducing it zero.  Because Klingon ships attack first the human player's ship is destroyed and he or she has lost the game.  The results of the attack on the human player's ship is displayed and the game ends indicating that the player has lost.  

A Negh'var class attack cruiser de-cloaked for attack

If the game is in cheat mode then the game should display: 1) The amount of disruptor damage generated 2) The amount deducted from the shields 3) The amount deducted from the hull (if any)

 

Grades for non-functional assignments

D level assignment

The student has invested considerable work in the assignment1 and the code compiles but it doesn't fulfill any of the above requirements.

D- level assignment

The student has invested considerable work in the assignment1 but it doesn't compile.

 

Other submission requirements

In addition to having fulfill the generic assignment requirements the requirements specific to this assignment include:

  1. Good coding style and documentation:  They will play a role in determining your final grade for this assignment.  Your grade can be reduced by a letter step or more (e.g., 'A' to 'A-' for poor programming style such as employing poor naming conventions for identifiers, insufficient documentation or the use of static variables or methods).  For additional details see the marking guide for coding style.

  2. Include a README file in your submission:  For this assignment your README file must indicate what grade level has been completed (e.g., 'A') and which features have been implemented This will allow your marker to quickly determine what he or she must look for and speed up the marking process.  Also you should include your contact information: your name, university identification number and UNIX login name so that your marker knows whose assignment that he or she is marking.  Omitting the necessary information from this file will result in the loss of a letter 'step' (assuming that the marker can actually figure out who the assignment belongs to, if it cannot be determined who the assignment belongs to then no grade will be given for the assignment, an 'F' will be assigned).

  3. Assignments (source code/'dot-java' files and the README file) must be electronically submitted via email (to me and your TA).  In addition a paper print out of the source code and README must be handed into the assignment drop box (located on the second floor of the Math Sciences building) for the tutorial that you are registered in.  Electronically submitting the assignment allows your marker to run the code in order to quickly determine what features were implemented.  Providing a paper printout makes it easier for your marker to read and flip through your source code.  Omitting the paper version of the source code file will result in the loss of a letter 'step'.  Omitting the electronic version of your assignment will only allow you to receive a maximum grade of 'D-' because it's too time consuming for your marker to check every program with a hand trace.  I suggest that as you complete the various features of the assignment that you immediately submit each version so if you forget to submit the final version you will at least have something that your marker can grade because you won't be allowed to submit anything after the deadline.

  4. As a reminder, you are not allowed to work in groups for this class.   Copying the work of another student will be regarded as academic misconduct (cheating).  For additional details about what is and is not okay for this class please refer to the following link.

 

Relevant Files

You can run the sample byte code file called 'Trek.class' which can be found in Unix in the directory: /home/233/assignments/assignment5

1  What does and doesn't constitute a sufficient amount of time and effort?  It's a judgment call on the part of your marker.  More often than not if you put in a reasonable amount of effort into your assignment and for some reason you just couldn't get it to work then you will receive some credit for your work.   An example of when you wouldn't receive credit is when you simply handed someone else's work.  This latter case assumes that you properly cited the other person's work, if you didn't cite your source and tried to claim that it was your own work then it would be an example of academic misconduct (cheating).

 

Sources of information for this assignment

   1.  The television programs and movies, you can find additional information on the official Trek web site: www.startrek.com

   2.  "The birth of the federation" by Microprose

   3. "Star Trek: Borg" published and developed by Simon & Schuster Interactive

  4. "Star Trek: Armada" published by Activision

Note: The use of the Star Trek © trademark was for educational purposes only and not meant as a copy write challenge.