test avoid bulled game
Dependencies: C12832_lcd LCD_fonts mbed mbed-rtos
Diff: Stage.cpp
- Revision:
- 24:88968d1fc9cb
- Parent:
- 22:5a7399899fe6
- Child:
- 40:ec5c1b305b9a
--- a/Stage.cpp Mon Dec 12 10:19:12 2016 +0000 +++ b/Stage.cpp Mon Dec 12 10:44:00 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