示例#1
0
void Kieme_Opb_Comp::post_new_line(bool first)
{
     if (first)
     {
         for (INT y = _y0_buf ; y < _y1_buf-1 ; y++)
             verif_line(y);
     }

     verif_line(_y1_buf-1);

     if (mModePond) 
        mPond =  kth_buf((INT *)0,0)[1];
     
     for (INT d =0 ; d<mDimOutSpec ; d++)
     {
          _hk->raz();
          mLines = kth_buf((INT *)0,0)[d];

          for (INT dy=_y0_side ; dy<=_y1_side ; dy++)
              for (INT dx=_x0_side ; dx<_x1_side ; dx++)
                  Add(_x0+dx,dy,1);
         
          for 
          (
               INT     x = _x0              , 
                       x_sub=_x0+_x0_side   ,
                       x_add=_x0+_x1_side   ;
               x < _x1 ; 
               x++,x_sub++,x_add++
          )
          {
               for (INT dy=_y0_side ; dy<=_y1_side ; dy++)
                   Add(x_add,dy,1);
               switch(_mode_res)
               {
                    case Histo_Kieme::KTH :
                        _buf_res[d][x] = mModePond ? _hk->RKthVal(mRKth,-1) : _hk->kth_val(mIKth);
                    break;

                    case Histo_Kieme::RANK :
                        _buf_res[d][x] = _hk->rank(mLines[0][x]);
                    break;
               }
	       {
                    for (INT dy=_y0_side ; dy<=_y1_side ; dy++)
                        Add(x_sub,dy,-1);
               }
          }
     }
}
示例#2
0
文件: main.c 项目: Blanchard-A/Sudoku
int	replace_all_zero(int **map, int pos, int *order_priority)
{
  int	i;
  int	j;
  int	k;

  if (pos == 82)
    return (0);
  k = 1;
  i = order_priority[pos] / 9;
  j = order_priority[pos] % 9;
  if (map[i][j] > 0)
    return (replace_all_zero(map, pos + 1, order_priority));
  while (k < 10)
    {
      if (verif_line(k, i, map) == 0 && verif_column(k, j, map) == 0 &&
	  verif_square(k, i, j, map) == 0)
	{
	  map[i][j] = k;
	  if (replace_all_zero(map, pos + 1, order_priority) == 0)
	    return (0);
	}
      k++;
    }
  map[i][j] = 0;
  return (-1);
}
示例#3
0
int	verif_possibility(int **map, int i, int j)
{
  int	k;
  int	count;

  count = 0;
  k = 1;
  while (k < 10)
    {
      if (verif_line(k, i, map) == 0 && verif_column(k, j, map) == 0 &&
	  verif_square(k, i, j, map) == 0)
	{
	  count++;
	}
      k++;
    }
  count = -count;
  return (count);
}