#ifndef WORLD_H
#define WORLD_H

#include "vector.h"
#include "triangle.h"
#include "tank.h"
#include <iostream>
#include <stdlib.h>
#include <ctime>
#include "constants.h"
#include "terrain.h"
#include <string>

using std::string;

class World
{
public:
    //constructor
	World(int numPlayers);

	//destructor
	~World();

	//functions
	void detect();
	void step();
	void display();
	void fire();
	void upTheta();
	void downTheta();
	void upPhi();
	void downPhi();
	void upPower();
	void downPower();
	
private:
	static const int TIME_PER_STEP = 1;

    // data members
	Triangle** triangles;		// An array of triangles in the world.
	Bullet* bullet;				// The bullet in the world.
	int nTri;					// Gives the number of triangles stored in the array.
	Tank* tanks;
	int* scores;
	Vector* tankColors;
	string* colors;
	Vector* defLoc;
	int tanksAlive;
	int currentTank;
	bool bulletExists;
	bool hasFired;
	int numPlayers;

	Terrain* ground;

	// functions
	void initTanks();
	double snap(double loc);

};
// Three-way minimum function, checks for positive values
double leastPositive(double d1, double d2, double d3);

#endif // WORLD_H