![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
yei
Dependencies: interface mbed enc_1multi calPID motorout KondoServoLibrary
Fork of cat18_operate by
calplace/calplace.cpp
- Committer:
- shimizuta
- Date:
- 2018-09-02
- Revision:
- 23:f45eb02433a5
- Parent:
- 20:13934809e117
File content as of revision 23:f45eb02433a5:
#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) { if(shootingbox[kFirstPutPlace].is_exist == 1 || work[i].areaname == WORKAREA) { best=i; } } } } DEBUG("CalPickPlace() return 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() return return %d\r\n", num); return num; }