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

  1. #include <stdio.h>
  2. #include "graph.h"
  3.  
  4. /*                   DEMO6
  5.  
  6.     This program is exactly the same as the one in demo3 except that
  7.     we derive PUZZLE_ from class BIDEPTH_GRAPH_ because we want to
  8.     perform a bidirectional search.
  9.  
  10. */
  11.  
  12.  
  13. class PNODE_ : public NODE_
  14. {
  15.     public:
  16.         PNODE_(const char *, int empty_x, int empty_y);
  17.         PNODE_(const char *, int, int, int, int);
  18.  
  19.         int get_x() const;
  20.         int get_y() const;
  21.         const char *get_board() const;
  22.  
  23. // implementation of virtual functions
  24.         int equal(const VOBJECT_ &) const;
  25.         void display() const;
  26.         NODE_ *do_operator(int) const;
  27.     private:
  28.         PNODE_
  29.             *do_left() const,
  30.             *do_right() const,
  31.             *do_up() const,
  32.             *do_down() const;
  33.             int compare_board(const char *) const;
  34.         int
  35.             x,
  36.             y;
  37.         char
  38.             board[3][3];
  39. };
  40.  
  41.  
  42.  
  43. class PUZZLE_ : public BIDEPTH_GRAPH_
  44. {
  45.     public:
  46.         PUZZLE_(PNODE_ *start, PNODE_ *target);
  47. };
  48.  
  49.  
  50.