예제 #1
0
/*
 * The returned struct tells the client if the click is valid and if so
 * what's the server answer to the move
 */
gameAnswer notifyClick(int x, int y) [[server]]
{
	if(x < 0 || x > 2 || y < 0 || y > 2)
		return gameAnswer(0,0,false);

	if(gameState.get(x,y)) //Already set
		return gameAnswer(0,0,false);

	gameState.set(x,y);

	int retX;
	int retY;
	gameState.getFirstEmpty(retX,retY);
	gameState.set(retX,retY);
	return gameAnswer(retX,retY,true);
}