Esempio n. 1
0
void XboardEngine::makeMove(const Chess::Move& move)
{
	Q_ASSERT(!move.isNull());

	QString moveString;
	if (move == m_nextMove)
		moveString = m_nextMoveString;
	else
		moveString = this->moveString(move);

	// If we're not in force mode, we'll have to wait for the
	// 'go' command until the move can be sent to the engine.
	if (!m_forceMode)
	{
		if (m_nextMove.isNull())
		{
			m_nextMove = move;
			m_nextMoveString = moveString;
			return;
		}
		else if (move != m_nextMove)
			setForceMode(true);
	}

	if (m_ftUsermove)
		write("usermove " + moveString);
	else
		write(moveString);

	m_nextMove = Chess::Move();
}
Esempio n. 2
0
void XboardEngine::startThinking()
{
	setForceMode(false);
	sendTimeLeft();

	if (m_nextMove.isNull())
		write("go");
	else
		makeMove(m_nextMove);
}
Esempio n. 3
0
void main()
{   
	int tmp;
	unsigned char i;	
	
	//Initialize
	Ht1621_Init();
	Ht1621WrAllData();
	LCD_show(0xFFFF);wait(1,1000);
	
	// tmp
	tmpInit();		// Init, Res12/RanH/Mod0
	tmpSetRes(3);		// Set Resolution (0-9/1-10/2-11/3-12)
	tmpSetRange(1);		// Set Range (0:L/1:H)
	tmpSetMode(0);		// Set Mode (0:Continuous/1:ShutDown)
	
	// UV_Meter
	uvPre();
	uvReset();
	setForceMode();
	setALSVISMode();	

	LCD_show(0x7777);wait(3,1000);
	
	i=1;	
	while(1)
	{
		//tmpGetTmpCont(&tmp);
		getForceData();
		getALSVISData(&tmp);
		
		cnt++;
		if(cnt==1)
		{
			LCD_show(tmp);
			wait(3,2000);
		}
		if(cnt==2)
		{
			LCD_show(payload++);
			wait(3,1000);
			cnt=0;
		}	 		
	}	
}
Esempio n. 4
0
void XboardEngine::endGame(const Chess::Result& result)
{
	State s = state();
	if (s != Thinking && s != Observing)
		return;

	if (s != Thinking)
		m_gotResult = true;

	stopThinking();
	setForceMode(true);
	write("result " + result.toVerboseString());

	ChessEngine::endGame(result);

	// If the engine can't be pinged, we may have to wait for
	// for a move or a result, or an error, or whatever. We
	// would like to extend our middle fingers to every engine
	// developer who fails to support the ping command.
	if (!m_ftPing && m_gotResult)
		finishGame();
}
Esempio n. 5
0
void XboardEngine::startGame()
{
	m_drawOnNextMove = false;
	m_gotResult = false;
	m_forceMode = false;
	m_nextMove = Chess::Move();
	write("new");
	
	if (board()->variant() != "standard")
		write("variant " + variantToXboard(board()->variant()));
	
	if (board()->isRandomVariant()
	||  board()->fenString() != board()->defaultFenString())
	{
		if (m_ftSetboard)
			write("setboard " + board()->fenString());
		else
			qDebug("%s doesn't support the setboard command", qPrintable(name()));
	}
	
	// Send the time controls
	const TimeControl* myTc = timeControl();
	if (myTc->isInfinite())
	{
		if (myTc->plyLimit() == 0 && myTc->nodeLimit() == 0)
			write(QString("st %1").arg(s_infiniteSec));
	}
	else if (myTc->timePerMove() > 0)
		write(QString("st %1").arg(myTc->timePerMove() / 1000));
	else
		write(QString("level %1 %2 %3")
		      .arg(myTc->movesPerTc())
		      .arg(msToXboardTime(myTc->timePerTc()))
		      .arg(double(myTc->timeIncrement()) / 1000));

	if (myTc->plyLimit() > 0)
		write(QString("sd %1").arg(myTc->plyLimit()));
	if (myTc->nodeLimit() > 0)
	{
		if (m_ftNps)
			write(QString("st 1\nnps %1").arg(myTc->nodeLimit()));
		else
			qDebug("%s doesn't support the nps command", qPrintable(name()));
	}

	// Show thinking
	write("post");
	// Pondering
	if (pondering())
		write("hard");
	else
		write("easy");
	setForceMode(true);
	
	// Tell the opponent's type and name to the engine
	if (m_ftName)
	{
		if (!opponent()->isHuman())
			write("computer");
		write("name " + opponent()->name());
	}
}