예제 #1
0
파일: Par.cpp 프로젝트: jdh8/dds
int main()
{
  ddTableResults DDtable;
  parResults pres;

  int res;
  char line[80];
  bool match;

#if defined(__linux) || defined(__APPLE__)
  SetMaxThreads(0);
#endif

  for (int handno = 0; handno < 3; handno++)
  {
    SetTable(&DDtable, handno);

    res = Par(&DDtable, &pres, vul[handno]);

    if (res != RETURN_NO_FAULT)
    {
      ErrorMessage(res, line);
      printf("DDS error: %s\n", line);
    }

    match = ComparePar(&pres, handno);

    printf("Par, hand %d: %s\n\n",
           handno + 1, (match ? "OK" : "ERROR"));

    PrintTable(&DDtable);

    PrintPar(&pres);
  }
}
예제 #2
0
int main()
{
  boardsPBN bo;
  playTracesPBN DDplays;
  solvedPlays solved;

  int chunkSize = 1, res;
  char line[80];
  bool match;

#if defined(__linux) || defined(__APPLE__)
  SetMaxThreads(0);
#endif

  bo.noOfBoards = 3;
  DDplays.noOfBoards = 3;

  for (int handno = 0; handno < 3; handno++)
  {
    bo.deals[handno].trump = trump[handno];
    bo.deals[handno].first = first[handno];

    bo.deals[handno].currentTrickSuit[0] = 0;
    bo.deals[handno].currentTrickSuit[1] = 0;
    bo.deals[handno].currentTrickSuit[2] = 0;

    bo.deals[handno].currentTrickRank[0] = 0;
    bo.deals[handno].currentTrickRank[1] = 0;
    bo.deals[handno].currentTrickRank[2] = 0;

    strcpy(bo.deals[handno].remainCards, PBN[handno]);

    DDplays.plays[handno].number = playNo[handno];
    strcpy(DDplays.plays[handno].cards, play[handno]);
  }

  res = AnalyseAllPlaysPBN(&bo, &DDplays, &solved, chunkSize);

  if (res != RETURN_NO_FAULT)
  {
    ErrorMessage(res, line);
    printf("DDS error: %s\n", line);
  }

  for (int handno = 0; handno < 3; handno++)
  {
    match = ComparePlay(&solved.solved[handno], handno);

    sprintf(line, "AnalyseAllPlaysBin, hand %d: %s\n",
            handno + 1, (match ? "OK" : "ERROR"));

    PrintPBNHand(line, bo.deals[handno].remainCards);

    PrintPBNPlay(&DDplays.plays[handno], &solved.solved[handno]);
  }
}
예제 #3
0
파일: dtest.cpp 프로젝트: Afwas/dds
int main(int argc, char * argv[])
{
  int ncores = 0;
  if (argc == 4)
    ncores = atoi(argv[3]);

  SetMaxThreads(ncores);

  realMain(argc, argv);

  exit(0);
}
예제 #4
0
int main()
{
  ddTableDealsPBN DDdealsPBN;
  ddTablesRes tableRes;
  allParResults pres;

  int mode = 0: // No par calculation
  int trumpFilter[DDS_STRAINS] = {0, 0, 0, 0, 0}; // All
  int res;
  char line[80];
  bool match;

#if defined(__linux) || defined(__APPLE__)
  SetMaxThreads(0);
#endif

  DDdealsPBN.noOfTables = 3;

  for (int handno = 0; handno < 3; handno++)
  {
    for (int h = 0; h < DDS_HANDS; h++)
      for (int s = 0; s < DDS_SUITS; s++)
        strcpy(DDdealsPBN.deals[handno].cards, PBN[handno]);
  }

  res = CalcAllTablesPBN(&DDdealsPBN, mode, trumpFilter,
                         &tableRes, &pres);

  if (res != RETURN_NO_FAULT)
  {
    ErrorMessage(res, line);
    printf("DDS error: %s\n", line);
  }

  for (int handno = 0; handno < 3; handno++)
  {
    match = CompareTable(&tableRes.results[handno], handno);

    sprintf(line,
            "CalcDDtable, hand %d: %s\n",
            handno + 1, (match ? "OK" : "ERROR"));

    PrintPBNHand(line, DDdealsPBN.deals[handno].cards);

    PrintTable(&tableRes.results[handno]);
  }
}
예제 #5
0
파일: CalcDDtable.cpp 프로젝트: Afwas/dds
int main()
{
  ddTableDeal tableDeal;
  ddTableResults table;

  int res;
  char line[80];
  bool match;

#if defined(__linux) || defined(__APPLE__)
  SetMaxThreads(0);
#endif

  for (int handno = 0; handno < 3; handno++)
  {

    for (int h = 0; h < DDS_HANDS; h++)
      for (int s = 0; s < DDS_SUITS; s++)
        tableDeal.cards[h][s] = holdings[handno][s][h];

    res = CalcDDtable(tableDeal, &table);

    if (res != RETURN_NO_FAULT)
    {
      ErrorMessage(res, line);
      printf("DDS error: %s\n", line);
    }

    match = CompareTable(&table, handno);

    sprintf(line,
            "CalcDDtable, hand %d: %s\n",
            handno + 1, (match ? "OK" : "ERROR"));

    PrintHand(line, tableDeal.cards);

    PrintTable(&table);
  }
}
예제 #6
0
파일: dds.cpp 프로젝트: jdh8/dds
extern "C" BOOL APIENTRY DllMain(
  HMODULE hModule,
  DWORD ul_reason_for_call,
  LPVOID lpReserved)
{

  if (ul_reason_for_call == DLL_PROCESS_ATTACH)
    SetMaxThreads(0);
  else if (ul_reason_for_call == DLL_PROCESS_DETACH)
  {
    CloseDebugFiles();
    FreeMemory();
#ifdef DDS_MEMORY_LEAKS_WIN32
    _CrtDumpMemoryLeaks();
#endif
  }

  UNUSED(hModule);
  UNUSED(lpReserved);

  return 1;
}
예제 #7
0
파일: itest.cpp 프로젝트: jdh8/dds
int main(int argc, char * argv[])
{
  int ncores = 0;
  if (argc == 4)
    ncores = atoi(argv[3]);

  SetMaxThreads(ncores);

  DDSInfo info;
  GetDDSInfo(&info);
  printf("%s", info.systemString);
  printf("%-12s %20s\n\n", "Version", info.versionString);
  fflush(stdout);

  realMain(argc, argv);

#ifdef DDS_SCHEDULER
  scheduler.PrintTiming();
#endif

  FreeMemory();

  exit(0);
}
예제 #8
0
파일: dds.cpp 프로젝트: jdh8/dds
static void __attribute__ ((constructor)) libInit(void)
{
  SetMaxThreads(0);
}
예제 #9
0
파일: dds.cpp 프로젝트: jdh8/dds
void DDSInitialize(void) 
{
  SetMaxThreads(0);
}
예제 #10
0
int main()
{
  boards bo;
  playTracesBin DDplays;
  solvedPlays solved;

  int chunkSize = 1, res;
  char line[80];
  bool match;

#if defined(__linux) || defined(__APPLE__)
  SetMaxThreads(0);
#endif

  bo.noOfBoards = 3;
  DDplays.noOfBoards = 3;

  for (int handno = 0; handno < 3; handno++)
  {
    bo.deals[handno].trump = trump[handno];
    bo.deals[handno].first = first[handno];

    bo.deals[handno].currentTrickSuit[0] = 0;
    bo.deals[handno].currentTrickSuit[1] = 0;
    bo.deals[handno].currentTrickSuit[2] = 0;

    bo.deals[handno].currentTrickRank[0] = 0;
    bo.deals[handno].currentTrickRank[1] = 0;
    bo.deals[handno].currentTrickRank[2] = 0;

    for (int h = 0; h < DDS_HANDS; h++)
      for (int s = 0; s < DDS_SUITS; s++)
        bo.deals[handno].remainCards[h][s] = holdings[handno][s][h];

    DDplays.plays[handno].number = playNo[handno];
    for (int i = 0; i < playNo[handno]; i++)
    {
      DDplays.plays[handno].suit[i] = playSuit[handno][i];
      DDplays.plays[handno].rank[i] = playRank[handno][i];
    }
  }

  res = AnalyseAllPlaysBin(&bo, &DDplays, &solved, chunkSize);

  if (res != RETURN_NO_FAULT)
  {
    ErrorMessage(res, line);
    printf("DDS error: %s\n", line);
  }

  for (int handno = 0; handno < 3; handno++)
  {
    match = ComparePlay(&solved.solved[handno], handno);

    sprintf(line, "AnalyseAllPlaysBin, hand %d: %s\n",
            handno + 1, (match ? "OK" : "ERROR"));

    PrintHand(line, bo.deals[handno].remainCards);

    PrintBinPlay(&DDplays.plays[handno], &solved.solved[handno]);
  }
}