#ifndef _WORDGAME_H
#define _WORDGAME_H

#include <string>
using namespace std;
#include "point.h"
#include "tvector.h"
#include "linkset.h"

class WordGame
{
 public:
   WordGame(int size);  // max grid size
   void MakeBoard();    // create a grid of letters
    
   // is a word on the board?  one version returns locations
   bool OnBoard(const string& s);
   bool OnBoard(const string& s, tvector<Point>& locations);
    
   // other functions
    
  private:
    typedef LinkSet<Point>         PointSet;
    typedef LinkSetIterator<Point> PointSetIterator;
    
    tmatrix<char>     myBoard;
    tvector<PointSet> myLetterLocs;
    PointSet          myVisited;
    
    bool IsAdjacent(const Point& p, const Point& q);
    bool OnBoardAt(const string& s, const Point& p, 
                   tvector<Point>& locs);
};
