Skip to content

Instantly share code, notes, and snippets.

Created December 27, 2012 11:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4387720 to your computer and use it in GitHub Desktop.
Save anonymous/4387720 to your computer and use it in GitHub Desktop.
public unsafe long[] EvalRandom(int instance)
{
fixed (int* HR = he.HR)
{
int p;
if (Hands == null || Hands.Length == 0)
throw new InvalidOperationException("No hands to evaluate");
for (int i = instance; i < Hands.Length; i += Instances)
{
p = HR[53 + Hands[i][0] + 1];
p = HR[p + Hands[i][1] + 1];
p = HR[p + Hands[i][2] + 1];
p = HR[p + Hands[i][3] + 1];
p = HR[p + Hands[i][4] + 1];
p = HR[p + Hands[i][5] + 1];
handTypeSum[(HR[p + Hands[i][6]+1] >> 24)]++;
}
return handTypeSum;
}
}
@spetroll
Copy link

//Parallelization

Parallel.For(0, Environment.ProcessorCount, i => { handTypeSum[i] = func.Invoke().EvalRandom(i); });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment