Table of Contents

Corning Community College

CSCS2320 Data Structures

PROJECT: Moar than Space Invaders (MSI3)

OBJECTIVE

Evolve your space invaders game into something more, considering something like galaga. Also, implement a doubly-linked list and update everything to take advantage of that new list functionality.

EDIT

You will want to go here to edit and fill in the various sections of the document:

msi3

independently moving enemies

One way to make randomly moving enemies is to have them spawn at random positions and going different directions at different speeds and bouncing around like PC screen saver!

trigonometric functions

One way to use trigonometric functions is to model how your enemies will move. Maybe you want them to move in a circle? Or in a cosine wave? The Vircon “math.h” library has functions to help you achieve this. Remember, a circle is X squared + Y squared = r squared. Since we can only manipulate X and Y individually, this is where the sin and cos functions will come into play. Both can be used so that they come together and make the node move in a circle. A simple draw_region_at can be used as well, as the rotated counterpart will spin the node.

doubly-linked lists

The primary difference between a singly and doubly-linked list is that a singly-linked list can only move forward in direction. For example, if you start at First, you can only move to the next until you hit the Last. With a doubly-linked list, you can move both to the next and previous node, offering more freedom in data access. However, keep in mind this will require more hygiene of the user to keep the pointers between nodes in order, both for making the nodes and removing them.

mknode() function

To make a node you need to allocate memory for it, and initialize any values that need to be, for parameters you want to pass it anything that might change between nodes, like X and Y coordinates, but anything that remains the same, like speed, can be hard-coded into the function.
Don't forget that this is a non void function, meaning that it needs to return a value!

  • There is no real difference between mknode() for a singly or a doubly-linked list

rmnode() function

To be to use rmnode you must first use obtain(). rmnode does what it sounds like it does, removes the given node. First you will want to check if the given node is NULL or not as there is no reason to remove something that doesn't exists. Now your given node has an attribute to it (→ next) and (→ prev) which will both need to be set to NULL, if not then some undesirable stuff will happen. Then the node is prepped to be removed.
Don't forget that since this is not a void function it needs to return a value!

mklist() function

For mklist one must name there list like they have the other struct objects in previous projects. And also just like previous projects one must allocate memory for said list! Or else there will be issues in your future! In typical faction one must set their lists attributes to NULL.
Don't forget that this is a non void function, meaning that it needs to return a value!

insert() function

The insert function should operate a bit like the append function. However, this time it should allow a node to be placed wherever in the last as opposed to strictly the end. If desired, insert could be used like obtain().

append() function

To Append is to Add After, not Before. With doubly linked lists we can now go backwards. When adding stuff to the end of a list we need to check where we are adding the node to as that decides the rest of what we do. You need to check for if the Old_Node that New_Node is going after is:

  1. At the Start/Doesn't Exist
  2. At the End
  3. or in the Middle
  

One way to tell for the First option is to see if your list == NULL. If so then the lists two ends need to point to the New_Node and it's next and previous need to be NULL as there are no other nodes in the list.

One way to tell for the Second option is to see if your Old_Node == end of the list. If so then Old_Node now point to the New_Node which point's right back at it, but the New_Node also needs to point somewhere else else.

The Third option is like the Second in terms of pointing but that New_Node needs to point at what Old_Node was pointing at next before it was pointing at New_Node.

Don't forget that since this is a function it needs a return value!

obtain() function

For the most part, the obtain() function should be the same as the obtain() function in msi2. Loop through your list until you find the node you would like to obtain, then return the list.

clearlist() function

The clearlist() function should be the same as in msi2, as well. Loop through your list and remove each node in the list using your rmnode() function until the list reaches NULL (end of list). Make sure the list's start and end is NULL, then return the list.

rmlist() function

The rmlist function will call clearlist() function. After the list is successfully cleared, then the list itself will be deallocated from memory.

 

SUBMISSION

To be successful in this project, the following criteria (or their equivalent) must be met:

Submit Tool Usage

Let's say you have completed work on the project, and are ready to submit, you would do the following:

lab46:~/src/SEMESTER/DESIG/PROJECT$ submit DESIG PROJECT file1 file2 file3 ... fileN

You should get some sort of confirmation indicating successful submission if all went according to plan. If not, check for typos and or locational mismatches.

RUBRIC

I'll be evaluating the project based on the following criteria:

156:msi3:final tally of results (156/156)
*:msi3:doubly linked list and node implemented [52/52]
*:msi3:API optimized for use with doubly linked node [52/52]
*:msi3:additional game functionality implemented beyond space invaders [52/52]

Pertaining to the collaborative authoring of project documentation

Additionally