void Logic::run(std::vector<int> &avaiable, std::vector<int> &taken) { short int posPlayer, posAI; string posPlayerStr; cout << "WHAT POSITON DO YOU CHOOSE? (0,9)" << std::endl; while(std::cin >> posPlayer) { deleteVecPlayerOnly(avaiable,taken,posPlayer); returnPos(posAI,avaiable,taken); deleteVec(avaiable,taken,posPlayer,posAI); if(posPlayer <= 9 && posPlayer >= 0){ mgraph.draw(); mgraph.drawX(posPlayer,"X"); mgraph.drawX(posAI,"O"); }else{ try{ if(true) throw "UNEXPECTED POSITON"; } catch(char const *error){ exit(1); } } } }
//Assigns values to an array that stores the information around the robot void scan(int & distance, int & angle, int & color) { //stores angle of found ball angle = nMotorEncoder[motorA]; //Goes forward to check the ball checkBall(color, distance); //Returns back before continuing the scan returnPos(distance); }
//Moves forward for a given distance, launches the cage and returns void getBall(int distance) { nMotorEncoder[motorA] = 0; motor[motorA] = 50; motor[motorC] = 50; while (distance>nMotorEncoder[motorA]){} motor[motorA] = 0; motor[motorC] = 0; launchCage(true); returnPos(distance); launchCage(false); }
void insert(List *list, TypeOfWord word) { if (existInList(list, word)) { returnPos(list, word)->value->countOfWord++; } else { ElementOfList *element = new ElementOfList; element->value = createNewElement(); element->value->word = word; element->value->countOfWord = 1; element->next = list->head; list->head = element; } }