// File: RaceCourse.h
//
// Written by Richard Chang for CMSC202 Spring 2007
//
#ifndef RACECOURSE_H
#define RACECOURSE_H

#include <vector>
#include "proj2.h"
#include "Car.h"
using namespace std ;

//class Car ;

class RaceCourse {

public:
   // Constructors

   RaceCourse() ;
   RaceCourse(unsigned int rows, unsigned int cols, 
      unsigned int cars, const vector<Position>& obstacles) ;

   Car * GetCar(unsigned int i) ;

   unsigned int GetNumOfCars() const ;
   unsigned int GetNumOfRows() const ;
   unsigned int GetNumOfCols() const ;

   void StartRace() ;
   RaceStatus GetRaceStatus() ; 
   void PrintRaceStatus() ; 
   unsigned int GetWinner() const ;

   void PrettyPrintCourse() ;

   // facilitator for Car objects to call.
   // max = maximum number of steps to move.
   // xinc = -1, 0, +1 change in rows
   // yinc = -1, 0, +1 change in cols
   // Setting xinc and yinc allows Cars to specify
   // the direction (left, right, up or down) that they want to move.
   //
   unsigned int MoveMe(unsigned int CarIndex, unsigned int max,
      int xinc, int yinc) ;

   // Returns the Position of the Car specified by CarIndex
   Position GetMyPosition(unsigned int CarIndex) const ;

private:
   // RaceCourse stats.
   //
   unsigned int rows, cols, cars ;


   // Two Dimensional array to hold the grid
   //
   int Course[MaxRows+2][MaxCols+2] ;


   // All the Cars.
   //
   Car CarList[MaxCars+1] ;


   // Position of each Car.
   //
   Position CarPos[MaxCars+1] ;

   RaceStatus Status ;
   unsigned int Winner ;
} ;

#endif
