bool CWebBrowserDownloadHandler::OnContextButton(int itemNumber, unsigned int button)
{
  if (button == 30092)
    m_items[itemNumber]->Cancel();
  else if (button == 30093)
    m_items[itemNumber]->Pause();
  else if (button == 30094)
    m_items[itemNumber]->Resume();
  else if (button == 30097)
  {
    ResetHistory();
    OnInit();
  }
  else if (button == 30091)
  {
    bool canceled = false;
    std::string text = StringUtils::Format(kodi::GetLocalizedString(30098).c_str(), m_items[itemNumber]->GetName().c_str());
    bool ret = kodi::gui::dialogs::YesNo::ShowAndGetInput(kodi::GetLocalizedString(30016), text, canceled,
                                                          kodi::GetLocalizedString(30018), kodi::GetLocalizedString(30017));
    if (canceled)
      return false;

    if (ret)
      kodi::vfs::DeleteFile(m_items[itemNumber]->GetPath());

    RemovedFinishedDownload(m_items[itemNumber]);
    OnInit();
  }
  return true;
}
Beispiel #2
0
static void FillSlab()
    {
    SlabAlloc1(uint64, AttN, 64);
    SlabAlloc1(uint64, AttK, 64);
    SlabAlloc1(uint64, AttPw, 64);
    SlabAlloc1(uint64, AttPb, 64);
    SlabAlloc1(typeMM, RookMM, 64);
    SlabAlloc1(typeMM, BishopMM, 64);
    SlabAlloc2(uint64, MMOrtho, 102400);
    SlabAlloc2(uint64, MMDiag, 5248);
    SlabAlloc1(uint64, SqSet, 64);
    SlabAlloc1(uint64, SqClear, 64);
    SlabAlloc1(uint64, NonDiag, 64);
    SlabAlloc1(uint64, NonOrtho, 64);
    SlabAlloc1(uint64, Ortho, 64);
    SlabAlloc1(uint64, Diag, 64);
    SlabAlloc1(uint64, OrthoDiag, 64);
    SlabAlloc1(uint64, OpenFileW, 64);
    SlabAlloc1(uint64, OpenFileB, 64);
    SlabAlloc1(uint64, PassedPawnW, 64);
    SlabAlloc1(uint64, PassedPawnB, 64);
    SlabAlloc1(uint64, ProtectedPawnW, 64);
    SlabAlloc1(uint64, ProtectedPawnB, 64);
    SlabAlloc1(uint64, IsolatedPawnW, 64);
    SlabAlloc1(uint64, IsolatedPawnB, 64);
    SlabAlloc1(uint64, ConnectedPawns, 64);
    SlabAlloc1(uint64, InFrontW, 8);
    SlabAlloc1(uint64, NotInFrontW, 8);
    SlabAlloc1(uint64, InFrontB, 8);
    SlabAlloc1(uint64, NotInFrontB, 8);
    SlabAlloc1(uint64, IsolatedFiles, 8);
    SlabAlloc1(uint64, FilesLeft, 8);
    SlabAlloc1(uint64, FilesRight, 8);
    SlabAlloc1(uint64, Doubled, 64);
    SlabAlloc1(uint64, Left2, 64);
    SlabAlloc1(uint64, Right2, 64);
    SlabAlloc1(uint64, Left1, 64);
    SlabAlloc1(uint64, Right1, 64);
    SlabAlloc1(uint64, Adjacent, 64);
    SlabAlloc1(uint64, LongDiag, 64);
    SlabAlloc1(uint64, Northwest, 64);
    SlabAlloc1(uint64, Southwest, 64);
    SlabAlloc1(uint64, Northeast, 64);
    SlabAlloc1(uint64, Souteast, 64);
    SlabAlloc1(uint64, QuadrantWKwtm, 64);
    SlabAlloc1(uint64, QuadrantBKwtm, 64);
    SlabAlloc1(uint64, QuadrantWKbtm, 64);
    SlabAlloc1(uint64, QuadrantBKbtm, 64);
    SlabAlloc1(uint64, ShepherdWK, 64);
    SlabAlloc1(uint64, ShepherdBK, 64);
    SlabAlloc3(uint64, Interpose, 0100 * 0100);
    SlabAlloc3(uint64, Evade, 0100 * 0100);
    SlabAlloc3(uint64, Zobrist, 0x10 * 0100);
    SlabAlloc3(sint8, Line, 0100 * 0100);
    SlabAlloc1(uint64, HashCastling, 16);
    SlabAlloc1(uint64, HashEP, 8);
    SlabAlloc1(uint64, HashRev, 16);

#ifdef MultiplePosGain
    SlabAlloc2(sint16, MaxPositionalGain, MaxCPUs * 0x10 * 010000);
#else
    SlabAlloc2(sint16, MaxPositionalGain, 0x10 * 010000);
#endif

#ifdef MultipleHistory
    SlabAlloc2(uint16, History, MaxCPUs * 0x10 * 0100);
#else
    SlabAlloc2(uint16, History, 0x10 * 0100);
#endif

    SlabAlloc2(sint32, PieceSquareValue, 0x10 * 0100);
    SlabAlloc2(typeMaterial, Material, 419904);
    ResetHistory();
    ResetPositionalGain();
    InitArrays();
    InitMaterialValue();
    InitStatic();
    }
Beispiel #3
0
void FillSlab ()
{
  SLAB_ALLOC1 (uint64, AttN, 64);
  SLAB_ALLOC1 (uint64, AttK, 64);
  SLAB_ALLOC1 (uint64, AttPw, 64);
  SLAB_ALLOC1 (uint64, AttPb, 64);
#ifndef MAGIC_BITBOARDS
  SLAB_ALLOC3 (uint64, LineMask, 4 * 0100 * 0100);
  SLAB_ALLOC3 (int, LineShift, 4 * 0100);
  SLAB_ALLOC1 (uint64, ClearL90, 64);
  SLAB_ALLOC1 (uint64, ClearL45, 64);
  SLAB_ALLOC1 (uint64, ClearR45, 64);
  SLAB_ALLOC1 (uint64, SetL90, 64);
  SLAB_ALLOC1 (uint64, SetL45, 64);
  SLAB_ALLOC1 (uint64, SetR45, 64);
#else
  SLAB_ALLOC1 (type_MM, ROOK_MM, 64);
  SLAB_ALLOC1 (type_MM, BISHOP_MM, 64);
  SLAB_ALLOC2 (uint64, MM_ORTHO, 102400); /* SLAB 800k */
  SLAB_ALLOC2 (uint64, MM_DIAG, 5248);
#endif
  SLAB_ALLOC1 (uint64, SqSet, 64);
  SLAB_ALLOC1 (uint64, SqClear, 64);
  SLAB_ALLOC1 (uint64, NON_DIAG, 64);
  SLAB_ALLOC1 (uint64, NON_ORTHO, 64);
  SLAB_ALLOC1 (uint64, ORTHO, 64);
  SLAB_ALLOC1 (uint64, DIAG, 64);
  SLAB_ALLOC1 (uint64, ORTHO_DIAG, 64);
  SLAB_ALLOC1 (uint64, OpenFileW, 64);
  SLAB_ALLOC1 (uint64, OpenFileB, 64);
  SLAB_ALLOC1 (uint64, PassedPawnW, 64);
  SLAB_ALLOC1 (uint64, PassedPawnB, 64);
  SLAB_ALLOC1 (uint64, ProtectedPawnW, 64);
  SLAB_ALLOC1 (uint64, ProtectedPawnB, 64);
  SLAB_ALLOC1 (uint64, IsolatedPawnW, 64);
  SLAB_ALLOC1 (uint64, IsolatedPawnB, 64);
  SLAB_ALLOC1 (uint64, ConnectedPawns, 64);
  SLAB_ALLOC1 (uint64, InFrontW, 8);
  SLAB_ALLOC1 (uint64, NotInFrontW, 8);
  SLAB_ALLOC1 (uint64, InFrontB, 8);
  SLAB_ALLOC1 (uint64, NotInFrontB, 8);
  SLAB_ALLOC1 (uint64, IsolatedFiles, 8);
  SLAB_ALLOC1 (uint64, FilesLeft, 8);
  SLAB_ALLOC1 (uint64, FilesRight, 8);
  SLAB_ALLOC1 (uint64, DOUBLED, 64);
  SLAB_ALLOC1 (uint64, LEFT2, 64);
  SLAB_ALLOC1 (uint64, RIGHT2, 64);
  SLAB_ALLOC1 (uint64, LEFT1, 64);
  SLAB_ALLOC1 (uint64, RIGHT1, 64);
  SLAB_ALLOC1 (uint64, ADJACENT, 64);
  SLAB_ALLOC1 (uint64, LONG_DIAG, 64);
  SLAB_ALLOC1 (uint64, NORTHWEST, 64);
  SLAB_ALLOC1 (uint64, SOUTHWEST, 64);
  SLAB_ALLOC1 (uint64, NORTHEAST, 64);
  SLAB_ALLOC1 (uint64, SOUTHEAST, 64);
  SLAB_ALLOC1 (uint64, QuadrantWKwtm, 64);
  SLAB_ALLOC1 (uint64, QuadrantBKwtm, 64);
  SLAB_ALLOC1 (uint64, QuadrantWKbtm, 64);
  SLAB_ALLOC1 (uint64, QuadrantBKbtm, 64);
  SLAB_ALLOC1 (uint64, ShepherdWK, 64);
  SLAB_ALLOC1 (uint64, ShepherdBK, 64);
  SLAB_ALLOC3 (uint64, INTERPOSE, 0100 * 0100);
  SLAB_ALLOC3 (uint64, EVADE, 0100 * 0100);
  SLAB_ALLOC3 (uint64, ZOBRIST, 0x10 * 0100);
  SLAB_ALLOC3 (sint8, LINE, 0100 * 0100);
  SLAB_ALLOC1 (uint64, ZobristCastling, 16);
  SLAB_ALLOC1 (uint64, ZobristEP, 8);
  SLAB_ALLOC1 (uint64, ZobristRev, 16);
#ifdef MULTIPLE_POS_GAIN
  SLAB_ALLOC2 (sint16, MAX_POSITIONAL_GAIN, MAX_CPUS * 0x10 * 010000);
#else
  SLAB_ALLOC2 (sint16, MAX_POSITIONAL_GAIN, 0x10 * 010000); /* SLAB 1mb */
#endif
#ifdef MULTIPLE_HISTORY
  SLAB_ALLOC2 (uint16, HISTORY, MAX_CPUS * 0x10 * 0100); /* SLAB 64k */
#else
  SLAB_ALLOC2 (uint16, HISTORY, 0x10 * 0100);
#endif
  SLAB_ALLOC2 (sint32, PieceSquareValue, 0x10 * 0100); /* SMP read SLAB 16k */
  SLAB_ALLOC2 (typeMATERIAL, MATERIAL, 419904); /* SMP read SLAB 1.68mb */

  ResetHistory ();
  ResetPositionalGain ();
  InitArrays ();
  InitMaterialValue ();
  InitStatic ();
}
void CommunicationVoiceLibrary::Reset()
{
	ResetHistory();

	m_testManager->Reset();
}
Beispiel #5
0
void CPartida::IterativeDeepening(void)
{
	extern void Print(const char *fmt, ...);
	long ini_it;
	int value,value_i;
	int hasp;
	int MateCount = 0;
	// busqueda con ventana
	int VAlpha,VBeta,Pase;

	int Valor_d1;
	char JugD1[20];

	ValueSearch = 0;
	NodosVisitados = 0;
	cancelado  = 0;
	NodosRepasados = 0;
	SelDepth = 0;
	inicio = TiempoTranscurrido();

	// copiamos tablero principal
	Taux.LoadEPD(T.SaveEPD(),0);

	ResetHistory();
	char PV[1024];
	PV[0] = '\0';
	value = -INFINITO;
	T.CalculaJugadasPosibles();
	HashJ.IncrementaEdad();
	JugadaActual[0] = '\0';
	strcpy(JugadaActual,T.JugadasPosibles[0].ToString());
	Depth = 1;
	value_i = value = PVS(Depth,-INFINITO,+INFINITO,PV,false);
	Valor_d1 = value_i ;
	if(Valor_d1 == INFINITO || Valor_d1 == -INFINITO)
		Valor_d1 = 0;
	JugD1[0] = '\0';

	if(PV[0])
	{
		strcpy(MejorPath,PV);
		PrintInfo(value,PV);
		strcpy(JugadaActual,strtok(PV," "));
		strcpy(JugD1,JugadaActual);
	}
	BFNodeCount[Depth] += NodosVisitados;
	BFHitCount[Depth]++;
	Depth++;
	VAlpha = value-128;
	VBeta = value+128;
	Pase = 0;
	if(Unica)
	{
		PrintInfo(value,PV);
		strcpy(JugadaActual,strtok(PV," u"));
		Print("bestmove %s\n",JugadaActual);
		return;
	}
	while(1)
	{
		if(cancelado)
			break;
		if(tiempo_limite)
		{
			ini_it = TiempoTranscurrido();
			if((ini_it  - inicio) > tiempo_limite) // tiempo excedido
			{
				break;
			}
		}

		if(LimiteProfundidad)
			if(Depth > LimiteProfundidad)
			{
				if(LimiteProfundidad == 1)
					PrintInfo(value,PV);
				break;
			}
		if(Depth > MAXDEPTHC)
			break;

		SelDepth = 0;
		if(Depth > 2)
			Print("info depth %d \n",Depth);
		hasp = value;
		ResetHistory();
		// nos colocamos en la historia
		// preparamos la primera evaluacion
		Taux.CalculaJugadasPosibles();


		value = PVS(Depth,-INFINITO,+INFINITO,PV,false);
		if( cancelado == 1)
			break;

		PrintInfo(value,PV); // end of iteration-> get time to depth
		BFNodeCount[Depth] += NodosVisitados;
		BFHitCount[Depth]++;

		if(value == MATE || value == -MATE)
		{
			strcpy(JugadaActual,"resign");
			break;
		}
		PV[0] = '\0'; // reset de la mejor jugada
		// llevamos la cuenta de iteraciones que damos o recibimos mate
		if(value < (50-MATE) && value > -MATE)
			MateCount++;
		if(value > (MATE-50) && value < MATE)
			MateCount++;

		// a partir de 5 iteraciones de mate podemos dar el resultado por bueno
		if(tiempo_limite)
		if(MateCount >= 5)
			break;

		Depth++;
	}
	// hemos terminado de pensar
	if(JugadaActual[0])
	{
		for(int i=0;JugadaActual[i];i++)
			if(JugadaActual[i] == '#')
				JugadaActual[i] = '\0';

		if(LimiteProfundidad != 1)
			Print("bestmove %s\n",JugadaActual);
	}
	else
	{
		// no tenemos JugadaActual
		Print("bestmove %s\n",T.JugadasPosibles[0].ToString());
	}
	ValueSearch = value;
}