// This function was developed by Sebastian Lackner C++AG SS94
// Modified by schoenf

#include "gridhunt.h"
Player graph; 
Coor temp; 
char Feld[GRIDX][GRIDY]; 

#define GRAPHDELAY 3000

void clear_screen() 
{
   cout <<"\033[H\033[2J";
}

 
void feld_init() 
{ 
 
  int x,y; 
 
  for (x=0;x<GRIDX;x++) 
  for (y=0;y<GRIDY;y++) 
      Feld[x][y]='.'; 
 
} 
 
void feld_set_2(Player &teamx,char charx) 
{ 
  temp=graph.player_pos(teamx); 
  if(temp==ERROR_COORD) return;
  Feld[temp.x][temp.y]=charx; 
} 
 
void feld_set() 
{ 
	feld_set_2(team1,'1'); 
	feld_set_2(team2,'2'); 
	feld_set_2(team3,'3'); 
	feld_set_2(team4,'4'); 
	feld_set_2(team5,'5'); 
	feld_set_2(team6,'6'); 
 
	Coor monst; 
	monst=Mobptr->my_pos(); 
	Feld[monst.x][monst.y]='M'; 
 
} 
 
void feld_plot() 
{ 
	clear_screen(); 
    cout << form("Game: %5d -- Move: %3d\n", games, moves); 
	int x,y; 
    cout  << "   "; 
	for (x=0;x<GRIDX;x++) 
    {
		cout << (x%10) << " "; 
	} 
	cout << "\n"; 
	for (y=(GRIDY-1);y>=0;y--) 
	{ 
		cout << y%10 << " "; 
		for (x=0;x<GRIDX;x++) 
		{ 
			cout << " " << Feld[x][y]; 
		} 
		cout << "\n"; 
	} 
	cout << "------------------------------------------------"; 
} 
 
void plotgraph() 
{ 
	long i,j;
	feld_init(); 
	feld_set(); 
	feld_plot(); 
	for(i=0; i<=GRAPHDELAY; i++)
		for(j=0; j<=GRAPHDELAY; j++);
} 
   
   




