Pseudo Code 


Classes: Main, Lists, Grid, HighScores
Abstract Classes: Towers, Swarms
Subclasses: BombTower, SniperTower, StallTower, SprinterSwarm, TankSwarm, StealthSwarm

public class Main()
{
	int money = some amount, to be determined later
	//set up all the graphics, game engine, menu etc. 
	initialize()
	{
		Start the game
		Show menu
		Play game
		Exit
	}
}

public class Grid ()
{
	//make a two dimensional array for storing coordinates
	//grid will be 10 x 10
	int [][] map = new int[10][10];
	
	//grid may also need its own linked list in the Lists class where each square is its 
	//own object in a node so that it can be clicked on
	//generate grid map
	// use random number generator to specify the placement of towers
	makeGrid()
	{
		//Make sure these coordinates are in the grid area
		Randomize the number of towers and place them in the grid
		Set the goal and start points in random spots
	}
	
	//adds a swarm to the start position
	addSwarms()
	{
		Swarm is created at the start position
		Each time a swarm is spawned call generatePath()
		deduct cost from total money
	}




	//User chooses the path for a swarm
	generatePath()
	{
		User uses the mouse to specify the grid coordinates the swarm will follow
		Path cannot cross over towers
		user will be able to see the path visually as they click on the coordinates
	}

	//Checks whether a swarm has crossed the goal point
	checkScore()
	{
Continuous loop that runs and will constantly check whether a swarm’s position ever is equal to the goal position, if so increase the score

	}

public abstract class Towers()
{
//abstract class will contain the common variables and methods of all the types of //towers, the individual tower types will have their own classes and will override //the shoot method 

int myXCoord;
	int myYCoord;

public Towers()
{
	myXCoord = 0;
	myYCoord = 0;
}

public void setXCoord(Towers temp, int x)
{
		temp.myXCoord = x;
	}
	
	public void setYCoord(Towers temp, int y)
	{
		temp.myYCoord = y;
	}



	public int getXCoord(Towers temp)
	{
		return temp.myXCoord;
	}

	public int getYCoord(Towers temp)
	{
		return temp.myYCoord;
	}
	
//shoot method that will be overridden by child classes 
	abstract void shoot();
}


public class BombTower extends Towers
{
//Bomb towers will have a one square range to all the tiles surrounding its //position, and when it fires at a swarm in range it will hit that swarm for full //damage and any swarm in the surrounding 8 squares will take half damage
//this tower will prioritize attacking the Sprinter swarms

	void shoot()
	{
		while (Swarm is in range)
		{
			if (Sprinter swarm is in range)
			{
				fire at Sprinter swarm
			}

			else if (Tank swarm is in range)
			{
				fire at Tank swarm
			}
			
			else 
			{
				fire at Stealth swarm
			}
		}
	}
}



public class SniperTower extends Towers
{
//Sniper towers have a longer range than the Bomb towers, can fire at targets 
//three squares away, will attack one square for more damage, but will fire slower
//this tower will prioritize attacking the Tank swarms


void shoot()
{
	while (Swarm is in range)
	{
		if (Tank swarm is in range)
		{
			fire at Tank swarm
		}
		
		else if (Sprinter swarm is in range)
		{
			fire at Sprinter swarm
		}

		else
		{
			fire at Stealth swarm
		}
	}
}
}



public class StallTower extends Towers
{
//Stall towers will not do damage, but their attack will stall a swarm for a period //of time, they will have a range of two squares, and they will fire the slowest
//this tower will prioritize attacking the Stealth swarms

void shoot()
{
	while (Swarm is in range)
	{
		if (Stealth swarm is in range)
		{
			fire at Stealth swarm
		}
		
		else if (Sprinter swarm is in range)
		{
			fire at Sprinter swarm
		}

		else
		{
			fire at Tank swarm
		}
	}
}

public abstract class Swarms()
{
//abstract class will contain the common variables and methods of all the types of //swarms, the individual swarm types will have their own classes and will //override the move method

int myXCoord;
	int myYCoord;

public Swarms()
{
	myXCoord = 0;
	myYCoord = 0;
	
	initialize path, each swarm will store its own path, some kind of array will 	
	be needed for this 
}

public void setXCoord(Swarms temp, int x)
{
		temp.myXCoord = x;
	}
	
	public void setYCoord(Swarms temp, int y)
	{
		temp.myYCoord = y;
	}


	public int getXCoord(Swarms temp)
	{
		return temp.myXCoord;
	}



	public int getYCoord(Swarms temp)
	{
		return temp.myYCoord;
	}

	public int calcHealth(Swarms temp)
{
	Calculate damage done to swarm temp
	return swarms health
}
	
//move method that will be overridden by child classes 
	abstract void move();
}

public class SprinterSwarm extends Swarms
{
	//Sprinter swarms will move fast, but have low health
	public void move()
	{
		move swarm through grid
	}
}

public class TankSwarm extends Swarms
{
	//Tank swarms will move slow, but have high health
	public void move()
	{
		move swarm through grid
	}
}

public class StealthSwarm extends Swarms
{
	//Stealth swarms will move the slowest, but can sneak past towers
	public void move()
	{
		move swarm through grid
	}
}



public class HighScores
{
	//keep a list of the top 10 scores with the person’s name next to it
	//implement merge sort here
}

public class Lists
{
	//contains all the lists that the program will need
	//a linked list for the swarms
	//arraylist for the towers
	//maybe linked list for each individual grid coordinate
	//probably another linked list for the high scores
	
	//linked lists will have to be implemented myself
}


