The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm6 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm6 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm6 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I need a more efficient function
Author Message
infinitynotpi
Apprentice
*

Posts: 5
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Sep 2012
Reputation: 0



Post: #9
RE: I need a more efficient function
This is me holding a flower...(see Venn diagram)

Wolfram Alpha

And this is me just showing my ass...

First Function of 2 Boolean Variables

And this is me just being a friend...

I've included some C for you!

Which includes the fast algorithm you're looking for in it -- Monte Carlo

133,784,560 combinations

Snippet here

Code:
/*
* returns number of dead cards, -1 on error
*
* argc, argv are the standard arguments to main
* num_dead is a return value of the number of dead cards
* dead_cards is a return value of the dead cards
*/
static int
parse_args(int argc, char **argv, int *num_dead, CardMask *dead_cards) {
  int i, c, o, rc, len;

  if (num_dead == NULL) {
    return (-1);
  }

  if (dead_cards == NULL) {
    return (-1);
  }

  *num_dead = 0;
  CardMask_RESET(*dead_cards);

  /*
   * parse any options passed to us.
   * -d "c1 [...]" is dead cards
   */
  while((o = getopt(argc, argv, opts)) != -1) {
    switch(o) {
    case 'd':
      len = strlen(optarg);
      for(i = 0;i < len;) {
    rc = StdDeck_stringToCard(optarg+i, &c);
    if (rc) {
      StdDeck_CardMask_SET(*dead_cards, c);
      (*num_dead)++;
      i += 2;
    } else {
      i++;
    }
      }
      break;
    }
  }

  return (*num_dead);
}
[/code]

The Count of Monte Cristo


Attached File(s)
.zip  poker-eval-138.0.zip (Size: 554.35 KB / Downloads: 9)
(This post was last modified: 09-16-2012 10:48 PM by infinitynotpi.)
09-16-2012 10:03 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Messages In This Thread
RE: I need a more efficient function - infinitynotpi - 09-16-2012 10:03 PM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)