Example #1
0
File: tests.c Project: craig429/OI
char continuityTest()
{
	char str[20];

	if( terminalPresent == TRUE )
		printf( "Continuity Test\n" );
	lcdSetDDRAMAddress( 0x00 );
	sprintf( str, "Continuity Test" );
	lcdWriteString( str );	
	lcdSetDDRAMAddress( 0x40 );
 	sprintf( str, " " );
	lcdWriteString( str );
	oneSecond();
	oneSecond();
	oneSecond();
	oneSecond();
	oneSecond();

	return TRUE;
}
Example #2
0
int main()
#endif
{
#ifdef TEST
   UtlMemCheck* pMemCheck = 0;
   pMemCheck = new UtlMemCheck();      // checkpoint for memory leak check
#endif //TEST

   cout << "Entering main()" << endl;

/* ============================ Testing Start ============================= */

   /* ============================ OsProcess ==================================== */
#if defined(_WIN32) || defined(__pingtel_on_posix__)  //vxworks wont use these classes

   osPrintf("Starting Process test...\n");


    //Text Process Class
    if (TestProcessClass() != OS_SUCCESS)
        osPrintf("TestProcessterator FAILED!\n");

    //Test Process Iterator
    if (TestProcessIterator() != OS_SUCCESS)
        osPrintf("TestProcessterator FAILED!\n");

    //Test Process Manager methods
    if (TestProcessMgr() != OS_SUCCESS)
        osPrintf("TestProcessterator FAILED!\n");


    osPrintf("Finished Process test.\n");
#endif

/* ============================ OsTime ==================================== */

   OsTime* pTime;

   pTime = new OsTime();
   delete pTime;

/* ============================ OsMutex =================================== */

   OsMutex* pMutex;

   pMutex = new OsMutex(0);
   delete pMutex;

/* ============================ OsBSem ==================================== */

   OsBSem* pBSem;

   pBSem = new OsBSem(OsBSem::Q_PRIORITY, OsBSem::FULL);
   assert(pBSem->acquire()    == OS_SUCCESS);
   assert(pBSem->tryAcquire() == OS_BUSY);
   assert(pBSem->release()    == OS_SUCCESS);
   delete pBSem;

/* ============================ OsCSem ==================================== */

   OsCSem* pCSem;

   // the initial count on the semaphore will be 2
   pCSem = new OsCSem(OsCSem::Q_PRIORITY, 2);
   assert(pCSem->acquire()    == OS_SUCCESS);  // take it once
   assert(pCSem->acquire()    == OS_SUCCESS);  // take it twice
   assert(pCSem->tryAcquire() == OS_BUSY);
   assert(pCSem->release()    == OS_SUCCESS);  // release once
   assert(pCSem->release()    == OS_SUCCESS);  // release twice
   delete pCSem;

/* ============================ OsLock ==================================== */

   // Create a binary semaphore for use with an OsLock object
   pBSem = new OsBSem(OsBSem::Q_PRIORITY, OsBSem::FULL);

   // Acquire semaphore at the start of the method, release it on exit
   guardedWithBSem(*pBSem);
   delete pBSem;

/* ============================ OsRWMutex ================================= */

   OsRWMutex* pRWMutex;

   pRWMutex = new OsRWMutex(OsRWMutex::Q_FIFO);
   assert(pRWMutex->acquireRead()     == OS_SUCCESS);
   assert(pRWMutex->tryAcquireWrite() == OS_BUSY);
   assert(pRWMutex->releaseRead()     == OS_SUCCESS);
   assert(pRWMutex->tryAcquireWrite() == OS_SUCCESS);
   assert(pRWMutex->tryAcquireRead()  == OS_BUSY);
   assert(pRWMutex->releaseWrite()    == OS_SUCCESS);
   delete pRWMutex;

/* ============================ OsReadLock and OsWriteLock ================ */

   // Create an OsRWMutex for use with OsReadLock and OsWriteLock objects
   pRWMutex = new OsRWMutex(OsRWMutex::Q_FIFO);

   // Acquire read lock at the start of the method, release it on exit
   guardedForReading(*pRWMutex);

   // Acquire write lock at the start of the method, release it on exit
   guardedForWriting(*pRWMutex);
   delete pRWMutex;

/* ============================ OsNameDb ================================== */

   OsNameDb* pNameDb;

   int storedInt;

   pNameDb = OsNameDb::getNameDb();
   assert(pNameDb->isEmpty());
   assert(pNameDb->numEntries() == 0);

   assert(pNameDb->insert("test1", 1) == OS_SUCCESS);
   assert(pNameDb->insert("test1", 2) == OS_NAME_IN_USE);
   assert(!pNameDb->isEmpty());
   assert(pNameDb->numEntries() == 1);

   assert(pNameDb->insert("test2", 2) == OS_SUCCESS);
   assert(pNameDb->numEntries() == 2);

   assert(pNameDb->lookup("test1", NULL)       == OS_SUCCESS);
   assert(pNameDb->lookup("test1", &storedInt) == OS_SUCCESS);
   assert(storedInt == 1);
   assert(pNameDb->lookup("test2", &storedInt) == OS_SUCCESS);
   assert(storedInt == 2);
   assert(pNameDb->lookup("test3", NULL)       == OS_NOT_FOUND);

   pNameDb->remove("test1");
   pNameDb->remove("test2");

   delete pNameDb;

/* ============================ OsMsgQ ==================================== */

   OsMsgQ* pMsgQ1;
   OsMsg* pMsg1;
   OsMsg* pMsg2;
   OsMsg* pRecvMsg;

   pMsgQ1 = new OsMsgQ(OsMsgQ::DEF_MAX_MSGS, OsMsgQ::DEF_MAX_MSG_LEN,
                       OsMsgQ::Q_PRIORITY, "MQ1");

   pMsg1  = new OsMsg(OsMsg::UNSPECIFIED, 0);
   pMsg2  = new OsMsg(OsMsg::UNSPECIFIED, 0);

   assert(pMsgQ1->isEmpty());
   assert(pMsgQ1->numMsgs() == 0);
   assert(pMsgQ1->getSendHook() == NULL);
   pMsgQ1->setSendHook(msgSendHook);
   assert(pMsgQ1->getSendHook() == msgSendHook);

   OsStatus stat = pMsgQ1->send(*pMsg1);

   assert(stat == OS_SUCCESS);
   assert(!pMsgQ1->isEmpty());
   assert(pMsgQ1->numMsgs() == 1);

   stat = pMsgQ1->send(*pMsg2);
   assert(stat == OS_SUCCESS);

   assert(pMsgQ1->numMsgs() == 2);

   stat = pMsgQ1->receive(pRecvMsg);
   assert(stat == OS_SUCCESS);

   delete pRecvMsg;
   assert(pMsgQ1->numMsgs() == 1);

   stat = pMsgQ1->receive(pRecvMsg);
   assert(stat == OS_SUCCESS);
   delete pRecvMsg;

   assert(pMsgQ1->numMsgs() == 0);

   delete pMsg1;
   delete pMsg2;

#if !defined(_VXWORKS)
   try
   {
      OsMsgQ* pMsgQ2 = new OsMsgQ(OsMsgQ::DEF_MAX_MSGS,
                                  OsMsgQ::DEF_MAX_MSG_LEN,
                                  OsMsgQ::Q_PRIORITY,
                                  "MQ1");
      delete pMsgQ2;
   }
   catch (const OsExcept* exc)
   {

      UtlString txt;
      cout << "Exception:" << endl;
      cout << "  Major Code: " << exc->getMajorCode() << endl;
      cout << "  Minor Code: " << exc->getMinorCode() << endl;
      txt = exc->getText();
      cout << "  Text:       " << txt.data()    << endl;
      txt = exc->getContext();
      cout << "  Context:    " << txt.data() << endl;

      delete exc;
   }
#endif

   delete pMsgQ1;

/* ============================ OsCallback ================================ */

   OsCallback* pCallback;

   pCallback = new OsCallback(12345, handleTimerEvent);
   pCallback->signal(67890);
   delete pCallback;

/* ============================ OsEvent =================================== */

   OsTime   eventTimeout(2,0);
   OsEvent* pEvent;

   cout << "Testing OsEvent, please wait..." << endl;
   pEvent = new OsEvent(12345);
   int epochTime = time(NULL);
   assert(pEvent->wait(eventTimeout) != OS_SUCCESS);
   pEvent->signal(67890);
   assert(pEvent->wait(eventTimeout) == OS_SUCCESS);
   pEvent->reset();
   assert(pEvent->wait(eventTimeout) != OS_SUCCESS);
   epochTime = time(NULL) - epochTime;

   // Make sure we waited (approximately) 2 seconds each time.
   assert(epochTime > 2 && epochTime < 6);

   delete pEvent;
   cout << "Done testing OsEvent." << endl;

/* ============================ OsConfigDb ================================ */

   OsConfigDb* pConfigDb;

   pConfigDb = new OsConfigDb();
   delete pConfigDb;

/* ============================ OsTimerTask =============================== */

   OsTimerTask* pTimerTask;
   pTimerTask = OsTimerTask::getTimerTask();
   OsTask::delay(500);    // wait 1/2 second
   osPrintf("Going to delete the timer task.\n");
   delete pTimerTask;

/* ============================ OsTimer =================================== */

   pTimerTask = OsTimerTask::getTimerTask();
   OsTask::delay(500);    // wait 1/2 second
   OsCallback* pNotifier;
   OsCallback* pNotifier2;
   OsTimer*    pTimer;
   OsTimer*    pTimer2;
   OsTime      tenMsec(0, 10000);// timer offset ten msec into the future
   OsTime      oneSecond(1,0);   // timer offset one second into the future
   OsTime      twoSeconds(2,0);  // timer offset two seconds into the future
   OsTime      tenSeconds(10,0); // timer offset ten seconds into the future
   OsTime      tenYears(10*365*24*60*60, 0);  // ten years into the future

   cout << "About to handle timer 1 (immediate)" << endl;
   pNotifier = new OsCallback(1, handleTimerEvent);
   pTimer = new OsTimer(*pNotifier);
   cout << "  Oneshot timer 1 armed at " <<
           OsDateTime::getSecsSinceEpoch() << " secs" << endl;
   pTimer->oneshotAfter(OsTime::NO_WAIT);
   delete pTimer;
   delete pNotifier;

   cout << "About to handle timer 2" << endl;
   pNotifier = new OsCallback(2, handleTimerEvent);
   pTimer = new OsTimer(*pNotifier);
   cout << "  Oneshot timer 2 armed at " <<
           OsDateTime::getSecsSinceEpoch() << " secs" << endl;
   pTimer->oneshotAfter(oneSecond);
   delete pTimer;            // delete the timer before it can expire
   delete pNotifier;

   cout << "About to handle timer 3" << endl;
   pNotifier = new OsCallback(3, handleTimerEvent);
   pTimer = new OsTimer(*pNotifier);
   cout << "  Oneshot timer 3 armed at " <<
           OsDateTime::getSecsSinceEpoch() << " secs" << endl;
   pTimer->oneshotAfter(oneSecond);
   pTimer->stop();           // stop the timer before it can expire
   delete pTimer;
   delete pNotifier;

   cout << "About to handle timer 4 (after 1 sec)" << endl;
   pNotifier = new OsCallback(4, handleTimerEvent);
   pTimer = new OsTimer(*pNotifier);
   cout << "  Oneshot timer armed at " <<
           OsDateTime::getSecsSinceEpoch() << endl;
   pTimer->oneshotAfter(oneSecond);
   OsTask::delay(1500);  // sleep for 1.5 seconds
   delete pTimer;
   delete pNotifier;

   cout << "About to handle timer 5" << endl;
   pNotifier = new OsCallback(5, handleTimerEvent);
   pTimer = new OsTimer(*pNotifier);
   cout << "  Periodic timer 5 armed at " <<
           OsDateTime::getSecsSinceEpoch() << " secs" << endl;
   pTimer->periodicEvery(oneSecond, oneSecond);
   delete pTimer;            // delete the timer before it can expire
   delete pNotifier;

   cout << "About to handle timer 6" << endl;
   pNotifier = new OsCallback(6, handleTimerEvent);
   pTimer = new OsTimer(*pNotifier);
   cout << "  Periodic timer 6 armed at " <<
           OsDateTime::getSecsSinceEpoch() << " secs" << endl;
   pTimer->periodicEvery(oneSecond, oneSecond);
   pTimer->stop();           // stop the timer before it can expire
   delete pTimer;
   delete pNotifier;

   cout << "About to handle timer 7 (immediate, then every second)" << endl;
   cout << "About to handle timer 8 (immediate, then every two seconds)" << endl;
   pNotifier  = new OsCallback(7, handleTimerEvent);
   pNotifier2 = new OsCallback(8, handleTimerEvent);
   pTimer  = new OsTimer(*pNotifier);
   pTimer2 = new OsTimer(*pNotifier2);
   cout << "  Periodic timer 7 armed at " <<
           OsDateTime::getSecsSinceEpoch() << " secs" << endl;
   pTimer->periodicEvery(OsTime::NO_WAIT, oneSecond);
   cout << "  Periodic timer 8 armed at " <<
           OsDateTime::getSecsSinceEpoch() << " secs" << endl;
   pTimer2->periodicEvery(OsTime::NO_WAIT, twoSeconds);
   OsTask::delay(4500);  // sleep for 4.5 seconds
   pTimer->stop();
   pTimer2->stop();
   delete pTimer;
   delete pTimer2;
   delete pNotifier;
   delete pNotifier2;

   cout << "About to handle timer 9 (after ten seconds)" << endl;
   pNotifier = new OsCallback(9, handleTimerEvent);
   pTimer = new OsTimer(*pNotifier);
   cout << "  Oneshot timer 9 armed at " <<
           OsDateTime::getSecsSinceEpoch() << " secs" << endl;
   pTimer->oneshotAfter(tenSeconds);
   OsTask::delay(12000);  // sleep for 12 seconds
   delete pTimer;
   delete pNotifier;

   cout << "About to handle timer 10 (after 6912 seconds)" << endl;
   OsTime secs6912(6912, 0);
   pNotifier = new OsCallback(10, handleTimerEvent);
   pTimer = new OsTimer(*pNotifier);
   cout << "  Oneshot timer 10 armed at " <<
           OsDateTime::getSecsSinceEpoch() << " secs" << endl;
   pTimer->oneshotAfter(secs6912);
   OsTask::delay(12000);  // sleep for 12 seconds
   delete pTimer;
   delete pNotifier;

   cout << "Verify that we can schedule timers in the distant future" << endl;
   pNotifier = new OsCallback(11, handleTimerEvent);
   pTimer  = new OsTimer(*pNotifier);
   cout << "  Oneshot timer armed 11 at " <<
           OsDateTime::getSecsSinceEpoch() << " secs" << endl;
   pTimer->oneshotAfter(tenYears);
   pTimer->stop();
   pTimer->periodicEvery(OsTime::NO_WAIT, tenYears);
   pTimer->stop();
   delete pTimer;
   delete pNotifier;

   cout << "Run 100x/second timer for 2 seconds..." << endl;
   int rapidTimerExpirations = 0;
   pNotifier = new OsCallback(&rapidTimerExpirations, handleRapidTimerEvent);
   pTimer = new OsTimer(*pNotifier);
   cout << "  Rapid-fire timer armed at " <<
           OsDateTime::getSecsSinceEpoch() << " secs" << endl;
   pTimer->periodicEvery(OsTime::NO_WAIT, tenMsec);
   OsTask::delay(2000);
   pTimer->stop();
   cout << "  Rapid-fire timer stopped at " <<
           OsDateTime::getSecsSinceEpoch() << " secs" << endl;
   cout << "Rapid-fire timer expired " << rapidTimerExpirations << " times" << endl;
   delete pTimer;
   delete pNotifier;

/* ============================ OsTimerTask cleanup ======================= */

   // The timer task may have been created indirectly (as a result of
   // creating OsTimer objects). If the timer task exists, delete it now.
   pTimerTask = OsTimerTask::getTimerTask();
   if (pTimerTask != NULL)
   {
      osPrintf("Going to delete the timer task.\n");
      delete pTimerTask;
   }

/* ============================ OsNameDb cleanup ========================== */

   // The name database may have been created indirectly (as a result of
   // creating objects with global names). If the name database exists,
   // delete it now.
   pNameDb = OsNameDb::getNameDb();
   if (pNameDb != NULL)
      delete pNameDb;

/* ============================ Testing Finish ============================ */

   cout << "Leaving main()" << endl;

#ifdef TEST
   assert(pMemCheck->delta() == 0);    // check for memory leak
   delete pMemCheck;
#endif //TEST

   return 0;
}
Example #3
0
void main (void)
{
    char temp;
    char str[20];
    int i;

    for( i=0; i < 32; i++ ) lcdString[i] = 0x20;
    timer0Count = messageCount = i = 0;
    irqCount = 0;
    toggle = FALSE;
    P0_0 = 0;
    inIndex = outIndex = 0;
    terminalPresent = TRUE;

    systemInit();

    // These next 5 instructions should init trhe chip after power up
    // according to datasheet page 45 - Initializing by instruction.
    // Except the SetDDRAM instruction, but I can't get anything going
    // without it (!!!)
    lcdSetDDRAMAddress( 0x00 );	// Why do I need this before lcdinit()?
    lcdInit();					// Send 3 Function Set commands
    lcdSetFunction();			// Now the real Function Set
    lcdDisplayOnOff( OFF );		// etc.
    lcdClearDisplay();

    // LCD should now be initialized
    lcdSetEntryMode( 1, 0 );	// Cursor position increment, no dsiplay shift
    lcdDisplayOnOff( ON );
    lcdCursorOnOff( OFF );
    lcdBlinkOnOff( OFF );

    startInterrupts();

    lcdSetDDRAMAddress( 0x00 );
    sprintf( str, "   EMBEEDED TEST" );
    lcdWriteString( str );
    lcdSetDDRAMAddress( 0x40 );
    sprintf( str, "     powered by:" );
    lcdWriteString( str );

    oneSecond();
    oneSecond();
    oneSecond();
    lcdSetDDRAMAddress( 0x00 );
    sprintf( str, "Overton Instruments" );
    lcdWriteString( str );
    lcdSetDDRAMAddress( 0x40 );
    sprintf( str, "** OI - microATE **" );
    lcdWriteString( str );

    oneSecond();
    oneSecond();
    oneSecond();

    temp = readThumbwheels();
    testMode = temp & 0xf0;
    testMode >>= 4;
    testMode &= 0x0f;
    testSelect = temp & 0x0f;

    if( ( testMode == 9 ) && ( testSelect == 9 ) )
    {
        // Run system configuration menu
        // Call System_config_menu
        printf( "System Config Menu\n" );
    }

    nextUnit = FALSE;
    if( terminalPresent == TRUE )
    {
        printf( "NDS Test Fixture, Code Ver: %s\n", VERSION );
    }

    lcdClearDisplay();
    startButton = FALSE;
    stopButton = FALSE;
    fixtureReady = FALSE;
    dutPresent = FALSE;
    lcdSetDDRAMAddress( 0x00 );
    lcdWriteString( "Install DUT and" );
    lcdSetDDRAMAddress( 0x40 );
    lcdWriteString( "press Start" );

    oneSecond();
    oneSecond();
    oneSecond();

    while(1)
    {
        if( ( startButton == TRUE ) && ( stopButton == FALSE ) )
        {
            if( ( fixtureReady == TRUE ) && ( dutPresent == TRUE ) )
            {
                printf( "Present and Ready\n" );
                if( continuityTest() == TRUE )
                {
                    lcdSetDDRAMAddress( 0x40 );
                    lcdWriteString( "      PASSED!" );
                }
                else
                {
                    lcdSetDDRAMAddress( 0x40 );
                    lcdWriteString( "         FAIL" );
                }
                startButton = FALSE;
                fixtureReady = FALSE;
                dutPresent = FALSE;
            }
            else
            {
                runLEDOnOff( ON );
                passLEDOnOff( ON );
                failLEDOnOff( ON );
                oneSecond();
                runLEDOnOff( OFF );
                passLEDOnOff( OFF );
                failLEDOnOff( OFF );
                oneSecond();
            }
        }

        // Reset IRQ if port pin has gone high again
        if( ( irq0 == TRUE ) && ( P3_2 == ON ) )
        {
            ext0Enable();
            irq0 = FALSE;
        }
    }
}
TwoPlayerTimingGameWidget2::TwoPlayerTimingGameWidget2(AbstractRule::Gesture gesture) :
    frameCount(0),
    startAnimCount(0),
    endAnimCount(-1),
    timeUp(false)
{
  QFont f;
  f.setPixelSize(FONT_DIGIT_SIZE);

  youWin.addText(- FONT_DIGIT_SIZE * 9 / 4, 0, f, "You Win~~");
  youLose.addText(- FONT_DIGIT_SIZE * 11 / 4, 0, f, "You Lose-.-");
  drawGame.addText(- FONT_DIGIT_SIZE * 9 / 4, 0, f, "Draw Game");

  // Create the rule
  if (gesture == AbstractRule::Swap)
    rule = new SwapTimingGameRule();
  else
    rule = new RotateTimingGameRule();

  // Create the gameboard info
  gameboardInfo = new ThirtySevenGameBoardInfo();

  // Create the controller
  controller1 = new CoreController(rule, gameboardInfo, NULL);

  // Create the controller
  controller2 = new CoreController(rule, gameboardInfo, NULL);

  // Move the balls to the correct position
  // and avoid elimination at the beginning
  controller1->fillAllBlanks();
  do
  {
    controller1->setNeedTestStableEliminate(true);
    for (int i = 0;i < gameboardInfo->totalBallCounts();++i)
      if (controller1->balls[i])
        controller1->balls[i]->moveToStablePos();
  } while (controller1->advance());

  for (int i = 0;i < gameboardInfo->totalBallCounts();++i)
    if (controller1->balls[i])
      controller1->balls[i]->setState(Ball::JustCreated);

  controller1->autoRotate();

  // Move the balls to the correct position
  // and avoid elimination at the beginning
  controller2->fillAllBlanks();
  do
  {
    controller2->setNeedTestStableEliminate(true);
    for (int i = 0;i < gameboardInfo->totalBallCounts();++i)
      if (controller2->balls[i])
        controller2->balls[i]->moveToStablePos();
  } while (controller2->advance());

  for (int i = 0;i < gameboardInfo->totalBallCounts();++i)
    if (controller2->balls[i])
      controller2->balls[i]->setState(Ball::JustCreated);

  controller2->autoRotate();

  // Create the gesture controller
  gestureController1 = new GestureController(rule,
                                             gameboardInfo,
                                             controller1,
                                             NULL);

  // Create the gesture controller
  gestureController2 = new GestureController(rule,
                                             gameboardInfo,
                                             controller2,
                                             NULL);

  currentScore1 = new IntegerItem(0);
  currentScore1->setPos(QPointF(0.38, 0.125));
  currentScore1->setValue(0);
  currentScore1->setRotation(90);
  currentScore1->setHint("Current Score");
  myItems.push_back(currentScore1);

  currentScore2 = new IntegerItem(0);
  currentScore2->setPos(QPointF(0.62, 0.875));
  currentScore2->setValue(0);
  currentScore2->setRotation(-90);
  currentScore2->setHint("Current Score");
  myItems.push_back(currentScore2);

  timeBar = new VerticalProgressBarItem2();
  timeBar->setPos(QPointF(0.5, 0.5));
  timeBar->setCurrent(60);
  timeBar->setMin(0);
  timeBar->setMax(60);
  myItems.push_back(timeBar);

  flame1 = new FlameItem();
  flame1->setPos(QPointF(0.3, 0.08));
  flame1->setCurrent(0);
  flame1->setRotation(90);
  myItems.push_back(flame1);

  flame2 = new FlameItem();
  flame2->setPos(QPointF(0.7, 0.92));
  flame2->setCurrent(0);
  flame2->setRotation(-90);
  myItems.push_back(flame2);

  star1 = new StarItem();
  star1->setPos(QPointF(0.3, 0.17));
  star1->setCurrent(0);
  star1->setRotation(90);
  myItems.push_back(star1);

  star2 = new StarItem();
  star2->setPos(QPointF(0.7, 0.83));
  star2->setCurrent(0);
  star2->setRotation(-90);
  myItems.push_back(star2);

  resetItem1 = new ButtonItem("Reset");
  resetItem1->setPos(QPointF(0.165, 0.15));
  resetItem1->setRotation(90);
  myItems.push_back(resetItem1);

  resetItem2 = new ButtonItem("Reset");
  resetItem2->setPos(QPointF(0.835, 0.85));
  resetItem2->setRotation(-90);
  myItems.push_back(resetItem2);

  pauseItem1 = new ButtonItem("Pause");
  pauseItem1->setPos(QPointF(0.115, 0.15));
  pauseItem1->setRotation(90);
  myItems.push_back(pauseItem1);

  pauseItem2 = new ButtonItem("Pause");
  pauseItem2->setPos(QPointF(0.885, 0.85));
  pauseItem2->setRotation(-90);
  myItems.push_back(pauseItem2);

  exitItem1 = new ButtonItem("Exit");
  exitItem1->setPos(QPointF(0.065, 0.15));
  exitItem1->setRotation(90);
  myItems.push_back(exitItem1);

  exitItem2 = new ButtonItem("Exit");
  exitItem2->setPos(QPointF(0.935, 0.85));
  exitItem2->setRotation(-90);
  myItems.push_back(exitItem2);

  // No items was chosen
  itemAtPressPos1 = NULL;

  // No items was chosen
  itemAtPressPos2 = NULL;

  // No items was chosen
  itemAtPressPos = NULL;

  // Connect signals and slots
  connect(controller1,
          SIGNAL(goodMove()),
          this,
          SLOT(goodMove()));
  connect(controller1,
          SIGNAL(badMove()),
          this,
          SLOT(badMove()));
  connect(controller1,
          SIGNAL(stableEliminateTested(Connections)),
          this,
          SLOT(dealStableEliminate1(Connections)));
  connect(controller1,
          SIGNAL(eliminated(int)),
          this,
          SLOT(eliminated1(int)));

  connect(controller2,
          SIGNAL(goodMove()),
          this,
          SLOT(goodMove()));
  connect(controller2,
          SIGNAL(badMove()),
          this,
          SLOT(badMove()));
  connect(controller2,
          SIGNAL(stableEliminateTested(Connections)),
          this,
          SLOT(dealStableEliminate2(Connections)));
  connect(controller2,
          SIGNAL(eliminated(int)),
          this,
          SLOT(eliminated2(int)));

  // Create the timers and connect signals and slots
  t = new QTimer();
  t->setInterval(75);
  connect(t, SIGNAL(timeout()), this, SLOT(advance()));

  oneSecondTimer = new QTimer();
  oneSecondTimer->setInterval(1000);
  connect(oneSecondTimer, SIGNAL(timeout()), this, SLOT(oneSecond()));
}