00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _GRID_H
00023 #define _GRID_H
00024 #include <cell.h>
00025 #include <pose_chain.h>
00026 #include <motion_chain.h>
00027
00028
00029 #include <types.h>
00031
00056 class grid
00057 {
00058 public:
00059 grid(void);
00060 grid(int x, int y);
00061 CELL_STATE state(int x, int y) const;
00062
00063 CELL_STATE heading(int x, int y, atomic_rotation) const;
00064
00066
00075 void solve_maze(int cx, int cy, atomic_rotation face, const pose_chain& waypoints, int itarget, motion_chain& path, bool obstacles);
00077 void wall(int x, int y, CELL_STATE ctype);
00079 int height(void) const;
00081 int width(void) const;
00083 void save_rom_map(long ROM_ADDRESS) const;
00085 void load_rom_map(long ROM_ADDRESS);
00087 bool obstacles(void);
00089 void branches(short);
00090 private:
00091 CELL_TYPE value(int x, int y) const;
00092 void whipitgood(motion_chain& path);
00093 void generate_bellman_matrix(void);
00094 void update_frontiers(int,int, atomic_rotation);
00095 void process_frontiers(int,int);
00096 bool unique_frontier(int, int);
00097 void traverse_back2goal(motion_chain& path);
00098
00099 bool check_heading(atomic_rotation AR,int x, int y, int& imin);
00100 pose_chain _frontiers;
00101 pose_chain _visited;
00102 void init(void);
00103 void reinit(void);
00104 maze_cell _maze[22][22];
00105 int _starting_x;
00106 int _starting_y;
00107 int _starting_face;
00108 int _destination_x;
00109 int _destination_y;
00110 atomic_rotation _destination_face;
00111 atomic_rotation _new_face;
00112 int _new_x;
00113 int _new_y;
00114
00115 int _size_x;
00116 int _size_y;
00117 bool _done;
00118 bool _obstacles;
00119 short BRANCHES;
00120 };
00121
00122 #endif