test avoid bulled game

Dependencies:   C12832_lcd LCD_fonts mbed mbed-rtos

Files at this revision

API Documentation at this revision

Comitter:
pypy_o8o
Date:
Mon Dec 12 11:00:24 2016 +0000
Parent:
25:a08a1f5fbb6a
Parent:
24:88968d1fc9cb
Child:
27:afdaee781efa
Commit message:
b

Changed in this revision

--- a/Stage.cpp	Mon Dec 12 10:58:04 2016 +0000
+++ b/Stage.cpp	Mon Dec 12 11:00:24 2016 +0000
@@ -1,14 +1,16 @@
 #include "point.h"
 #include "models.h"
+#include "mbed.h"
 #include <stdlib.h>
 #include <stdio.h> 
 
+#define MAX_LEN ONE_STEP_SIZE*3
+
 Stage::Stage(){
     length = LCD_X;
     for(int i = 0; i < LCD_X; i++){
         stage[i] = 1;
     }
-    srand(1);
 }
 
 int* Stage::getStage(){
@@ -40,6 +42,15 @@
     return stage;
 }
 
+int Stage::nextStep(){
+    if(stage[LCD_X - 1] == stage[LCD_X - 2 - ONE_STEP_SIZE]){
+        return stage[LCD_X - 1] + 4;
+    }else{
+        return rand()%(LCD_Y - 5);
+    }
+}
+
+
 int Stage::getLength(){
     return length;
 }
\ No newline at end of file
--- a/models.h	Mon Dec 12 10:58:04 2016 +0000
+++ b/models.h	Mon Dec 12 11:00:24 2016 +0000
@@ -56,6 +56,7 @@
 private:
     int length;
     int stage[LCD_X]; 
+    int nextStep();
 public:
     Stage();
     int* getStage();