void Scopa::startMatch(bool jumpControl) { if(!jumpControl && !matchHasEnded()) { throw exception(exception::MATCH_HAS_NOT_ENDED); } pointsMatch[PLAYER_ZERO] = 0; pointsMatch[PLAYER_ONE] = 0; moveAll(table,deck); moveAll(hand[PLAYER_ZERO],deck); moveAll(hand[PLAYER_ONE],deck); moveAll(capturedPile[PLAYER_ZERO],deck); moveAll(capturedPile[PLAYER_ONE],deck); dealTable(); dealHand(PLAYER_ZERO); dealHand(PLAYER_ONE); }
// Нажата кнопка "<<" void MainWindow::on_buttonToLeftAll_pressed() { int i; i=sender()->property("index").toInt(); // Индекс кнопки moveAll(i,MoveBlock::ToLeft); refresh(); }
// Нажата кнопка ">>" void MainWindow::on_buttonToRightAll_pressed() { int i; i=sender()->property("index").toInt(); // Индекс кнопки moveAll(i); refresh(); }
// Действие переместить все налево void MainWindow::on_actionMoveAllLeft_activated() { for (int i=0;i<mover.count;i++) { if (mover.moveBlocks[i]->direction==MoveBlock::ToLeft || mover.moveBlocks[i]->direction==MoveBlock::ToBoth) { moveAll(i,MoveBlock::ToLeft); } } refresh(); }
/** Called when asyn clients call pasynInt32->write(). * Extracts the function and axis number from pasynUser. * Sets the value in the parameter library. * If the function is HXPMoveAll_ then it calls moves all motors with a single command * For all other functions it calls asynMotorController::writeInt32. * Calls any registered callbacks for this pasynUser->reason and address. * \param[in] pasynUser asynUser structure that encodes the reason and address. * \param[in] value Value to write. */ asynStatus HXPController::writeInt32(asynUser *pasynUser, epicsInt32 value) { int function = pasynUser->reason; asynStatus status = asynSuccess; HXPAxis *pAxis = getAxis(pasynUser); static const char *functionName = "writeInt32"; /* Set the parameter and readback in the parameter library. This may be overwritten when we read back the * status at the end, but that's OK */ status = setIntegerParam(pAxis->axisNo_, function, value); if (function == HXPMoveAll_) { /* if value == 1: motors are moved if value == 0: nothing is done and parameter is simply reset */ if (value == 1) { moveAll(pAxis); } } else if (function == HXPCoordSysReadAll_) { if (value == 1) { readAllCS(pAxis); } } else if (function == HXPCoordSysSet_) { if (value == 1) { setCS(pAxis); } } else { /* Call base class method */ status = asynMotorController::writeInt32(pasynUser, value); } /* Do callbacks so higher layers see any changes */ callParamCallbacks(pAxis->axisNo_); if (status) asynPrint(pasynUser, ASYN_TRACE_ERROR, "%s:%s: error, status=%d function=%d, value=%d\n", driverName, functionName, status, function, value); else asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, "%s:%s: function=%d, value=%d\n", driverName, functionName, function, value); return status; }
void Scopa::evaluateScore() { if(!matchHasEnded()) { throw exception(exception::MATCH_HAS_NOT_ENDED); } moveAll(table,capturedPile[lastCapturePlayer]); // cards if(capturedPile[PLAYER_ZERO].size() > capturedPile[PLAYER_ONE].size()) { pointsMatch[PLAYER_ZERO]++; } else if(capturedPile[PLAYER_ZERO].size() < capturedPile[PLAYER_ONE].size()) { pointsMatch[PLAYER_ONE]++; } // denari std::function<bool(Card)> isOfDenari = [](Card card){ return card.suit == Card::DENARI; }; CardGroup capturedDenari[PLAYER_NUMBER]; capturedDenari[PLAYER_ZERO] = capturedPile[PLAYER_ZERO].filter(isOfDenari); capturedDenari[PLAYER_ONE] = capturedPile[PLAYER_ONE].filter(isOfDenari); if(capturedDenari[PLAYER_ZERO].size() > capturedDenari[PLAYER_ONE].size()) { pointsMatch[PLAYER_ZERO]++; } else if(capturedDenari[PLAYER_ZERO].size() < capturedDenari[PLAYER_ONE].size()) { pointsMatch[PLAYER_ONE]++; } }
void level::play() { ScoreBasedEvents(); TimeBasedEvents(); if (playerShip->isAlive()) { std::list<game_object *> newdrawList; int prlife = playerShip->get_life(); newdrawList = playerShip->collisions(enemyList); if (prlife>playerShip->get_life()) { playerShip->downgradeWeapons(); rumble(); } drawableList.insert(drawableList.end(),newdrawList.begin(),newdrawList.end()); } moveAll(); playStick(); }
void pileOver(int a, int b) { moveAll(a,b); }
void pileOnto(int a, int b) { resetAbove(b); moveAll(a,b); }
// move all servo at the same time to a position: servo list building void HerkulexClass::moveAllAngle(int servoID, float angle, int iLed) { if (angle > 160.0|| angle < -160.0) return; // out of the range int position = (int)(angle/0.325) + 512; moveAll(servoID, position, iLed); }
int main(int argc, char *argv[]) /* Process command line. */ { boolean drop, move, copy; struct sigaction sigSpec; setlinebuf(stdout); setlinebuf(stderr); ZeroVar(&sigSpec); sigSpec.sa_handler = sigStopSignaled; sigSpec.sa_flags = SA_RESTART; if (sigaction(SIGUSR1, &sigSpec, NULL) < 0) errnoAbort("can't set SIGUSR1 handler"); optionInit(&argc, argv, optionSpecs); drop = optionExists("drop"); move = optionExists("move"); copy = optionExists("copy"); gReload = optionExists("reload"); if (move || copy) { if (argc != 3) usage(); } else if (argc != 2) usage(); if ((drop+move+copy) > 1) errAbort("can only specify one of -drop, -move, or -copy"); gbVerbInit(optionInt("verbose", 0)); if (gbVerbose >= 6) sqlMonitorEnable(JKSQL_TRACE); if (drop) dropAll(argv[1]); else if (move) moveAll(argv[1], argv[2]); else if (copy) copyAll(argv[1], argv[2]); else { char *reloadList = optionVal("reloadList", NULL); gDatabase = argv[1]; gOptions = dbLoadOptionsParse(gDatabase); gForceIgnoreDelete = optionExists("forceIgnoreDelete"); if (optionExists("rebuildDerived")) gOptions.flags |= DBLOAD_BYPASS_GBLOADED|DBLOAD_REBUILD_DERIVED; gMaxShrinkage = optionFloat("maxShrinkage", 0.1); gGbdbGenBank = optionVal("gbdbGenBank", NULL); if (gGbdbGenBank == NULL) gGbdbGenBank = gbConfGet(gOptions.conf, "gbdb.genbank"); if (gGbdbGenBank == NULL) gGbdbGenBank = "/gbdb/genbank"; gWorkDir = optionVal("workdir", "work/load"); if (gOptions.flags & DBLOAD_DRY_RUN) printf("*** using dry run mode ***\n"); gbLoadRna(reloadList); } return 0; }