예제 #1
0
// Constructor
ProcessingThread::ProcessingThread(ImageBuffer *imageBuffer, int inputSourceWidth, int inputSourceHeight)
    : QThread(), imageBuffer(imageBuffer), inputSourceWidth(inputSourceWidth),
      inputSourceHeight(inputSourceHeight)
{
    // Create images
    currentFrameCopy.create(Size(inputSourceWidth,inputSourceHeight),CV_8UC3);
    currentFrameCopyGrayscale.create(Size(inputSourceWidth,inputSourceHeight),CV_8UC1);
    // Initialize variables
    stopped=false;
    sampleNo=0;
    fpsSum=0;
    avgFPS=0;
    fps.clear();
    // Initialize currentROI variable
    currentROI=Rect(0,0,inputSourceWidth,inputSourceHeight);
    // Store original ROI
    originalROI=currentROI;

    //pre-process surf params.
    preLoadGlyphs(this->Glyphs ,this->keypoints);

    //game-settings init.
    initGameState(&GameState, _GameLib_NUM_DECKS);
    this->pcounter = 0;

    cleanTable(&newTable);
    SetBlackFlag = 0;

    blackVal = 300000;


} // ProcessingThread constructor
예제 #2
0
void initGame(int stg) {
  status = IN_GAME;

  initShip();
  initShots();
  initFoes();
  initFrags();
  initBonuses();
  initBackground();

  initBarrages(stagePrm[stg][0], stagePrm[stg][1], stagePrm[stg][2]);
  initGameState(stg);
  if ( stg < STAGE_NUM ) {
    setStageBackground(stg%5+1);
    playMusic(stg%5+1);
  } else {
    if ( !insane ) {
      setStageBackground(0);
      playMusic(0);
    } else {
      setStageBackground(6);
      playMusic(6);
    }
  }
}
예제 #3
0
void GameClient::handleNewGreeting(QByteArray buffer)
{
    bool ok;
    // check it is rejected or accepted and get player id
    buffer.mid(1, 6).toInt(&ok, 16);
    if(ok) {
        m_myPlayerID = buffer.mid(1,6);
        m_gameState = new GameState;
        // update gui
        emit initGameState(m_gameState);
        emit newClientInfo(m_myPlayerID+",0,WAIT");
    } else {
        m_connection->disconnectFromHost();
    }

    // add log
    emit newLog(QString(buffer));
}
예제 #4
0
int main(int argc, char* argv[]){
  int count = 0;
  int player = 0; //player 1 = 0
  struct gameState *state = newGame();

  printf("Testing fullDeckDount Function:\n");
  printf("PLEASE SEE NOTES IN HEADER\n");
//initialize hands for 2 players
initGameState(state);


//Call fullDeckCount, store count in variable
count = fullDeckCount(player, 0, state);  //passing curse card
printf("Count should = 3 total curse cards in deck: \n1 in hand + 1 in deck + 1 in discard = %d\n", count);
printf("TEST PASSED\n");

return 0;
}
예제 #5
0
파일: rr.c 프로젝트: pwhelan/rrootage
void initGame(int stg) {
  int sn;
  status = IN_GAME;

  initBoss();
  initFoes();
  initShip();
  initLasers();
  initFrags();
  initShots();

  initGameState(stg);
  sn = stg%SAME_RANK_STAGE_NUM;
  initBackground(sn);
  if ( sn == SAME_RANK_STAGE_NUM-1 ) {
    playMusic(rand()%(SAME_RANK_STAGE_NUM-1));
  } else {
    playMusic(sn);
  }
}
예제 #6
0
파일: main.c 프로젝트: jeremymadea/quad
int
main (int argc, char *argv[])
{
  player_t turn;
  GameState game;
  move_t themove;
  int opt;

  while ((opt = getopt (argc, argv, "cD:ehl:sVv:20")) != -1)
    {
      switch (opt)
	{
	case 'l':
	  printf ("Level option (-l) is not yet implemented!\n");
	  printf (" -- you requested level %s.\n", optarg);
	  break;
	case 'e':
	  printf ("Expert option (-e) is not yet implemented!\n");
	  break;
	case 's':
	  printf ("Smiley option (-s) is not yet implemented!\n");
	  break;
	case 'v':
	  printf ("Verbose option (-v) is not yet implemented!\n");
	  printf (" -- you requested verbosity level %s.\n", optarg);
	  break;
	case '2':
	  printf ("2 player option (-2) is not yet implemented!\n");
	  break;
	case '0':
	  printf
	    ("Computer vs Computer option (-0) is not yet implemented!\n");
	  break;
	case 'D':
	  printf ("Debug option (-D) is not yet implemented!\n");
	  printf (" -- you requested Debug level %s.\n", optarg);
	  break;
	case 'V':
	  printf
	    ("Quad Version 0.8a By Jeremy Madea [email protected]\n");
	  printf (" Please Play me!\n");
	  exit (0);
	  break;
	case 'h':
	  printf ("Usage: quad [-v]\n");
	  exit (0);
	  break;
	case '?':
	  printf ("Invocation error... exiting\n");
	  exit (1);
	  break;
	}
    }




  do
    {
      turn = whoGoesFirst ();
      initGameState (&game, turn);
      displayTheBoard (&game);
      while (!gameOver (&game))
	{
	  themove = getMove (turn, &game);
	  playTheMove (turn, themove, &game);
	  turn = other (turn);
	  displayTheBoard (&game);
	}
      displayGameResult (&game);

    }
  while (doYouWantToPlayAgain ());

  exit (0);
}
예제 #7
0
int main(int argc, char* argv[]){
  int x;
  int player = 0; //player 1 = 0; initialize to something, will change later
  struct gameState *state = newGame();
  int i, j;
  int myHandCount;
  int myDeckCount;
  int myPlayCount;
  printf("Testing SMITHY Card Function:\n");
  srand(time(NULL));
//initialize hands for 2 players
initGameState(state);
  
  for(i = 0; i < 2000; i++){ //start with 5 for testing
	  SelectStream(2);
	  PutSeed(2);
    player = rand() % 2;
	state->whoseTurn = player;
	state->deckCount[player] = rand() % MAX_DECK;
	state->playedCardCount = rand() % MAX_DECK;
	state->handCount[player] = rand() % MAX_HAND;
    
   //put smithy card in the player's hand
   state->hand[player][0] = smithy;
   //randomize rest of the cards in the player's hand
   for(j = 1; j < state->handCount[player] - 1; j++){
      state->hand[player][j] = rand() %27;
   }
   //randomize cards in the discard pile
   for(j = 0; j < state->playedCardCount; j++){
	   state->discard[player][j] = rand() % 27;
   }
   //randomize cards in the deck
   for(j = 0; j < state->deckCount[player]; j++){
      state->discard[player][j] = rand() % 27;
   }

//initialize values of players deck counts
//save teh details of what the state was before playing the smithy card.
//This is used to track my expectations of how the card SHOULD play because the state is going to change as the card is played
   myHandCount = state->handCount[player];
   myDeckCount = state->deckCount[player];
   myPlayCount = state->playedCardCount;

   printf("Starting handCount = %d\n", myHandCount);
   printf("Starting deckCount = %d\n", myDeckCount);
   printf("Starting playedCardCount = %d\n", myPlayCount);

//play the smithy card
   smithyCard(player, state, 0);

/*******************************************************************
 * TESTING HAND, DECK, DISCARD AND PLAY
*******************************************************************/

//myHandCount should now = original handCount + 3 -1
x = myHandCount + 3 - 1;
if(state->handCount[player] == x){
  printf("Testing myHandCount: TEST PASSED\n");
} else{
printf("Testing myHandCount: TEST FAILED: expected: %d, actual: %d\n", x, state->handCount[player]);
}

//myDeckCount should now = original deckCount + 1
x = myDeckCount - 3;//because 3 were taken from my deck and added to my hand 
if(state->deckCount[player] == x) {//if it is correct
  printf("Testing myDeckCount: TEST PASSED\n");
} else {
  printf("Testing myDeckCount: TEST FAILED: expected %d, actual %d\n", x, state->deckCount[player]);
}

//myPlayCount should now = original playCount + 1
x = myPlayCount + 1;
if(state->playedCardCount == x) {//if it is correct
  printf("Testing myPlayCount: TEST PASSED\n");
} else {
  printf("Testing myPlayCount: TEST FAILED: expected %d, actual %d\n", x, state->playedCardCount);
}
} //end of for loop

return 0;
}