wordgame.h

来自「C++&datastructure书籍源码,以前外教提供现在与大家共享」· C头文件 代码 · 共 34 行

H
34
字号
#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);
};

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?