//////////////////////////////////////////////////////////////////////////////
//
// File: nplayer.h
//
// Purpose: This is the interface for the NeuralPlayer class.  This is an
//          Player whose decisions are dictated by a Neural Network, thus
//          providing a "bottom up" approach to AI.
//
// Authors:
//   txe  Travis Emmitt
//
// Modifications:
//   15-APR-1998  txe  Created skeleton (no implementation yet)
//   16-APR-1998  txe  Added nn, ShowRules(), GetMove(), NewMatch()
//   18-APR-1998  txe  Added Peek(), NewGame()
//   19-APR-1998  txe  Added arch
//   20-APR-1998  txe  Added LoadArch()
//   21-APR-1998  txe  Added GetArch(), Save()
//   22-APR-1998  txe  Added arch_file, wts_file
//   23-APR-1998  txe  Added BuildNet(), ResetWeights(), SetTraining()
//   24-APR-1998  txe  Removed ability
//
//////////////////////////////////////////////////////////////////////////////

#ifndef NPLAYER_H
#define NPLAYER_H

#include "board.h"
#include "nn_arch.h"
#include "neunet.h"

class NeuralPlayer : public Player {
private:
  Arch   *arch;                          // Neural Net's architecture
  char    arch_file[MAX_LEN+1];          // NeuNet architecture file
  NeuNet *nn;                            // Neural Net itself
  int     num_inputs;
  int     num_outputs;
  int     training;
  char    wts_file[MAX_LEN+1];           // NeuNet weights file

  int   ResetWeights ();
  
public:
  NeuralPlayer (char *name, int color, char *arch_file, char *wts_file);
  int   BuildNet     ();
  void  Feedback     (int code);         // override, punishes network if LOSE
  Arch *GetArch      ();
  int   GetMove      ();                 // override, gets next move
  int   NewGame      ();                 // override, readies us for new game
  int   NewMatch     ();                 // override, readies us for new match
  void  Peek         ();                 // override, peeks into NeuNet
  int   Save         ();                 // saves NN arch & state
  int   Save         (char *arch_file, char *wts_file, float loss_rate);
  void  SetTraining  (int use_training);
};

#endif

//////////////////////////////////////////////////////////////////////////////

