yei
Dependencies: interface mbed enc_1multi calPID motorout KondoServoLibrary
Fork of cat18_operate by
calplace/calplace.cpp
- Committer:
- shimizuta
- Date:
- 2018-08-27
- Revision:
- 20:13934809e117
- Child:
- 23:f45eb02433a5
File content as of revision 20:13934809e117:
#include "calplace.h" #include "mbed.h" #include "debug.h" #include "workinfo.h" const int kFirstPutPlace = 9;//シューティングボックスで最初に置く場所 int CalPickPlace() //どれを取るのがいいか検索する { DEBUG("CalPickPlace() start\r\n"); int i; int best=23; //priorityの値を入れる for(i=0; i<=22; i++) { if(work[i].is_exist) { if(work[i].priority<work[best].priority) { best=i; } } } DEBUG("CalPickPlace() finish worknum %d\r\n", best); return best; } //3つ同じ色が揃うよう置く場所を計算。 int CalPutPlace(Color workcolor) { DEBUG("CalPutPlace() start\r\n"); int is_finish = 0; int num =kFirstPutPlace; for(int j=0; j<4 && is_finish == 0; j++) { for(int i=0; i<3 && is_finish == 0; i++) { num = kFirstPutPlace - j * 3 +i; if(!shootingbox[num].is_exist) is_finish = 1; if(workcolor != shootingbox[num].color) break; } } DEBUG("CalPutPlace() finish return %d\r\n", num); return num; }