void CLetterGuesser::GuessLetter(CLetter &Letter, CGuess &Guess)
{
	m_Letter = CGuessLetter(Letter);
	PaintLetter();
	::ZeroMemory(&m_Guess, sizeof(CGuess));
/*
	MakeMap(m_Letter.m_MainBlackColor);
	MakeGuess();
*/
	MakeMap(m_Letter.m_MainWhiteColor);
	MakeGuess();

/*
	if (m_Letter.m_MainBlackPixels >= 50)
	{
		MakeMap(m_Letter.m_MainBlackColor);
		MakeGuess();
	}
*/


	ReorderResult();

	Guess = m_Guess;
}
Beispiel #2
0
/************\ 
**  Solver  *****************************************************\ 
**                                                              ** 
**    Solver runs the sudoku solver.  Input puzzle is in the    ** 
**    buffer array, and somewhat controlled by a number of      ** 
**    globals (see the globals at the top of the main program   ** 
**    for globals and meanings).                                ** 
**                                                              ** 
\****************************************************************/ 
int bb_solver(unsigned *puzzle) 
{ register unsigned i; 

  PuzSolCnt = 0; 

  InitGrid(); 

  for (i = 0; i < 81; i++) 
     if (puzzle[i]) 
        PushSingle((char)(i), V2B[puzzle[i]]); 

  // Loop through the puzzle solving routines until finished 
  while (Changed) 
  { // If No Solution possible, jump straight to the backtrack routine 
    if (!No_Sol) 
    { // Check if any Singles to be propogated 
      if (SingleCnt) 
      { 
#ifdef CALC_STATS 
        SCnt++; 
#endif 
        if (SingleCnt > 2)               // If multiple singles 
          ProcessInitSingles();          //   process them all at once 
        if (SingleCnt)                   // otherwise 
          ProcessSingles();              //   process them one at a time 
        if (!Gp->CellsLeft) 
        { if (!No_Sol) 
          { PuzSolCnt++; 
            if (PuzSolCnt > 1) break; 
          } 
          No_Sol = Changed = 1; 
          continue; 
        } 
      } 

      // If nothing has changed, apply the next solver 
      if (Changed) 
      { 
#ifdef CALC_STATS 
        HCnt++; 
#endif 
        FindHiddenSingles(); if (SingleCnt) continue; 
//        if (use_methods & USE_LOCK_CAND) 
          { 
#ifdef CALC_STATS 
         LCCnt++; 
#endif 
         FindLockedCandidates(); if (Changed) continue; } 
      } 
    } 

    //If nothing new found, just make a guess 
#ifdef CALC_STATS 
   GCnt++; 
#endif 
   MakeGuess(); 
    if (No_Sol) break; 
//    if (!initp && (MaxDepth < PIdx)) MaxDepth = PIdx; 
//    if (PIdx > 62) { printf ("Max Depth exceeded, recompile for more depth.\n\n"); exit(0); } 
  } 

#ifdef CALC_STATS 
  TSCnt   += SCnt;    // Update Stats 
  THCnt   += HCnt; 
  TGCnt   += GCnt; 
  TLCCnt  += LCCnt; 
  TSSCnt  += SSCnt; 
  TFCnt   += FCnt; 
  TOneCnt += OneCnt; 
  TTwoCnt += TwoCnt; 
#endif 
  return PuzSolCnt; 
}