]> rtime.felk.cvut.cz Git - eurobot/public.git/commitdiff
competition: preparation (we want to be able choose strategies) - first part
authorFilip Jares <filipjares@post.cz>
Sat, 1 May 2010 06:49:28 +0000 (08:49 +0200)
committerFilip Jares <filipjares@post.cz>
Sat, 1 May 2010 07:23:07 +0000 (09:23 +0200)
src/robofsm/competition.cc

index 5e35ed61e126b083120957a44656590d847bddb7..0c49db1cf5f3bc49ce0fdd4d9795c1bfb238f0aa 100644 (file)
@@ -192,26 +192,33 @@ FSM_STATE(zvedej_vidle)
  * MOVEMENT STATES
  ************************************************************************/
 
+static enum strategy {
+       OPPONENTS_ORAGES_TOO,
+       CORNS_ONLY
+} strategy = OPPONENTS_ORAGES_TOO;
+
 static enum which_side which_slope;
 static int slope_cnt = 0;
 FSM_STATE(approach_the_slope)
 {
        switch(FSM_EVENT) {
                case EV_ENTRY:
-                       if (slope_cnt == 0) {
-                               which_slope = MINE;
-                               FSM_TRANSITION(climb_the_slope);
-                       } else if (slope_cnt == 1) {
-                               which_slope = OPPONENTS;
-
-                               robot_goto_trans(
-                                       x_coord(0.3, which_slope),
-                                       PLAYGROUND_HEIGHT_M - ROBOT_WIDTH_M/2 - 0.03,
-                                       ARRIVE_FROM(DEG2RAD(0), 0.02),
-                                       &tcFast);
-                       } else {
-                               which_slope = MINE;
-                               FSM_TRANSITION(approach_next_corn);
+                       if (strategy == OPPONENTS_ORAGES_TOO) {
+                               if (slope_cnt == 0) {
+                                       which_slope = MINE;
+                                       FSM_TRANSITION(climb_the_slope);
+                               } else if (slope_cnt == 1) {
+                                       which_slope = OPPONENTS;
+                                       robot_goto_trans(
+                                               x_coord(0.3, which_slope),
+                                               PLAYGROUND_HEIGHT_M - ROBOT_WIDTH_M/2 - 0.03,
+                                               ARRIVE_FROM(DEG2RAD(0), 0.02),
+                                               &tcFast);
+                               } else {
+                                       which_slope = MINE;
+                                       FSM_TRANSITION(approach_next_corn);
+                               }
+                       } else if (strategy == CORNS_ONLY) {
                        }
                        slope_cnt++;
                        break;