// -----------------------------------------------------------
// Projet informatique magistere - langage c/c++
//   Jeu Othello , https://fr.wikipedia.org/wiki/Othello_(jeu)
//   R. Ansari , Univ. Paris-Saclay - Decembre 2024
//         (C) R. Ansari, Univ. Paris-Saclay 
// -----------------------------------------------------------

/* --- Programme exemple pour l'utilisation des fonctions de libothmagphys.a ,
   pour jouer contre le joueur Othello de  libothmagphys.a  */

#include <iostream>
#include <unistd.h>
#include "oth4stud.h"

using namespace std;

int main(int narg, char* arg[])
{
  int rc=0;
  try {
    cout << " ------ Programme oth4stud.cc ---------- " <<endl;
    int prtlev=1;
    const char* playercol="black";   // black or white 
    const char* playerlevel="int";   // beg / int / adv / pro
    int rca=init_oth_player(playercol, playerlevel);
    int movb=0, movw=0;
    while (movb>=0 || movw>=0) {
      // black player should be called first , as it is the one which plays first 
      movb=oth_player_domove(prtlev);
      // Then the white player  
      movw=oth_other_player_domove(prtlev);
    }
    int rcb=end_oth_player(prtlev);
  }
  catch (std::exception & e) {
    cerr << " tstudoth.cc: Catched std::exception what()=" << e.what() << endl;
    rc=99;
  }
  catch (...) {
    cerr << " tstudoth.cc: some other exception (...) was caught ! " << endl;
    rc=97;
  }
  cout << " ---------------- End of oth4stud.cc ------------------- " <<endl;
  return rc;
}
