Пример #1
0
Файл: main.c Проект: tcode/Poker
int generateHoldCards()
{
int card;


card = Randomizer(); //Here I should implement the check whether the cards are dealt !,
//if they are dealt I should call Randomizer again!
printf("%d\n", (abs((card%52+1))));
/*
 * All the cards since this will only play hold 'em I only need to give 2 cards!
 * Okay this might be quite ineffecient since I will still need to check whether that 
 * particular card have been selected once already.
 * | Spades | Hearts | Clubs  | Diamond
 * | 2 = 1  |  2 =14 |  2 =27 |  2 =40
 * | 3 = 2  |  3 =15 |  3 =28 |  3 =41
 * | 4 = 3  |  4 =16 |  4 =29 |  4 =42
 * | 5 = 4  |  5 =17 |  5 =30 |  5 =43
 * | 6 = 5  |  6 =18 |  6 =31 |  6 =44
 * | 7 = 6  |  7 =19 |  7 =32 |  7 =45
 * | 8 = 7  |  8 =20 |  8 =33 |  8 =46
 * | 9 = 8  |  9 =21 |  9 =34 |  9 =47
 * | 10= 9  |  10=22 |  10=35 |  10=48
 * | J =10  |  J =23 |  J =36 |  J =49
 * | Q =11  |  Q =24 |  Q =37 |  Q =50
 * | K =12  |  K =25 |  K =38 |  K =51
 * | A =13  |  A =26 |  A =39 |  A =52
 * |___________________________________
 */
return 0;
}
Пример #2
0
 void OutdoorPvPBT::HandleKill(Player * player, Unit * killed)
 {
         uint32 take = POINTS_LOSE_ON_NPC_KILL;
         if(killed->GetTypeId() == TYPEID_PLAYER) // Killing players will take their resources away. It also gives extra honor.
         {
                 if(player->GetGUID() != killed->GetGUID())
                         return;
  
                 switch(killed->ToPlayer()->GetTeam())
                 {
                    case ALLIANCE:
                            m_ally_gathered -= take;
                            Randomizer(player);
                    break;
  
                    case HORDE:
                            m_horde_gathered -= take;
                            Randomizer(player);
                    break;
                 }
         }
         else // If is something besides a player
         {
                 if(player->GetTeam() == ALLIANCE)
                 {
                         switch(killed->GetEntry()) // Alliance killing horde guards
                         {
                             case WARSONG_BATTLEGUARD:
                                         m_horde_gathered -= take;
                                         Randomizer(player); // Randomizes the honor reward
                                 break;
  
                             case WARSONG_BATTLEGUARD_2: // 2?
                                         m_horde_gathered -= take;
                                         Randomizer(player); // Randomizes the honor reward
                                 break;
  
                             case WARSONG_CAPTAIN:
                                         m_horde_gathered -= take;
                                         Randomizer(player); // Randomizes the honor reward
                                 break;
  
                             case WARSONG_CARAVAN_GUARD:
                                         m_horde_gathered -= take;
                                         Randomizer(player); // Randomizes the honor reward
                                 break;
  
                             case WARSONG_HONOR_GUARD:
                                         m_horde_gathered -= take;
                                         Randomizer(player); // Randomizes the honor reward
                                 break;
  
                             case WARSONG_MARKSMAN:
                                         m_horde_gathered -= take;
                                         Randomizer(player); // Randomizes the honor reward
                                 break;
  
                             case WARSONG_RECRUITMENT_OFFICER:
                                         m_horde_gathered -= take;
                                         Randomizer(player); // Randomizes the honor reward
                                 break;
  
                             case WARSONG_SCOUT:
                                         m_horde_gathered -= take;
                                         Randomizer(player); // Randomizes the honor reward
                                 break;
  
                             case WARSONG_WIND_RIDER:
                                         m_horde_gathered -= take;
                                         Randomizer(player); // Randomizes the honor reward
                                 break;
                         }
                 }
                 else // Horde
                 {
                         switch(killed->GetEntry()) // Horde killing alliance guards
                         {
                             case VALIANCE_KEEP_CANNONEER:
                                         m_ally_gathered -= take;
                                         Randomizer(player); // Randomizes the honor reward
                             break;
  
                             case VALIANCE_KEEP_DEFENDER:
                                         m_ally_gathered -= take;
                                         Randomizer(player); // Randomizes the honor reward
                             break;
  
                             case VALIANCE_KEEP_FISHERMAN:
                                         m_ally_gathered -= take;
                                         Randomizer(player); // Randomizes the honor reward
                             break;
  
                             case VALIANCE_KEEP_FOOTMAN: // Wrong?
                                         m_ally_gathered -= take;
                                         Randomizer(player); // Randomizes the honor reward
                             break;
  
                             case VALIANCE_KEEP_FOOTMAN_2: // 2?
                                         m_ally_gathered -= take;
                                         Randomizer(player); // Randomizes the honor reward
                             break;
  
                             case VALIANCE_KEEP_OFFICER:
                                         m_ally_gathered -= take;
                                         Randomizer(player); // Randomizes the honor reward
                             break;
  
                             case VALIANCE_KEEP_RIFLEMAN:
                                         m_ally_gathered -= take;
                                         Randomizer(player); // Randomizes the honor reward
                             break;
  
                             case VALIANCE_KEEP_WORKER:
                                         m_ally_gathered -= take;
                                         Randomizer(player); // Randomizes the honor reward
                             break;
  
                             case DURDAN_THUNDERBEAK:
                                         m_ally_gathered -= take;
                                         Randomizer(player); // Randomizes the honor reward
                             break;
                         }
                 }
         }
 }
Пример #3
0
int AJ_Main_nvramtest()
{
    AJ_Status status = AJ_OK;
    static uint16_t oRand = 0;
    while (status == AJ_OK) {
        AJ_AlwaysPrintf(("AJ Initialize\n"));
        AJ_Initialize();

#ifdef OBS_ONLY
        AJ_RandBytes(&oRand, sizeof(oRand));
        AJ_InfoPrintf(("BEGIN OBSWRITE TEST\n"));
        status = testObsWrite();
        if (oRand % 2 == 0) {
            AJ_InfoPrintf(("CALLING REBOOT WITHOUT REWRITING TO 0"));
#ifdef READABLE_LOG
            AJ_Sleep(1500);
#endif
            AJ_Reboot();
        }
        AJ_InfoPrintf(("REWRITE OBS TO 0 AND READ TEST\n"));
#ifdef READABLE_LOG
        AJ_Sleep(1500);
#endif
        status = TestNvramDelete();
        AJ_Reboot();
#endif
        AJ_NVRAM_Clear();

        AJ_AlwaysPrintf(("TEST LOCAL AND REMOTE CREDS\n"));
        status = TestCreds();
        AJ_ASSERT(status == AJ_OK);
#ifdef READABLE_LOG
        AJ_Sleep(1500);
#endif

        AJ_AlwaysPrintf(("AJ_Main 2\n"));
        status = TestNVRAM();
#ifdef READABLE_LOG
        AJ_Sleep(1500);
#endif

#ifdef RAND_DATA
        Randomizer();
#endif
        AJ_InfoPrintf(("\nBEGIN GUID EXIST TEST\n"));
        status = TestExist();
#ifdef READABLE_LOG
        AJ_Sleep(1500);
#endif
        AJ_InfoPrintf(("\nBEGIN OBSWRITE TEST\n"));
        status = TestObsWrite();
#ifdef READABLE_LOG
        AJ_Sleep(1500);
#endif

        AJ_InfoPrintf(("\nOBSWRITE STATUS %u, BEGIN WRITE TEST\n", status));
#ifdef READABLE_LOG
        AJ_Sleep(1500);
#endif
        status = TestNvramWrite();
        AJ_InfoPrintf(("\nWRITE STATUS %u, BEGIN READ TEST\n", status));
#ifdef READABLE_LOG
        AJ_Sleep(1500);
#endif
        status = TestNvramRead();
        AJ_InfoPrintf(("\nREAD STATUS %u, BEGIN DELETE TEST\n", status));
#ifdef READABLE_LOG
        AJ_Sleep(1500);
#endif
        status = TestNvramDelete();
        AJ_InfoPrintf(("\nDONE\n"));

        AJ_AlwaysPrintf(("AJ_Main 3\n"));
        AJ_ASSERT(status == AJ_OK);

        AJ_InfoPrintf(("\nDELETE STATUS %u, NVRAMTEST RUN %u TIMES\n", status, count++));
#ifdef READABLE_LOG
        AJ_Sleep(3000);
#endif

        status = TestECCCreds();
        AJ_InfoPrintf(("\nECC STATUS %u, NVRAMTEST RUN %u TIMES\n", status, count++));
        AJ_ASSERT(status == AJ_OK);
    }
    return 0;
}