Cia.hxx

#define PLAYERNAMELENGTH 16
#define MAXNUMPLAYERS 90

#define NUMMETHODS 19

#define MEETPEROPP 10

#define TRUE 1

struct ExpectStruct
{
  int exme[2];
  int exopp[2];
  int totme[2];
  int totopp[2];
};

struct MoveHistory
{
  int tested;
  unsigned long int list[2][32];
  int exme[2];
  int exopp[2];
};

class CCia
{
public:
  CCia();
  ~CCia();

protected:
  void InitZero ();

protected:
  char NameOfPlayers[MAXNUMPLAYERS][PLAYERNAMELENGTH+1];
  long LastChanged[MAXNUMPLAYERS][2];
  int HasChanged[MAXNUMPLAYERS];
  
  int points[MAXNUMPLAYERS][MAXNUMPLAYERS][2][MEETPEROPP]; // [opponent][opponent][match 1/2 in game][MEETPEROPP different meetings]

  int points47[MAXNUMPLAYERS][NUMMETHODS][2][MEETPEROPP][2][2]; // [opponent][method][match 1/2 in game][MEETPEROPP different meetings][0=other,1=player47][0=after entire game,1=after 15 rounds]

public:
  struct MoveHistory MoveH[MAXNUMPLAYERS];

protected:
  void SetPlayersPointsToZero (int num);

public:
  void LoadFile (char* szFileName = "../central_intelligence_agency/main.file");
  void SaveFile (char* szFileName = "../central_intelligence_agency/main.file");

  void FindChangedPlayers ();
  void ActivateAll ();
  void ClearAgainstUs ();
  void TestChangedPlayer (int i,char* searchpath);

  int GetMatchesToPlay (int *activeplayers,int *numplayers,int* buf,int* matches,int *forcetactics);

  void GetActivePlayers (int *players);

  void NoteMatchResults (char* buf);

  int NameToGroup (char* PlayerName);
  char* GroupToName (int num,char* PlayerName); // PlayerName must nut be null

  int NumKnownOpponents ();
  int NumKnownMoveSeries ();

  int GetTacticsForNextOpponent (int* numinlist,
				 char* PlayerName,
				 int* tactics,
				 struct ExpectStruct* es);

  void GetTacticsForOpponent (int o,
			      int* tactics,
			      struct ExpectStruct* es);
  
  void GetBetterOppForOpponent (int o,
				int* other,
				struct ExpectStruct byother[],
				struct ExpectStruct* es);
  
  void CheckBestMethods ();
  void CheckNameDependence ();

  void DumpActivePlayerNumbers (char* fileName);
};

// a dirty helper:

char* syscall (char* what_to_do);

long lstimetolong (char* lstime,int musthaveallread = TRUE);

char* strtolower (char* str,char breakchar);

void SayName (char* name);

int GoodEnough (int mP,int oP);

Tillbaka till huvudsidan