home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 27 / IOPROG_27.ISO / SOFT / GRAPH.ZIP / AI / DEMOS / DEMO2.H < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-12  |  718 b   |  36 lines

  1. #include <stdio.h>
  2. #include "graph.h"
  3.  
  4. /*                  DEMO2
  5.  
  6.     The object of this problem is to find a path leading from
  7.     x1, y1 to x2, y2 on an empty chessboard by moving a knight
  8.     around. We perform a breadth first search.
  9.  
  10. */
  11.  
  12. class KNODE_ : public NODE_
  13. {
  14.     public:
  15.         KNODE_(int x, int y);
  16.         int get_x() const;
  17.         int get_y() const;
  18.  
  19. // implementation of virtual functions
  20.         int equal(const VOBJECT_ &) const;
  21.         void display() const;
  22.         NODE_ *do_operator(int) const;
  23.     private:
  24.         int
  25.             x,
  26.             y;
  27. };
  28.  
  29.  
  30. class KNIGHT_ : public BREADTH_GRAPH_
  31. {
  32.     public:
  33.         KNIGHT_(KNODE_ *start, KNODE_ *goal);
  34. };
  35.  
  36.