示例#1
0
static int
autohelperread_attack12(int trans, int move, int color, int action)
{
  int a, B;
  UNUSED(color);
  UNUSED(action);

  a = AFFINE_TRANSFORM(683, trans, move);
  B = AFFINE_TRANSFORM(646, trans, move);

  return  0 && rgoal[B] == 2 && countlib(a) <= 2 && countlib(B) <= goallib && (is_ko_point(move) || accuratelib(move, color, MAX_LIBERTIES, NULL) > 1);
}
示例#2
0
static int
autohelperread_attack21(int trans, int move, int color, int action)
{
  int a, b;
  UNUSED(color);
  UNUSED(action);

  a = AFFINE_TRANSFORM(648, trans, move);
  b = AFFINE_TRANSFORM(685, trans, move);

  return  goallib < countlib(a) && countlib(a) <=3 && accuratelib(move, color, MAX_LIBERTIES, NULL) >= 2 && accuratelib(b, OTHER_COLOR(color), MAX_LIBERTIES, NULL) <= 4;
}
示例#3
0
static int
autohelperread_attack19(int trans, int move, int color, int action)
{
  int a, b;
  UNUSED(color);
  UNUSED(action);

  a = AFFINE_TRANSFORM(722, trans, move);
  b = AFFINE_TRANSFORM(721, trans, move);

  return  rgoal[a] == 3 && accuratelib(b, color, MAX_LIBERTIES, NULL) <= 1  && accuratelib(move, color, MAX_LIBERTIES, NULL) > 2;
}
示例#4
0
static int
autohelperread_attack5(int trans, int move, int color, int action)
{
  int a, b;
  UNUSED(color);
  UNUSED(action);

  a = AFFINE_TRANSFORM(647, trans, move);
  b = AFFINE_TRANSFORM(685, trans, move);

  return  0 && rgoal[a] == 1 && accuratelib(b, OTHER_COLOR(color), MAX_LIBERTIES, NULL) <= 2 && accuratelib(move, color, MAX_LIBERTIES, NULL) > 1;
}
示例#5
0
static int
autohelperread_attack22(int trans, int move, int color, int action)
{
  int b, A;
  UNUSED(color);
  UNUSED(action);

  b = AFFINE_TRANSFORM(685, trans, move);
  A = AFFINE_TRANSFORM(721, trans, move);

  return countlib(A) <= 3 && accuratelib(b, color, MAX_LIBERTIES, NULL) <= 3 && accuratelib(move, OTHER_COLOR(color), MAX_LIBERTIES, NULL) > 2;
}
示例#6
0
static int
autohelperdefpat1(int trans, int move, int color, int action)
{
  int a, b;
  UNUSED(color);
  UNUSED(action);

  a = AFFINE_TRANSFORM(610, trans, move);
  b = AFFINE_TRANSFORM(685, trans, move);

  return ATTACK_MACRO(a) && play_attack_defend_n(color, 0, 2, move, b, a);
}
示例#7
0
static int
autohelperread_attack10(int trans, int move, int color, int action)
{
  int a, B;
  UNUSED(color);
  UNUSED(action);

  a = AFFINE_TRANSFORM(646, trans, move);
  B = AFFINE_TRANSFORM(647, trans, move);

  return rgoal[a] == 1 && countlib(B) == 2 && accuratelib(move, color, MAX_LIBERTIES, NULL) >= 2 && accuratelib(move, OTHER_COLOR(color), MAX_LIBERTIES, NULL) >= 2&& ((goallib == 3 && stackp <= backfill2_depth)    || (goallib == 2 && stackp <= backfill_depth));
}
示例#8
0
static int
autohelperread_attack17(int trans, int move, int color, int action)
{
  int a, b;
  UNUSED(color);
  UNUSED(action);

  a = AFFINE_TRANSFORM(720, trans, move);
  b = AFFINE_TRANSFORM(757, trans, move);

  return  countlib(b) < goallib && countlib(a) == countlib(b) && accuratelib(move, color, MAX_LIBERTIES, NULL) >= countlib(b);
}
示例#9
0
static int
autohelperdefpat31(int trans, int move, int color, int action)
{
  int a, b, C;
  UNUSED(color);
  UNUSED(action);

  a = AFFINE_TRANSFORM(610, trans, move);
  b = AFFINE_TRANSFORM(648, trans, move);
  C = AFFINE_TRANSFORM(647, trans, move);

  return countlib(a)>1 && countlib(b)>1 && countlib(C)<=2 && accuratelib(move, color, MAX_LIBERTIES, NULL)>1;
}
示例#10
0
static int
autohelperread_attack14(int trans, int move, int color, int action)
{
  int a, c, B;
  UNUSED(color);
  UNUSED(action);

  a = AFFINE_TRANSFORM(609, trans, move);
  c = AFFINE_TRANSFORM(646, trans, move);
  B = AFFINE_TRANSFORM(683, trans, move);

  return  rgoal[a] == 1 && countlib(a) >= accuratelib(c, color, MAX_LIBERTIES, NULL) && accuratelib(move, color, MAX_LIBERTIES, NULL) > countlib(B);
}
示例#11
0
static int
autohelperread_attack24(int trans, int move, int color, int action)
{
  int a, b;
  UNUSED(color);

  a = AFFINE_TRANSFORM(646, trans, move);
  b = AFFINE_TRANSFORM(683, trans, move);

  if (!action)
    return  rgoal[a] == 1;
   if (accuratelib(b, color, MAX_LIBERTIES, NULL) <= 1)   ((read_attack + 24)->value) = 49; else   ((read_attack + 24)->value) = 0;;

  return 0;
}
示例#12
0
static int
autohelperread_attack4(int trans, int move, int color, int action)
{
  int a, b;
  UNUSED(color);

  a = AFFINE_TRANSFORM(647, trans, move);
  b = AFFINE_TRANSFORM(685, trans, move);

  if (!action)
    return  rgoal[a] == 1 && accuratelib(b, OTHER_COLOR(color), MAX_LIBERTIES, NULL)==1;
   if (goallib == 2)   ((read_attack + 4)->value) = 71; else   ((read_attack + 4)->value) = 55;;

  return 0;
}
示例#13
0
static int
autohelperread_attack6(int trans, int move, int color, int action)
{
  int a, b;
  UNUSED(color);

  a = AFFINE_TRANSFORM(683, trans, move);
  b = AFFINE_TRANSFORM(720, trans, move);

  if (!action)
    return  countlib(a) == 1  && countlib(b) <=2;
   if (goallib <= countlib(b))   ((read_attack + 6)->value) = 10; else if (!is_ko_point(move))   ((read_attack + 6)->value) = 73; else   ((read_attack + 6)->value) = 10;;

  return 0;
}
示例#14
0
static int
autohelperread_attack7(int trans, int move, int color, int action)
{
  int a, b;
  UNUSED(color);

  a = AFFINE_TRANSFORM(721, trans, move);
  b = AFFINE_TRANSFORM(758, trans, move);

  if (!action)
    return  countlib(a) == 1  && countlib(b) <=2;
   if (is_ko_point(move))   ((read_attack + 7)->value) = 10; if (countlib(b) >= goallib)   ((read_attack + 7)->value) = 60; else if (countlib(b) == 1)   ((read_attack + 7)->value) = 76; else   ((read_attack + 7)->value) = 72;;

  return 0;
}
示例#15
0
static int
autohelperread_attack0(int trans, int move, int color, int action)
{
  int a;
  UNUSED(color);
  UNUSED(action);

  a = AFFINE_TRANSFORM(720, trans, move);

  return  rgoal[a] == 1 &&  countlib(a) == 3;
}
示例#16
0
static int
autohelperdefpat10(int trans, int move, int color, int action)
{
  int a;
  UNUSED(color);
  UNUSED(action);

  a = AFFINE_TRANSFORM(718, trans, move);

  return countlib(a)>2;
}
示例#17
0
static int
autohelperread_attack2(int trans, int move, int color, int action)
{
  int a;
  UNUSED(color);
  UNUSED(action);

  a = AFFINE_TRANSFORM(647, trans, move);

  return  rgoal[a] == 1 && accuratelib(move, color, MAX_LIBERTIES, NULL) == 1;
}
示例#18
0
static int
autohelperread_attack25(int trans, int move, int color, int action)
{
  int a;
  UNUSED(color);
  UNUSED(action);

  a = AFFINE_TRANSFORM(646, trans, move);

  return  rgoal[a] == 1;
}
示例#19
0
static int
autohelperread_attack18(int trans, int move, int color, int action)
{
  int a;
  UNUSED(color);
  UNUSED(action);

  a = AFFINE_TRANSFORM(721, trans, move);

  return countlib(a) == 2 && accuratelib(move, color, MAX_LIBERTIES, NULL) > 1;
}
示例#20
0
static int
autohelperread_attack9(int trans, int move, int color, int action)
{
  int a;
  UNUSED(color);
  UNUSED(action);

  a = AFFINE_TRANSFORM(610, trans, move);

  return accuratelib(a, color, MAX_LIBERTIES, NULL) == 1;
}
示例#21
0
static void
free_handicap_callback(int anchor, int color, struct pattern *pattern,
		       int ll, void *data)
{
  int r = -1;
  int k;
  int number_of_stones = 1;

  /* Pick up the location of the move */
  int move = AFFINE_TRANSFORM(pattern->move_offset, ll, anchor);

  UNUSED(data);

  /* Check how many stones are placed by the pattern. This must not be
   * larger than the number of remaining handicap stones.
   */
  for (k = 0; k < pattern->patlen; k++) { 
    if (pattern->patn[k].att == ATT_not)
      number_of_stones++;
  }
  if (number_of_stones > remaining_handicap_stones)
    return;

  /* If the pattern has a constraint, call the autohelper to see
   * if the pattern must be rejected.
   */
  if (pattern->autohelper_flag & HAVE_CONSTRAINT) {
    if (!pattern->autohelper(ll, move, color, 0))
      return;
  }
  
  if (number_of_matches < MAX_HANDICAP_MATCHES) {
    r = number_of_matches;
    number_of_matches++;
  }
  else {
    int least_value = handicap_matches[0].value + 1;
    for (k = 0; k < number_of_matches; k++) {
      if (handicap_matches[k].value < least_value) {
	r = k;
	least_value = handicap_matches[k].value;
      }
    }
  }
  gg_assert(r >= 0 && r < MAX_HANDICAP_MATCHES);
  handicap_matches[r].value   = pattern->value;
  handicap_matches[r].anchor  = anchor;
  handicap_matches[r].pattern = pattern;
  handicap_matches[r].ll      = ll;
}
示例#22
0
static int
autohelperread_attack20(int trans, int move, int color, int action)
{
  int a;
  UNUSED(color);

  a = AFFINE_TRANSFORM(721, trans, move);

  if (!action)
    return  (countlib(a) <= 3 && accuratelib(move, color, MAX_LIBERTIES, NULL) >= 2);
   if (countlib(a) == 2)   ((read_attack + 20)->value) = 49; else if (countlib(a) == 1 && countstones(a) > 1)   ((read_attack + 20)->value) = 79; else if (countlib(a) == 1)   ((read_attack + 20)->value) = 48; else if (stackp <= backfill_depth          && stackp <= superstring_depth /* || !atari_possible*/)   ((read_attack + 20)->value) = 12; else   ((read_attack + 20)->value) = 0;;

  return 0;
}
示例#23
0
static int
autohelperread_attack1(int trans, int move, int color, int action)
{
  int a;
  UNUSED(color);

  a = AFFINE_TRANSFORM(647, trans, move);

  if (!action)
    return  rgoal[a] == 1;
   { int ostar = accuratelib(move, color, MAX_LIBERTIES, NULL); int xstar = accuratelib(move, OTHER_COLOR(color), MAX_LIBERTIES, NULL); if (countlib(a) == 2 && ostar > 1 && xstar >=4)   ((read_attack + 1)->value) = 80; else if (countlib(a) == 2 && ostar > 1 && xstar > 2)   ((read_attack + 1)->value) = 72; else if (countlib(a) == 2 && ostar > 1)   ((read_attack + 1)->value) = 70; else if ((countlib(a) == 1 || xstar > countlib(a)+4))   ((read_attack + 1)->value) = 97; else if (xstar > countlib(a)+3 && ostar > 1)   ((read_attack + 1)->value) = 96; else if (xstar > countlib(a)+2 && ostar > 1)   ((read_attack + 1)->value) = 95; else if (xstar > countlib(a)+1 && ostar > 2)   ((read_attack + 1)->value) = 64; else if (xstar > countlib(a)+1 && ostar > 1)   ((read_attack + 1)->value) = 63; else if (xstar > countlib(a)+1  && ostar > 1)   ((read_attack + 1)->value) = 62; else if (xstar > countlib(a) && ostar > 2)   ((read_attack + 1)->value) = 61; else if (xstar > countlib(a) && ostar > 1)   ((read_attack + 1)->value) = 60; else if (xstar == countlib(a)	   && ostar > 1          && (ostar == xstar || ostar >= countlib(a)))   ((read_attack + 1)->value) = 60; else if (countlib(a) == 3 && ostar >= 5)   ((read_attack + 1)->value) = 53; else if (countlib(a) == 3 && ostar >= 4)   ((read_attack + 1)->value) = 52; else if (countlib(a) == 3 && ostar >= 3)   ((read_attack + 1)->value) = 51; else if (xstar >= countlib(a) && ostar > 1)   ((read_attack + 1)->value) = 15; else   ((read_attack + 1)->value) = 2;};

  return 0;
}
示例#24
0
static int
autohelperread_attack8(int trans, int move, int color, int action)
{
  int A;
  UNUSED(color);

  A = AFFINE_TRANSFORM(647, trans, move);

  if (!action)
    return  accuratelib(move, color, MAX_LIBERTIES, NULL) > 1;
   { int ostar = accuratelib(move, color, MAX_LIBERTIES, NULL); if (countlib(A) == 1 && ostar >= 3)   ((read_attack + 8)->value) = 78; else if (countlib(A) == 1)   ((read_attack + 8)->value) = 72; else if (countlib(A) == 2 && ostar > 2)   /* FIXME: i.e. backfill hack; causes explosion; see reading:35*/   ((read_attack + 8)->value) = 10; else   ((read_attack + 8)->value) = 0;};

  return 0;
}
示例#25
0
static int
find_free_handicap_pattern()
{
  int k;
  int highest_value = -1;
  int sum_values = 0;
  int r;
  int anchor;
  struct pattern *pattern;
  int ll;
  int move;

  number_of_matches = 0;
  matchpat(free_handicap_callback, BLACK, &handipat_db, NULL, NULL);

  if (number_of_matches == 0)
    return 0;

  /* Find the highest value among the matched patterns. */
  for (k = 0; k < number_of_matches; k++)
    if (highest_value < handicap_matches[k].value)
      highest_value = handicap_matches[k].value;

  /* Replace the values by 2^(value - highest_value + 10) and compute
   * the sum of these values. Fractional values are discarded.
   */
  for (k = 0; k < number_of_matches; k++) {
    if (handicap_matches[k].value < highest_value - 10)
      handicap_matches[k].value = 0;
    else
      handicap_matches[k].value = 1 << (handicap_matches[k].value
					- highest_value + 10);
    sum_values += handicap_matches[k].value;
  }

  /* Pick a random number between 0 and sum_values. Don't bother with
   * the fact that lower numbers will tend to be very slightly
   * overrepresented.
   */
  r = gg_rand() % sum_values;
  
  /* Find the chosen pattern. */
  for (k = 0; k < number_of_matches; k++) {
    r -= handicap_matches[k].value;
    if (r < 0)
      break;
  }

  /* Place handicap stones according to pattern k. */
  anchor = handicap_matches[k].anchor;
  pattern = handicap_matches[k].pattern;
  ll = handicap_matches[k].ll;
  
  /* Pick up the location of the move */
  move = AFFINE_TRANSFORM(pattern->move_offset, ll, anchor);
  add_stone(move, BLACK);
  remaining_handicap_stones--;

  /* Add stones at all '!' in the pattern. */
  for (k = 0; k < pattern->patlen; k++) { 
    if (pattern->patn[k].att == ATT_not) {
      int pos = AFFINE_TRANSFORM(pattern->patn[k].offset, ll, anchor);
      add_stone(pos, BLACK);
      remaining_handicap_stones--;
    }
  }

  return 1;
}