int main(int argc,char **argv)
{
  int m;
  int n;
  int p;
  int curr_arg;
  bool bDebug;
  bool bVerbose;
  bool bReverse;
  int player_name_ix;
  int player_name_len;
  FILE *fptr;
  int line_len;
  int line_no;
  int dbg_line_no;
  int ix;
  int street;
  int num_street_markers;
  int starting_balance;
  int spent_this_street;
  int spent_this_hand;
  int end_ix;
  int uncalled_bet_amount;
  int collected_from_pot;
  int collected_from_pot_count;
  int ending_balance;
  int delta;
  int session_delta;
  int dbg;
  int work;
  double dwork1;
  double dwork2;
  bool bSkipping;

  if ((argc < 3) || (argc > 6)) {
    printf(usage);
    return 1;
  }

  bDebug = false;
  bVerbose = false;
  bReverse = false;

  for (curr_arg = 1; curr_arg < argc; curr_arg++) {
    if (!strcmp(argv[curr_arg],"-debug"))
      bDebug = true;
    else if (!strcmp(argv[curr_arg],"-verbose")) {
      bVerbose = true;
      getcwd(save_dir,_MAX_PATH);
    }
    else if (!strcmp(argv[curr_arg],"-reverse"))
      bReverse = true;
    else
      break;
  }

  if (argc - curr_arg != 2) {
    printf(usage);
    return 2;
  }

  player_name_ix = curr_arg++;
  player_name_len = strlen(argv[player_name_ix]);

  session_delta = 0;
  ending_balance = -1;

  if ((fptr = fopen(argv[curr_arg],"r")) == NULL) {
    printf(couldnt_open,argv[curr_arg]);
    return 3;
  }

  line_no = 0;
  bSkipping = false;

  for ( ; ; ) {
    GetLine(fptr,line,&line_len,MAX_LINE_LEN);

    if (feof(fptr))
      break;

    line_no++;

    if (line_no == dbg_line_no)
      dbg = 1;

    if (bDebug)
      printf("line %d %s\n",line_no,line);

    if (Contains(true,
      line,line_len,
      argv[player_name_ix],player_name_len,
      &ix)) {

      if (Contains(true,
        line,line_len,
        in_chips,IN_CHIPS_LEN,
        &ix)) {

        bSkipping = false;

        street = 0;
        num_street_markers = 0;
        spent_this_street = 0;
        spent_this_hand = 0;
        uncalled_bet_amount = 0;
        collected_from_pot = 0;
        collected_from_pot_count = 0;

        line[ix] = 0;

        for (ix--; (ix >= 0) && (line[ix] != '('); ix--)
          ;

        sscanf(&line[ix+1],"%d",&starting_balance);

        if (bDebug)
          printf("line %d starting_balance = %d\n",line_no,starting_balance);

        continue;
      }
      else if (bSkipping)
        continue;
      else if (Contains(true,
        line,line_len,
        posts,POSTS_LEN,
        &ix)) {
        work = get_work_amount(line,line_len);
        spent_this_street += work;

        if (bDebug) {
          printf("line %d street %d POSTS work = %d, spent_this_street = %d\n",
            line_no,street,work,spent_this_street);
        }

        continue;
      }
      else if (Contains(true,
        line,line_len,
        collected,COLLECTED_LEN,
        &ix)) {

        for (end_ix = ix + COLLECTED_LEN; end_ix < line_len; end_ix++) {
          if (line[end_ix] == ' ')
            break;
        }

        line[end_ix] = 0;
        sscanf(&line[ix + COLLECTED_LEN],"%d",&work);

        if (!collected_from_pot_count) {
          spent_this_hand += spent_this_street;
          street++;
          spent_this_street = 0;
        }

        collected_from_pot += work;
        collected_from_pot_count++;

        if (bDebug) {
          printf("line %d street %d COLLECTED work = %d, collected_from_pot = %d\n",
            line_no,street,work,collected_from_pot);
        }

        continue;
      }
      else if (!strncmp(line,uncalled_bet,UNCALLED_BET_LEN)) {
        sscanf(&line[UNCALLED_BET_LEN],"%d",&uncalled_bet_amount);
        spent_this_street -= uncalled_bet_amount;

        if (bDebug) {
          printf("line %d street %d UNCALLED uncalled_bet_amount = %d, spent_this_street = %d\n",
            line_no,street,uncalled_bet_amount,spent_this_street);
        }

        continue;
      }
      else if (Contains(true,
        line,line_len,
        folds,FOLDS_LEN,
        &ix)) {
        spent_this_hand += spent_this_street;

        if (bDebug) {
          printf("line %d street %d FOLDS spent_this_street = %d, spent_this_hand = %d\n",
            line_no,street,spent_this_street,spent_this_hand);
        }

        bSkipping = true;

        ending_balance = starting_balance - spent_this_hand + collected_from_pot;
        delta = ending_balance - starting_balance;
        session_delta += delta;

        continue;
      }
      else if (Contains(true,
        line,line_len,
        bets,BETS_LEN,
        &ix)) {
        work = get_work_amount(line,line_len);
        spent_this_street += work;

        if (bDebug) {
          printf("line %d street %d BETS work = %d, spent_this_street = %d\n",
            line_no,street,work,spent_this_street);
        }
      }
      else if (Contains(true,
        line,line_len,
        calls,CALLS_LEN,
        &ix)) {
        work = get_work_amount(line,line_len);
        spent_this_street += work;

        if (bDebug) {
          printf("line %d street %d CALLS work = %d, spent_this_street = %d\n",
            line_no,street,work,spent_this_street);
        }
      }
      else if (Contains(true,
        line,line_len,
        raises,RAISES_LEN,
        &ix)) {
        work = get_work_amount(line,line_len);
        spent_this_street = work;

        if (bDebug) {
          printf("line %d street %d RAISES work = %d, spent_this_street = %d\n",
            line_no,street,work,spent_this_street);
        }
      }
    }
    else if (bSkipping)
      continue;
    else {
      if (!strncmp(line,summary,SUMMARY_LEN)) {
        if (bDebug)
          printf("line %d SUMMARY line detected; skipping\n",line_no);

        bSkipping = true;

        ending_balance = starting_balance - spent_this_hand + collected_from_pot;
        delta = ending_balance - starting_balance;
        session_delta += delta;

        continue;
      }

      if (!strncmp(line,street_marker,STREET_MARKER_LEN)) {
        num_street_markers++;

        if (num_street_markers > 1) {
          if (street <= 3)
            spent_this_hand += spent_this_street;

          street++;
          spent_this_street = 0;
        }
      }
    }
  }

  fclose(fptr);

  if (!bVerbose) {
    if (!bReverse) {
      if (session_delta > 0)
        printf("%s\n",argv[curr_arg]);
    }
    else {
      if (session_delta < 0)
        printf("%s\n",argv[curr_arg]);
    }
  }
  else {
    if (!bReverse) {
      if (session_delta > 0)
        printf("%s/%s\n",save_dir,argv[curr_arg]);
    }
    else {
      if (session_delta < 0)
        printf("%s/%s\n",save_dir,argv[curr_arg]);
    }
  }

  return 0;
}
Exemplo n.º 2
0
int main(int argc,char **argv)
{
  int curr_arg;
  bool bDebug;
  bool bConsistency;
  bool bDelta;
  bool bStartingBalance;
  bool bTerse;
  bool bDoubleZero;
  bool bStud;
  bool bRazz;
  int player_name_ix;
  int player_name_len;
  FILE *fptr0;
  int filename_len;
  FILE *fptr;
  int line_len;
  int line_no;
  int ix;
  int street;
  int num_street_markers;
  int max_streets;
  int starting_balance;
  int ante;
  int bring_in;
  int spent_this_street;
  int spent_this_hand;
  int end_ix;
  int wagered_amount;
  int uncalled_bet_amount;
  int collected_from_pot;
  int collected_from_pot_count;
  int ending_balance;
  int delta;
  int max_ending_balance;
  int min_ending_balance;
  int max_delta;
  int min_delta;
  int max_starting_balance;
  int min_starting_balance;
  int file_no;
  int dbg_file_no;
  int dbg;
  int work;
  double dwork;
  int prev_ending_balance;

  if ((argc < 3) || (argc > 9)) {
    printf(usage);
    return 1;
  }

  bDebug = false;
  bConsistency = false;
  bDelta = false;
  bStartingBalance = false;
  bTerse = false;
  bDoubleZero = false;

  for (curr_arg = 1; curr_arg < argc; curr_arg++) {
    if (!strcmp(argv[curr_arg],"-debug")) {
      bDebug = true;
      getcwd(save_dir,_MAX_PATH);
    }
    else if (!strcmp(argv[curr_arg],"-consistency"))
      bConsistency = true;
    else if (!strcmp(argv[curr_arg],"-delta"))
      bDelta = true;
    else if (!strcmp(argv[curr_arg],"-starting_balance"))
      bStartingBalance = true;
    else if (!strcmp(argv[curr_arg],"-terse"))
      bTerse = true;
    else if (!strcmp(argv[curr_arg],"-double_zero"))
      bDoubleZero = true;
    else
      break;
  }

  if (argc - curr_arg != 2) {
    printf(usage);
    return 2;
  }

  if (bDelta && bStartingBalance) {
    printf("can't specify both -delta and -starting_balance\n");
    return 3;
  }

  player_name_ix = curr_arg++;
  player_name_len = strlen(argv[player_name_ix]);

  if ((fptr0 = fopen(argv[curr_arg],"r")) == NULL) {
    printf(couldnt_open,argv[curr_arg]);
    return 4;
  }

  ending_balance = -1;
  prev_ending_balance = -1;

  if (bDelta) {
    max_delta = -1;
    min_delta = 1;
  }
  else if (bStartingBalance) {
    max_starting_balance = -1;
    min_starting_balance = 1;
  }
  else {
    max_ending_balance = -1;
    min_ending_balance = 1;
  }

  file_no = 0;
  dbg_file_no = -1;

  for ( ; ; ) {
    GetLine(fptr0,filename,&filename_len,MAX_FILENAME_LEN);

    if (feof(fptr0))
      break;

    file_no++;

    if (dbg_file_no == file_no)
      dbg = 1;

    if ((fptr = fopen(filename,"r")) == NULL) {
      printf(couldnt_open,filename);
      continue;
    }

    line_no = 0;
    street = 0;
    num_street_markers = 0;
    ante = 0;
    bring_in = 0;
    spent_this_street = 0;
    spent_this_hand = 0;
    uncalled_bet_amount = 0;
    collected_from_pot = 0;
    collected_from_pot_count = 0;

    for ( ; ; ) {
      GetLine(fptr,line,&line_len,MAX_LINE_LEN);

      if (feof(fptr))
        break;

      line_no++;

      if (Contains(true,
        line,line_len,
        pokerstars,POKERSTARS_LEN,
        &ix)) {

        bStud = false;
        bRazz = false;

        if (Contains(true,
          line,line_len,
          stud,STUD_LEN,
          &ix)) {

          bStud = true;
        }
        else if (Contains(true,
          line,line_len,
          razz,RAZZ_LEN,
          &ix)) {

          bRazz = true;
        }

        if (bStud || bRazz)
          max_streets = 4;
        else
          max_streets = 3;
      }
      else if (Contains(true,
        line,line_len,
        argv[player_name_ix],player_name_len,
        &ix)) {

        if (Contains(true,
          line,line_len,
          in_chips,IN_CHIPS_LEN,
          &ix)) {

          line[ix] = 0;

          for (ix--; (ix >= 0) && (line[ix] != '('); ix--)
            ;

          sscanf(&line[ix+1],"%d",&starting_balance);

          if (bConsistency) {
            if ((ending_balance != -1) &&
                (ending_balance != starting_balance))
              printf("discrepancy: %s: starting balance of %d != "
                "last ending balance of %d\n",filename,
                starting_balance,ending_balance);
          }

          continue;
        }
        else if (Contains(true,
          line,line_len,
          posts_the_ante,POSTS_THE_ANTE_LEN,
          &ix)) {
          ante = get_work_amount(line,line_len);
          spent_this_hand = ante;
          continue;
        }
        else if ((bStud || bRazz) && Contains(true,
          line,line_len,
          brings_in_for,BRINGS_IN_FOR_LEN,
          &ix)) {
          bring_in = get_work_amount(line,line_len);
          spent_this_street += bring_in;
          continue;
        }
        else if (Contains(true,
          line,line_len,
          posts,POSTS_LEN,
          &ix)) {
          spent_this_street += get_work_amount(line,line_len);
          continue;
        }
        else if (!strncmp(line,dealt_to,DEALT_TO_LEN))
          continue;
        else if (Contains(true,
          line,line_len,
          collected,COLLECTED_LEN,
          &ix)) {

          for (end_ix = ix + COLLECTED_LEN; end_ix < line_len; end_ix++) {
            if (line[end_ix] == ' ')
              break;
          }

          line[end_ix] = 0;
          sscanf(&line[ix + COLLECTED_LEN],"%d",&work);

          if (!collected_from_pot_count) {
            spent_this_hand += spent_this_street;
            street++;
            spent_this_street = 0;
          }

          collected_from_pot += work;
          collected_from_pot_count++;

          continue;
        }
        else if (!strncmp(line,uncalled_bet,UNCALLED_BET_LEN)) {
          sscanf(&line[UNCALLED_BET_LEN],"%d",&uncalled_bet_amount);
          spent_this_street -= uncalled_bet_amount;
          continue;
        }
        else if (Contains(true,
          line,line_len,
          folds,FOLDS_LEN,
          &ix)) {
          spent_this_hand += spent_this_street;
          break;
        }
        else if (Contains(true,
          line,line_len,
          bets,BETS_LEN,
          &ix)) {
          spent_this_street += get_work_amount(line,line_len);
        }
        else if (Contains(true,
          line,line_len,
          calls,CALLS_LEN,
          &ix)) {
          spent_this_street += get_work_amount(line,line_len);
        }
        else if (Contains(true,
          line,line_len,
          raises,RAISES_LEN,
          &ix)) {
          spent_this_street = get_work_amount(line,line_len);
        }
      }
      else {
        if (!strncmp(line,summary,SUMMARY_LEN))
          break;

        if (!strncmp(line,street_marker,STREET_MARKER_LEN)) {
          num_street_markers++;

          if (num_street_markers > 1) {
            if (street <= max_streets)
              spent_this_hand += spent_this_street;

            street++;
            spent_this_street = 0;
          }
        }
      }
    }

    fclose(fptr);

    ending_balance = starting_balance - spent_this_hand + collected_from_pot;
    delta = ending_balance - starting_balance;

    if (bDelta) {
      if ((max_delta == -1) || (delta > max_delta)) {
        max_delta = delta;
        strcpy(max_filename,filename);
      }

      if ((min_delta == 1) || (delta < min_delta)) {
        min_delta = delta;
        strcpy(min_filename,filename);
      }
    }
    else if (bStartingBalance) {
      if ((max_starting_balance == -1) || (starting_balance > max_starting_balance)) {
        max_starting_balance = starting_balance;
        strcpy(max_filename,filename);
      }

      if ((min_starting_balance == 1) || (starting_balance < min_starting_balance)) {
        min_starting_balance = starting_balance;
        strcpy(min_filename,filename);
      }
    }
    else {
      if ((max_ending_balance == -1) || (ending_balance > max_ending_balance)) {
        max_ending_balance = ending_balance;
        strcpy(max_filename,filename);
      }

      if ((min_ending_balance == 1) || (ending_balance < min_ending_balance)) {
        min_ending_balance = ending_balance;
        strcpy(min_filename,filename);
      }
    }

    if (bDoubleZero) {
      if ((prev_ending_balance == 0) && (ending_balance == 0))
        ;
      else {
        prev_ending_balance = ending_balance;
        continue;
      }
    }

    prev_ending_balance = ending_balance;

    if (!bDebug) {
      if (bTerse) {
        if (bDelta)
          printf("%d\n",delta);
        else {
          printf("%10d %10d %10d %s/%s\n",
            starting_balance,delta,ending_balance,save_dir,filename);
        }
      }
      else if (bDelta)
        printf("%10d %s/%s\n",delta,save_dir,filename);
      else if (bStartingBalance)
        printf("%10d %s/%s\n",starting_balance,save_dir,filename);
      else
        printf("%10d %s/%s\n",ending_balance,save_dir,filename);
    }
    else {
      wagered_amount = spent_this_hand + uncalled_bet_amount;

      printf("%s/%s\n",save_dir,filename);
      printf("%10d starting_balance\n",starting_balance);

      if (ante)
        printf("%10d ante\n",ante);

      if (bring_in)
        printf("%10d bring_in\n",bring_in);

      printf("%10d wagered_amount\n",wagered_amount);
      printf("%10d uncalled_bet_amount\n",uncalled_bet_amount);
      printf("%10d spent_this_hand\n",spent_this_hand);
      printf("%10d collected_from_pot\n",collected_from_pot);
      printf("%10d ending_balance\n",ending_balance);
      printf("%10d delta\n",delta);
      printf("%10d num_street_markers\n",num_street_markers);
      printf("%10d streets\n",street);

      if (collected_from_pot && (delta > 0)) {
        dwork = (double)delta / (double)collected_from_pot;
        printf("%10.2lf opm_percentage\n",dwork);
        dwork = (double)ending_balance / (double)starting_balance;
        printf("%10.2lf starting_balance_multiplier\n",dwork);
      }
    }
  }

  fclose(fptr0);

  if (bDoubleZero || bTerse)
    return 0;

  if (bDelta) {
    if (max_delta != -1)
      printf("\n%10d %s\n",max_delta,max_filename);

    if (min_delta != 1)
      printf("%10d %s\n",min_delta,min_filename);
  }
  else if (bStartingBalance) {
    if (max_starting_balance != -1)
      printf("\n%10d %s\n",max_starting_balance,max_filename);

    if (min_starting_balance != 1)
      printf("%10d %s\n",min_starting_balance,min_filename);
  }
  else {
    if (max_ending_balance != -1)
      printf("\n%10d %s\n",max_ending_balance,max_filename);

    if (min_ending_balance != 1)
      printf("%10d %s\n",min_ending_balance,min_filename);
  }

  return 0;
}
Exemplo n.º 3
0
int main(int argc,char **argv)
{
  int m;
  int n;
  int p;
  int curr_arg;
  bool bDebug;
  bool bReverse;
  bool bCount;
  bool bExactCount;
  bool bReupped;
  bool bConsecutive;
  bool bShowZero;
  bool bOneAndDone;
  bool bStud;
  bool bMaxFeltDistance;
  bool bStartingStack;
  int starting_stack;
  int hit_felt_count;
  int reupped_count;
  int consecutive_hit_felt_count;
  int exact_count;
  int player_name_ix;
  int player_name_len;
  FILE *fptr0;
  int filename_len;
  FILE *fptr;
  int line_len;
  int line_no;
  int retval;
  int dbg_line_no;
  int ix;
  int street;
  int num_street_markers;
  int max_streets;
  int starting_balance;
  int ante;
  int bring_in;
  int spent_this_street;
  int spent_this_hand;
  int end_ix;
  int uncalled_bet_amount;
  int collected_from_pot;
  int collected_from_pot_count;
  int ending_balance;
  int file_no;
  int dbg_file_no;
  int dbg;
  int work;
  double dwork1;
  double dwork2;
  bool bSkipping;
  int hand_number;
  int last_felted_hand_number;
  int felt_distance;
  int max_felt_distance;
  char *date_string;

  if ((argc < 3) || (argc > 14)) {
    printf(usage);
    return 1;
  }

  bDebug = false;
  bReverse = false;
  bCount = false;
  bExactCount = false;
  bReupped = false;
  bConsecutive = false;
  bShowZero = false;
  bOneAndDone = false;
  bStud = false;
  bMaxFeltDistance = false;
  bStartingStack = false;

  for (curr_arg = 1; curr_arg < argc; curr_arg++) {
    if (!strcmp(argv[curr_arg],"-debug"))
      bDebug = true;
    else if (!strcmp(argv[curr_arg],"-reverse"))
      bReverse = true;
    else if (!strcmp(argv[curr_arg],"-count"))
      bCount = true;
    else if (!strncmp(argv[curr_arg],"-exact_count",12)) {
      bExactCount = true;
      sscanf(&argv[curr_arg][12],"%d",&exact_count);
    }
    else if (!strcmp(argv[curr_arg],"-reupped"))
      bReupped = true;
    else if (!strcmp(argv[curr_arg],"-consecutive"))
      bConsecutive = true;
    else if (!strcmp(argv[curr_arg],"-show_zero")) {
      bShowZero = true;
      bCount = true;
    }
    else if (!strcmp(argv[curr_arg],"-one_and_done"))
      bOneAndDone = true;
    else if (!strcmp(argv[curr_arg],"-stud"))
      bStud = true;
    else if (!strcmp(argv[curr_arg],"-max_felt_distance"))
      bMaxFeltDistance = true;
    else if (!strcmp(argv[curr_arg],"-starting_stack"))
      bStartingStack = true;
    else
      break;
  }

  if (argc - curr_arg != 2) {
    printf(usage);
    return 2;
  }

  if (bExactCount && bOneAndDone) {
    printf("can't specify both -exact_countn and -one_and_done\n");
    return 3;
  }

  if (bCount && bStartingStack) {
    printf("can't specify both -count and -starting_stack\n");
    return 4;
  }

  if (bExactCount && !exact_count)
    bShowZero = true;

  player_name_ix = curr_arg++;
  player_name_len = strlen(argv[player_name_ix]);

  if ((fptr0 = fopen(argv[curr_arg],"r")) == NULL) {
    printf(couldnt_open,argv[curr_arg]);
    return 5;
  }

  if (!bStud)
    max_streets = 3;
  else
    max_streets = 4;

  file_no = 0;
  dbg_file_no = -1;

  if (bConsecutive)
    consecutive_hit_felt_count = 0;

  for ( ; ; ) {
    GetLine(fptr0,filename,&filename_len,MAX_FILENAME_LEN);

    if (feof(fptr0))
      break;

    file_no++;

    if (dbg_file_no == file_no)
      dbg = 1;

    if ((fptr = fopen(filename,"r")) == NULL) {
      printf(couldnt_open,filename);
      continue;
    }

    retval = get_date_from_path(filename,'\\',3,&date_string);

    if (retval) {
      printf("get_date_from_path() on %s failed: %d\n",filename,retval);
      continue;
    }

    strcpy(prev_filename,date_string);

    line_no = 0;
    hit_felt_count = 0;
    ending_balance = -1;
    reupped_count = 0;
    hand_number = 0;

    if (bMaxFeltDistance) {
      last_felted_hand_number = 0;
      max_felt_distance = 0;
    }

    for ( ; ; ) {
      GetLine(fptr,line,&line_len,MAX_LINE_LEN);

      if (feof(fptr))
        break;

      line_no++;

      if (line_no == dbg_line_no)
        dbg = 1;

      if (bDebug)
        printf("line %d %s\n",line_no,line);

      if (Contains(true,
        line,line_len,
        argv[player_name_ix],player_name_len,
        &ix)) {

        if (Contains(true,
          line,line_len,
          in_chips,IN_CHIPS_LEN,
          &ix)) {

          hand_number++;

          bSkipping = false;

          if (ending_balance == 0)
            reupped_count++;

          street = 0;
          num_street_markers = 0;
          spent_this_street = 0;
          spent_this_hand = 0;
          uncalled_bet_amount = 0;
          collected_from_pot = 0;
          collected_from_pot_count = 0;

          line[ix] = 0;

          for (ix--; (ix >= 0) && (line[ix] != '('); ix--)
            ;

          sscanf(&line[ix+1],"%d",&starting_balance);

          if (bDebug)
            printf("line %d starting_balance = %d\n",line_no,starting_balance);

          if (bStartingStack && (hand_number == 1))
            starting_stack = starting_balance;

          continue;
        }
        else if (bSkipping)
          continue;
        else if (Contains(true,
          line,line_len,
          posts_the_ante,POSTS_THE_ANTE_LEN,
          &ix)) {
          ante = get_work_amount(line,line_len);
          spent_this_hand = ante;

          continue;
        }
        else if (Contains(true,
          line,line_len,
          posts,POSTS_LEN,
          &ix)) {
          work = get_work_amount(line,line_len);
          spent_this_street += work;

          if (bDebug) {
            printf("line %d street %d POSTS work = %d, spent_this_street = %d\n",
              line_no,street,work,spent_this_street);
          }

          continue;
        }
        else if (Contains(true,
          line,line_len,
          collected,COLLECTED_LEN,
          &ix)) {

          for (end_ix = ix + COLLECTED_LEN; end_ix < line_len; end_ix++) {
            if (line[end_ix] == ' ')
              break;
          }

          line[end_ix] = 0;
          sscanf(&line[ix + COLLECTED_LEN],"%d",&work);

          if (!collected_from_pot_count) {
            spent_this_hand += spent_this_street;
            street++;
            spent_this_street = 0;
          }

          collected_from_pot += work;
          collected_from_pot_count++;

          if (bDebug) {
            printf("line %d street %d COLLECTED work = %d, collected_from_pot = %d\n",
              line_no,street,work,collected_from_pot);
          }

          continue;
        }
        else if (!strncmp(line,uncalled_bet,UNCALLED_BET_LEN)) {
          sscanf(&line[UNCALLED_BET_LEN],"%d",&uncalled_bet_amount);
          spent_this_street -= uncalled_bet_amount;

          if (bDebug) {
            printf("line %d street %d UNCALLED uncalled_bet_amount = %d, spent_this_street = %d\n",
              line_no,street,uncalled_bet_amount,spent_this_street);
          }

          continue;
        }
        else if (Contains(true,
          line,line_len,
          folds,FOLDS_LEN,
          &ix)) {
          spent_this_hand += spent_this_street;

          if (bDebug) {
            printf("line %d street %d FOLDS spent_this_street = %d, spent_this_hand = %d\n",
              line_no,street,spent_this_street,spent_this_hand);
          }

          bSkipping = true;

          ending_balance = starting_balance - spent_this_hand + collected_from_pot;

          continue;
        }
        else if (Contains(true,
          line,line_len,
          bets,BETS_LEN,
          &ix)) {
          work = get_work_amount(line,line_len);
          spent_this_street += work;

          if (bDebug) {
            printf("line %d street %d BETS work = %d, spent_this_street = %d\n",
              line_no,street,work,spent_this_street);
          }
        }
        else if (Contains(true,
          line,line_len,
          calls,CALLS_LEN,
          &ix)) {
          work = get_work_amount(line,line_len);
          spent_this_street += work;

          if (bDebug) {
            printf("line %d street %d CALLS work = %d, spent_this_street = %d\n",
              line_no,street,work,spent_this_street);
          }
        }
        else if (Contains(true,
          line,line_len,
          raises,RAISES_LEN,
          &ix)) {
          work = get_work_amount(line,line_len);
          spent_this_street = work;

          if (bDebug) {
            printf("line %d street %d RAISES work = %d, spent_this_street = %d\n",
              line_no,street,work,spent_this_street);
          }
        }
        else if (bStud && Contains(true,
          line,line_len,
          brings_in_for,BRINGS_IN_FOR_LEN,
          &ix)) {
          bring_in = get_work_amount(line,line_len);
          spent_this_street += bring_in;
          continue;
        }
      }
      else if (bSkipping)
        continue;
      else {
        if (!strncmp(line,summary,SUMMARY_LEN)) {
          if (bDebug)
            printf("line %d SUMMARY line detected; skipping\n",line_no);

          bSkipping = true;

          ending_balance = starting_balance - spent_this_hand + collected_from_pot;

          if (!ending_balance) {
            hit_felt_count++;

            if (bMaxFeltDistance) {
              felt_distance = hand_number - last_felted_hand_number;

              if (felt_distance > max_felt_distance)
                max_felt_distance = felt_distance;

              last_felted_hand_number = hand_number;
            }
          }

          continue;
        }

        if (!strncmp(line,street_marker,STREET_MARKER_LEN)) {
          num_street_markers++;

          if (num_street_markers > 1) {
            if (street <= num_street_markers)
              spent_this_hand += spent_this_street;

            street++;
            spent_this_street = 0;
          }
        }
      }
    }

    if (bOneAndDone) {
      if ((hit_felt_count == 1) && (ending_balance == 0))
        printf("%s\n",filename);
    }
    else if (!bReverse) {
      if (bReupped && (reupped_count == 0))
        ;
      else if (bConsecutive) {
        consecutive_hit_felt_count += hit_felt_count;

        if (ending_balance && (consecutive_hit_felt_count > 0)) {
          printf(fmt,consecutive_hit_felt_count,date_string);
          consecutive_hit_felt_count = 0;
        }
      }
      else if ((bShowZero || hit_felt_count) && (!bExactCount || (hit_felt_count == exact_count))) {
        if (bCount)
          printf(fmt,hit_felt_count,date_string);
        else if (bStartingStack)
          printf(fmt,starting_stack,date_string);
        else {
          if (!bMaxFeltDistance)
            printf("%s\n",filename);
          else
            printf(fmt,max_felt_distance,date_string);
        }
      }
    }
    else {
      if (!hit_felt_count)
        printf("%s\n",filename);
    }

    fclose(fptr);
  }

  if (bConsecutive && (consecutive_hit_felt_count > 0))
    printf(fmt,consecutive_hit_felt_count,prev_filename);

  fclose(fptr0);

  return 0;
}
Exemplo n.º 4
0
int main(int argc,char **argv)
{
  int curr_arg;
  bool bDebug;
  bool bVerbose;
  int player_name_ix;
  int player_name_len;
  FILE *fptr0;
  int filename_len;
  FILE *fptr;
  int line_len;
  int line_no;
  int retval;
  char *date_string;
  int ix;
  int street;
  int num_street_markers;
  int starting_balance;
  int spent_this_street;
  int spent_this_hand;
  int end_ix;
  int wagered_amount;
  int uncalled_bet_amount;
  int collected_from_pot;
  int collected_from_pot_count;
  int ending_balance;
  int delta;
  int file_no;
  int dbg_file_no;
  int dbg;
  int work;
  int total_wagered;

  if ((argc < 3) || (argc > 5)) {
    printf(usage);
    return 1;
  }

  bDebug = false;
  bVerbose = false;

  for (curr_arg = 1; curr_arg < argc; curr_arg++) {
    if (!strcmp(argv[curr_arg],"-debug"))
      bDebug = true;
    else if (!strcmp(argv[curr_arg],"-verbose"))
      bVerbose = true;
    else
      break;
  }

  if (argc - curr_arg != 2) {
    printf(usage);
    return 2;
  }

  player_name_ix = curr_arg++;
  player_name_len = strlen(argv[player_name_ix]);

  if ((fptr0 = fopen(argv[curr_arg],"r")) == NULL) {
    printf(couldnt_open,argv[curr_arg]);
    return 3;
  }

  if (!bVerbose && bDebug) {
    getcwd(save_dir,_MAX_PATH);
    retval = get_date_from_path(save_dir,'/',2,&date_string);

    if (retval) {
      printf("get_date_from_path() on %s failed: %d\n",save_dir,retval);
      return 4;
    }
  }

  ending_balance = -1;

  file_no = 0;
  dbg_file_no = -1;

  if (!bVerbose)
    total_wagered = 0;

  for ( ; ; ) {
    GetLine(fptr0,filename,&filename_len,MAX_FILENAME_LEN);

    if (feof(fptr0))
      break;

    file_no++;

    if (dbg_file_no == file_no)
      dbg = 1;

    if ((fptr = fopen(filename,"r")) == NULL) {
      printf(couldnt_open,filename);
      continue;
    }

    line_no = 0;
    street = 0;
    num_street_markers = 0;
    spent_this_street = 0;
    spent_this_hand = 0;
    uncalled_bet_amount = 0;
    collected_from_pot = 0;
    collected_from_pot_count = 0;

    for ( ; ; ) {
      GetLine(fptr,line,&line_len,MAX_LINE_LEN);

      if (feof(fptr))
        break;

      line_no++;

      if (Contains(true,
        line,line_len,
        argv[player_name_ix],player_name_len,
        &ix)) {

        if (Contains(true,
          line,line_len,
          in_chips,IN_CHIPS_LEN,
          &ix)) {

          line[ix] = 0;

          for (ix--; (ix >= 0) && (line[ix] != '('); ix--)
            ;

          sscanf(&line[ix+1],"%d",&starting_balance);

          continue;
        }
        else if (Contains(true,
          line,line_len,
          posts,POSTS_LEN,
          &ix)) {
          spent_this_street += get_work_amount(line,line_len);
          continue;
        }
        else if (!strncmp(line,dealt_to,DEALT_TO_LEN))
          continue;
        else if (Contains(true,
          line,line_len,
          collected,COLLECTED_LEN,
          &ix)) {

          for (end_ix = ix + COLLECTED_LEN; end_ix < line_len; end_ix++) {
            if (line[end_ix] == ' ')
              break;
          }

          line[end_ix] = 0;
          sscanf(&line[ix + COLLECTED_LEN],"%d",&work);

          if (!collected_from_pot_count) {
            spent_this_hand += spent_this_street;
            street++;
            spent_this_street = 0;
          }

          collected_from_pot += work;
          collected_from_pot_count++;

          continue;
        }
        else if (!strncmp(line,uncalled_bet,UNCALLED_BET_LEN)) {
          sscanf(&line[UNCALLED_BET_LEN],"%d",&uncalled_bet_amount);
          spent_this_street -= uncalled_bet_amount;
          continue;
        }
        else if (Contains(true,
          line,line_len,
          folds,FOLDS_LEN,
          &ix)) {
          spent_this_hand += spent_this_street;
          break;
        }
        else if (Contains(true,
          line,line_len,
          bets,BETS_LEN,
          &ix)) {
          spent_this_street += get_work_amount(line,line_len);
        }
        else if (Contains(true,
          line,line_len,
          calls,CALLS_LEN,
          &ix)) {
          spent_this_street += get_work_amount(line,line_len);
        }
        else if (Contains(true,
          line,line_len,
          raises,RAISES_LEN,
          &ix)) {
          spent_this_street = get_work_amount(line,line_len);
        }
      }
      else {
        if (!strcmp(line,summary))
          break;

        if (!strncmp(line,street_marker,STREET_MARKER_LEN)) {
          num_street_markers++;

          if (num_street_markers > 1) {
            if (street <= 3)
              spent_this_hand += spent_this_street;

            street++;
            spent_this_street = 0;
          }
        }
      }
    }

    fclose(fptr);

    ending_balance = starting_balance - spent_this_hand + collected_from_pot;
    delta = ending_balance - starting_balance;

    wagered_amount = spent_this_hand + uncalled_bet_amount;

    if (!bVerbose)
      total_wagered += wagered_amount;
    else {
      if (!bDebug)
        printf("%d\n",wagered_amount);
      else
        printf("%10d %s\n",wagered_amount,filename);
    }
  }

  fclose(fptr0);

  if (!bVerbose) {
    if (!bDebug)
      printf("%d\n",total_wagered);
    else
      printf("%10d %s\n",total_wagered,date_string);
  }

  return 0;
}
int main(int argc,char **argv)
{
  int m;
  int n;
  int p;
  int curr_arg;
  bool bTerse;
  bool bVerbose;
  bool bDebug;
  bool bIncludeZeroes;
  int player_name_ix;
  int player_name_len;
  FILE *fptr0;
  int filename_len;
  FILE *fptr;
  int line_len;
  int line_no;
  int dbg_line_no;
  int ix;
  int street;
  int num_street_markers;
  int starting_balance;
  int spent_this_street;
  int spent_this_hand;
  int end_ix;
  int uncalled_bet_amount;
  int collected_from_pot;
  int collected_from_pot_count;
  int ending_balance;
  int delta;
  int file_no;
  int dbg_file_no;
  int num_hands;
  int dbg;
  int work;
  int num_finished;
  int num_eliminations;

  if ((argc < 3) || (argc > 7)) {
    printf(usage);
    return 1;
  }

  bTerse = false;
  bVerbose = false;
  bDebug = false;
  bIncludeZeroes = false;

  for (curr_arg = 1; curr_arg < argc; curr_arg++) {
    if (!strcmp(argv[curr_arg],"-terse"))
      bTerse = true;
    else if (!strcmp(argv[curr_arg],"-verbose")) {
      bVerbose = true;
      getcwd(save_dir,_MAX_PATH);
    }
    else if (!strcmp(argv[curr_arg],"-debug"))
      bDebug = true;
    else if (!strcmp(argv[curr_arg],"-include_zeroes"))
      bIncludeZeroes = true;
    else
      break;
  }

  if (argc - curr_arg != 2) {
    printf(usage);
    return 2;
  }

  if (bTerse && bVerbose) {
    printf("can't specify both -terse and -verbose\n");
    return 3;
  }

  player_name_ix = curr_arg++;
  player_name_len = strlen(argv[player_name_ix]);

  if ((fptr0 = fopen(argv[curr_arg],"r")) == NULL) {
    printf(couldnt_open,argv[curr_arg]);
    return 5;
  }

  ending_balance = -1;

  file_no = 0;
  dbg_file_no = -1;
  num_hands = 0;
  num_eliminations = 0;

  for ( ; ; ) {
    GetLine(fptr0,filename,&filename_len,MAX_FILENAME_LEN);

    if (feof(fptr0))
      break;

    file_no++;

    if (dbg_file_no == file_no)
      dbg = 1;

    if ((fptr = fopen(filename,"r")) == NULL) {
      printf(couldnt_open,filename);
      continue;
    }

    num_hands++;

    line_no = 0;
    street = 0;
    num_street_markers = 0;
    spent_this_street = 0;
    spent_this_hand = 0;
    uncalled_bet_amount = 0;
    collected_from_pot = 0;
    collected_from_pot_count = 0;
    num_finished = 0;

    for ( ; ; ) {
      GetLine(fptr,line,&line_len,MAX_LINE_LEN);

      if (feof(fptr))
        break;

      line_no++;

      if (line_no == dbg_line_no)
        dbg = 1;

      if (bDebug)
        printf("line %d %s\n",line_no,line);

      if (Contains(true,
        line,line_len,
        argv[player_name_ix],player_name_len,
        &ix)) {

        if (Contains(true,
          line,line_len,
          in_chips,IN_CHIPS_LEN,
          &ix)) {

          line[ix] = 0;

          for (ix--; (ix >= 0) && (line[ix] != '('); ix--)
            ;

          sscanf(&line[ix+1],"%d",&starting_balance);

          if (bDebug)
            printf("line %d starting_balance = %d\n",line_no,starting_balance);

          continue;
        }
        else if (Contains(true,
          line,line_len,
          posts,POSTS_LEN,
          &ix)) {
          work = get_work_amount(line,line_len);
          spent_this_street += work;

          if (bDebug) {
            printf("line %d street %d POSTS work = %d, spent_this_street = %d\n",
              line_no,street,work,spent_this_street);
          }

          continue;
        }
        else if (Contains(true,
          line,line_len,
          collected,COLLECTED_LEN,
          &ix)) {

          for (end_ix = ix + COLLECTED_LEN; end_ix < line_len; end_ix++) {
            if (line[end_ix] == ' ')
              break;
          }

          line[end_ix] = 0;
          sscanf(&line[ix + COLLECTED_LEN],"%d",&work);

          if (!collected_from_pot_count) {
            spent_this_hand += spent_this_street;
            street++;
            spent_this_street = 0;
          }

          collected_from_pot += work;
          collected_from_pot_count++;

          if (bDebug) {
            printf("line %d street %d COLLECTED work = %d, collected_from_pot = %d\n",
              line_no,street,work,collected_from_pot);
          }

          continue;
        }
        else if (!strncmp(line,uncalled_bet,UNCALLED_BET_LEN)) {
          sscanf(&line[UNCALLED_BET_LEN],"%d",&uncalled_bet_amount);
          spent_this_street -= uncalled_bet_amount;

          if (bDebug) {
            printf("line %d street %d UNCALLED uncalled_bet_amount = %d, spent_this_street = %d\n",
              line_no,street,uncalled_bet_amount,spent_this_street);
          }

          continue;
        }
        else if (Contains(true,
          line,line_len,
          folds,FOLDS_LEN,
          &ix)) {
          spent_this_hand += spent_this_street;

          if (bDebug) {
            printf("line %d street %d FOLDS spent_this_street = %d, spent_this_hand = %d\n",
              line_no,street,spent_this_street,spent_this_hand);
          }

          break;
        }
        else if (Contains(true,
          line,line_len,
          bets,BETS_LEN,
          &ix)) {
          work = get_work_amount(line,line_len);
          spent_this_street += work;

          if (bDebug) {
            printf("line %d street %d BETS work = %d, spent_this_street = %d\n",
              line_no,street,work,spent_this_street);
          }
        }
        else if (Contains(true,
          line,line_len,
          calls,CALLS_LEN,
          &ix)) {
          work = get_work_amount(line,line_len);
          spent_this_street += work;

          if (bDebug) {
            printf("line %d street %d CALLS work = %d, spent_this_street = %d\n",
              line_no,street,work,spent_this_street);
          }
        }
        else if (Contains(true,
          line,line_len,
          raises,RAISES_LEN,
          &ix)) {
          work = get_work_amount(line,line_len);
          spent_this_street = work;

          if (bDebug) {
            printf("line %d street %d RAISES work = %d, spent_this_street = %d\n",
              line_no,street,work,spent_this_street);
          }
        }
      }
      else {
        if (Contains(true,
          line,line_len,
          finished_the_tournament,FINISHED_THE_TOURNAMENT_LEN,
          &ix)) {
          num_finished++;
        }
        else if (!strncmp(line,summary,SUMMARY_LEN)) {
          if (bDebug)
            printf("line %d SUMMARY line detected; breaking\n",line_no);

          break;
        }

        if (!strncmp(line,street_marker,STREET_MARKER_LEN)) {
          num_street_markers++;

          if (num_street_markers > 1) {
            if (street <= 3)
              spent_this_hand += spent_this_street;

            street++;
            spent_this_street = 0;
          }
        }
      }
    }

    fclose(fptr);

    ending_balance = starting_balance - spent_this_hand + collected_from_pot;
    delta = ending_balance - starting_balance;

    if (delta > 0) {
      num_eliminations += num_finished;
    }
  }

  fclose(fptr0);

  if (!bVerbose) {
    if (bIncludeZeroes || num_eliminations)
      printf("%d\n",num_eliminations);
  }
  else {
    if (bIncludeZeroes || num_eliminations)
      printf("%d %s\n",num_eliminations,save_dir);
  }

  return 0;
}
Exemplo n.º 6
0
int main(int argc,char **argv)
{
  int player_name_ix;
  int player_name_len;
  FILE *fptr0;
  int filename_len;
  FILE *fptr;
  int line_len;
  int line_no;
  int ix;
  int street;
  int num_street_markers;
  int starting_balance;
  int spent_this_street;
  int spent_this_hand;
  int end_ix;
  int wagered_amount;
  int uncalled_bet_amount;
  int collected_from_pot;
  int collected_from_pot_count;
  int ending_balance;
  int delta;
  int file_no;
  int dbg_file_no;
  int dbg;
  int work;
  double dwork;

  if (argc != 3) {
    printf(usage);
    return 1;
  }

  player_name_ix = 1;
  player_name_len = strlen(argv[player_name_ix]);

  if ((fptr0 = fopen(argv[2],"r")) == NULL) {
    printf(couldnt_open,argv[2]);
    return 2;
  }

  getcwd(save_dir,_MAX_PATH);

  file_no = 0;
  dbg_file_no = -1;

  for ( ; ; ) {
    GetLine(fptr0,filename,&filename_len,MAX_FILENAME_LEN);

    if (feof(fptr0))
      break;

    file_no++;

    if (dbg_file_no == file_no)
      dbg = 1;

    if ((fptr = fopen(filename,"r")) == NULL) {
      printf(couldnt_open,filename);
      continue;
    }

    line_no = 0;
    street = 0;
    num_street_markers = 0;
    spent_this_street = 0;
    spent_this_hand = 0;
    uncalled_bet_amount = 0;
    collected_from_pot = 0;
    collected_from_pot_count = 0;

    for ( ; ; ) {
      GetLine(fptr,line,&line_len,MAX_LINE_LEN);

      if (feof(fptr))
        break;

      line_no++;

      if (Contains(true,
        line,line_len,
        argv[player_name_ix],player_name_len,
        &ix)) {

        if (Contains(true,
          line,line_len,
          in_chips,IN_CHIPS_LEN,
          &ix)) {

          line[ix] = 0;

          for (ix--; (ix >= 0) && (line[ix] != '('); ix--)
            ;

          sscanf(&line[ix+1],"%d",&starting_balance);

          continue;
        }
        else if (Contains(true,
          line,line_len,
          posts,POSTS_LEN,
          &ix)) {
          spent_this_street += get_work_amount(line,line_len);
          continue;
        }
        else if (!strncmp(line,dealt_to,DEALT_TO_LEN))
          continue;
        else if (Contains(true,
          line,line_len,
          collected,COLLECTED_LEN,
          &ix)) {

          for (end_ix = ix + COLLECTED_LEN; end_ix < line_len; end_ix++) {
            if (line[end_ix] == ' ')
              break;
          }

          line[end_ix] = 0;
          sscanf(&line[ix + COLLECTED_LEN],"%d",&work);

          if (!collected_from_pot_count) {
            spent_this_hand += spent_this_street;
            street++;
            spent_this_street = 0;
          }

          collected_from_pot += work;
          collected_from_pot_count++;

          continue;
        }
        else if (!strncmp(line,uncalled_bet,UNCALLED_BET_LEN)) {
          sscanf(&line[UNCALLED_BET_LEN],"%d",&uncalled_bet_amount);
          spent_this_street -= uncalled_bet_amount;
          continue;
        }
        else if (Contains(true,
          line,line_len,
          folds,FOLDS_LEN,
          &ix)) {
          spent_this_hand += spent_this_street;
          break;
        }
        else if (Contains(true,
          line,line_len,
          bets,BETS_LEN,
          &ix)) {
          spent_this_street += get_work_amount(line,line_len);
        }
        else if (Contains(true,
          line,line_len,
          calls,CALLS_LEN,
          &ix)) {
          spent_this_street += get_work_amount(line,line_len);
        }
        else if (Contains(true,
          line,line_len,
          raises,RAISES_LEN,
          &ix)) {
          spent_this_street = get_work_amount(line,line_len);
        }
      }
      else {
        if (!strncmp(line,summary,SUMMARY_LEN))
          break;

        if (!strncmp(line,street_marker,STREET_MARKER_LEN)) {
          num_street_markers++;

          if (num_street_markers > 1) {
            if (street <= 3)
              spent_this_hand += spent_this_street;

            street++;
            spent_this_street = 0;
          }
        }
      }
    }

    fclose(fptr);

    ending_balance = starting_balance - spent_this_hand + collected_from_pot;
    delta = ending_balance - starting_balance;

    if (collected_from_pot && (delta > 0)) {
      dwork = (double)ending_balance / (double)starting_balance;
      printf("%10.4lf %s/%s\n",dwork,save_dir,filename);
    }
  }

  return 0;
}
Exemplo n.º 7
0
int main(int argc,char **argv)
{
  int m;
  int n;
  int p;
  int curr_arg;
  bool bDebug;
  int player_name_ix;
  int player_name_len;
  FILE *fptr0;
  int filename_len;
  FILE *fptr;
  int line_len;
  int line_no;
  int ix;
  int street;
  int num_street_markers;
  int starting_balance;
  int spent_this_street;
  int spent_this_hand;
  int end_ix;
  int uncalled_bet_amount;
  int ending_balance;
  int file_no;
  int dbg_file_no;
  int dbg;
  int work;
  char hole_cards[6];

  if ((argc < 3) || (argc > 8)) {
    printf(usage);
    return 1;
  }

  bDebug = false;

  for (curr_arg = 1; curr_arg < argc; curr_arg++) {
    if (!strcmp(argv[curr_arg],"-debug")) {
      bDebug = true;
      getcwd(save_dir,_MAX_PATH);
    }
    else
      break;
  }

  if (argc - curr_arg != 2) {
    printf(usage);
    return 2;
  }

  player_name_ix = curr_arg++;
  player_name_len = strlen(argv[player_name_ix]);

  if ((fptr0 = fopen(argv[curr_arg],"r")) == NULL) {
    printf(couldnt_open,argv[curr_arg]);
    return 3;
  }

  ending_balance = -1;

  file_no = 0;
  dbg_file_no = -1;

  hole_cards[5] = 0;

  for ( ; ; ) {
    GetLine(fptr0,filename,&filename_len,MAX_FILENAME_LEN);

    if (feof(fptr0))
      break;

    file_no++;

    if (dbg_file_no == file_no)
      dbg = 1;

    if ((fptr = fopen(filename,"r")) == NULL) {
      printf(couldnt_open,filename);
      continue;
    }

    line_no = 0;
    street = 0;
    num_street_markers = 0;
    spent_this_street = 0;
    spent_this_hand = 0;
    uncalled_bet_amount = 0;

    for ( ; ; ) {
      GetLine(fptr,line,&line_len,MAX_LINE_LEN);

      if (feof(fptr))
        break;

      line_no++;

      if (Contains(true,
        line,line_len,
        argv[player_name_ix],player_name_len,
        &ix)) {

        if (Contains(true,
          line,line_len,
          in_chips,IN_CHIPS_LEN,
          &ix)) {

          line[ix] = 0;

          for (ix--; (ix >= 0) && (line[ix] != '('); ix--)
            ;

          sscanf(&line[ix+1],"%d",&starting_balance);

          continue;
        }
        else if (Contains(true,
          line,line_len,
          posts,POSTS_LEN,
          &ix)) {
          spent_this_street += get_work_amount(line,line_len);
          continue;
        }
        else if (!strncmp(line,dealt_to,DEALT_TO_LEN)) {
          for (n = 0; n < line_len; n++) {
            if (line[n] == '[')
              break;
          }

          if (n < line_len) {
            n++;

            for (m = n; m < line_len; m++) {
              if (line[m] == ']')
                break;
            }

            if (m < line_len) {
              for (p = 0; p < 5; p++)
                hole_cards[p] = line[n+p];
            }
          }
        }
        else if (!strncmp(line,uncalled_bet,UNCALLED_BET_LEN)) {
          sscanf(&line[UNCALLED_BET_LEN],"%d",&uncalled_bet_amount);
          spent_this_street -= uncalled_bet_amount;
          continue;
        }
        else if (Contains(true,
          line,line_len,
          folds,FOLDS_LEN,
          &ix)) {
          spent_this_hand += spent_this_street;
          break;
        }
        else if (Contains(true,
          line,line_len,
          bets,BETS_LEN,
          &ix)) {
          spent_this_street += get_work_amount(line,line_len);
        }
        else if (Contains(true,
          line,line_len,
          calls,CALLS_LEN,
          &ix)) {
          spent_this_street += get_work_amount(line,line_len);
        }
        else if (Contains(true,
          line,line_len,
          raises,RAISES_LEN,
          &ix)) {
          spent_this_street = get_work_amount(line,line_len);
        }
      }
      else {
        if (!strncmp(line,summary,SUMMARY_LEN))
          break;

        if (!strncmp(line,street_marker,STREET_MARKER_LEN)) {
          num_street_markers++;

          if (num_street_markers > 1) {
            if (street <= 3)
              spent_this_hand += spent_this_street;

            street++;
            spent_this_street = 0;
          }
        }
      }
    }

    fclose(fptr);

    if (!bDebug)
      printf("%d\n",spent_this_hand);
    else
      printf("%10d %s %s\\%s\n",
        spent_this_hand,hole_cards,save_dir,filename);
  }

  fclose(fptr0);

  return 0;
}