commit 64ee446faaa45db3a768bed2c9e8a98d2b2f5075
Author: Yuyang <yuyang@yuyang-VirtualBox.(none)>
Date:   Sat Dec 1 01:10:02 2012 -0500

    a poor barebone of maze_solve that I wasn't able to finish

diff --git a/scout/libscout/src/behaviors/maze_solve.cpp b/scout/libscout/src/behaviors/maze_solve.cpp
new file mode 100644
index 0000000..3586540
--- /dev/null
+++ b/scout/libscout/src/behaviors/maze_solve.cpp
@@ -0,0 +1,139 @@
+/**
+ * Copyright (c) 2011 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "maze_solve.h"
+
+using namespace std;
+
+
+// want to have a minimal working thing, use a big enough 
+// static array and start in the middle
+// we assume we are facing right, that affects where we store
+// wall information
+// -1 for wall, 0 for unseen, 1 for traveled, 2 for critical
+static int map[60][60];
+#define WALL -1
+#define UNSEEN 0
+#define SEEN 1
+#define CRITICAL 2
+// facings
+#define UP 0
+#define RIGHT 1
+#define DOWN 2
+#define LEFT 3
+void maze_solve::run(){
+    
+    // TODO:first initialize map to all 0's
+    solve(25,25, RIGHT);
+}
+bool maze_solve::solve(row, col, dir)
+{   
+    // use backtracking to solve the maze
+    if (at_destination()) {
+        // not really sure what to do next... just chill here
+        return true;
+    }
+
+    else
+    {
+        // this function should fill the adjacent cells around me with
+        // wall's or paths
+        look_around(row, col, dir);
+        
+        if (at_dead_end(row, col, dir))
+        {
+            // set the scout to a back tracking direction
+            spot_turn();
+            return false;
+        }
+        
+        /* try go up */
+        // no need to check range because we assume our map is big enough
+        if (map[row-1][col] != WALL)
+        {
+            turn_from_to(dir, UP);
+            line_follow();
+            // halts at intersection
+            bool solved = solve(row-1, col)
+            if (solved) {
+                //yeah!!! don't really know what to do now...
+                // hopefully send some message to some other scout
+                // waiting for my valuable information
+            }
+            else {
+                // whoops, that path did not work out
+                // redo the move, since the recursive call has 
+                // already put me into the right direction, I will just 
+                // drive back and halt at intersection
+                line_follow();
+                // undo the turning
+                turn_from_to()
+            }            
+        }
+        
+        /* try right */
+        if (map[row][col+1] != WALL)
+        {
+            turn_from
+        }
+
+    }
+
+}
+
+// this function takes in the current direction and turns the scout
+// into it intended direction
+void maze_solve::turn_from_to(int current_dir, int intended_dir) {
+    switch ((4 + intended_dir - current_dir) % 4) 
+        case 0:
+            turn_straight();
+            break;
+        case 1:
+            turn_right();
+            break;
+        case 2:
+            break;
+        case 3:
+            turn_left();
+            break;
+}
+
+int maze_solve::look_around(row, col)
+{
+    // look around current place using sonar
+    // store whether or not
+    // there is a wall into the map
+    // stores at row col 2 if point is critical, 1 otherwise
+}
+
+bool maze_solve::at_destination() 
+{
+    
+}
+
+bool wall_in_direction()
+{
+    
+}
diff --git a/scout/libscout/src/behaviors/maze_solve.h b/scout/libscout/src/behaviors/maze_solve.h
new file mode 100644
index 0000000..a7e2561
--- /dev/null
+++ b/scout/libscout/src/behaviors/maze_solve.h
@@ -0,0 +1,39 @@
+/**
+ * Copyright (c) 2011 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _MAZE_SOLVE_H_
+#define _MAZE_SOLVE_H_
+
+#include "../Behavior.h"
+
+class maze_solve: public line_follow
+{
+    public:
+        maze_solve(std::string scoutname, Sensors* sensors):
+            line_follow(scoutname, "maze_solve", sensors) {};
+        void run();
+}
+#endif
+
