#include "scr_Board.h"
#include "sjmMove.h"
#include "sjmParameters.h"

class sjmEngine{
 private:
  int BONUS, TILENUM;
  int numplayers;
  int ready, over;
  int passcount;
  scr_Bag *TheBag;
  scr_Dictionary *TheDictionary;
  scr_Board *TheBoard;
  sjmPlayer* firstPlayer, curplayer; //linked list of players

  char*  //determine which tiles the player used in his move
    DeterminePlayedTiles(sjmMove* move);

  unsigned long int  //returns the score of the word; also if errors are present
    JudgeMove(sjmMove* move);

  sjmPlayer*  //returns null if the player with the id does not exist; returns player otherwise
    getPlayer(unsigned long int code);

  sjmPlayer*  //returns current player
    getCurPlayer();

  int  //exchanges players tiles; returns nonzero when succesful, 0 otherwise
    ExchangePlayerTiles(int playerid, char* remove);

  int  //returns whether this player is currently active
    ActivePlayer(unsigned long int code);

  void  //kills off a player, disposes of tiles according to setup of game
    KillPlayer();

  void  //sets active player to next player
    NextPlayer();

 public:

  //constructor: takes a special data structure that describes game setup
  sjmEngine(sjmParameters startup);

  //constructor: load an engine state from file (wait till a later version)
  sjmEngine(char* filename);

  //called when the game ends
  ~sjmEngine();

  void  //submit a move to be parsed as a player's move
    SubmitMove(sjmMove* TheMove, char* result);

  void  //request information
    RequestInfo(sjmMove* TheMove, void*& result);

};



