Exemplo n.º 1
0
void SceneParser::parseSpotlight(void)
{
    parseToken(Scanner::LeftCurly);

    Vector3 pos;
    parseVector(pos);

    Vector3 lookat;
    parseVector(lookat);

    Vector3 color;
    parseVector(color);

    Vector3 falloff;
    parseVector(falloff);

    float intensity;
    parseNumber(intensity);

    float innerAngle;
    parseNumber(innerAngle);

    float outerNumber;
    parseNumber(outerNumber);

    Light* l = new Spotlight(raytracer, pos, lookat, color, falloff, intensity, innerAngle, outerNumber);
    raytracer->addLight(l);

    parseToken(Scanner::RightCurly);
}
Exemplo n.º 2
0
void SceneParser::parsePhoton(void)
{
    parseToken(Scanner::LeftCurly);

    int num;
    parseNumber(num);

    config.photonCount = num;

    parseNumber(num);

    config.maxPhotonSamples = num;

    float radius;
    parseNumber(radius);

    config.photonSearchRadius = radius;

    int bounces;
    parseNumber(bounces);

    config.photonBounces = bounces;

    parseToken(Scanner::RightCurly);
}
Exemplo n.º 3
0
void Tokenizer::getInput(char* arg1)
{
  istr.open(arg1,ifstream::in);
  if(!istr.is_open()) 
  {
    cout<<"Unable to open file"<<endl;
    exit(1);
  }
  ostr.open("output1.txt");
  if(!ostr.is_open()) 
  {
    cout<<"Unable to open file"<<endl;
    exit(1);
  }
  istr2.open("output1.txt", ifstream::in);
  if(!istr2.is_open()) 
  {
    cout<<"Unable to open file"<<endl;
    exit(1);
  }
  ostr2.open("output2.txt");
  if(!ostr2.is_open()) 
  {
    cout<<"Unable to open file"<<endl;
    exit(1);
  }
  istr3.open("output2.txt", ifstream::in);
  if(!istr3.is_open()) 
  {
    cout<<"Unable to open file"<<endl;
    exit(1);
  }
  parseToken();
}
Exemplo n.º 4
0
void SceneParser::parseVector(Vector3& retVal)
{
    if(errorFlag)
        return;

    parseToken(Scanner::LeftAngle);
    parseNumber(retVal.x);
    parseToken(Scanner::Comma);
    parseNumber(retVal.y);
    parseToken(Scanner::Comma);
    parseNumber(retVal.z);
    parseToken(Scanner::RightAngle);

    if(errorFlag)
        error("invalid vector declaration");
}
Exemplo n.º 5
0
	bool ParseCommandLine(LPCTSTR lpCmdLine, HRESULT* pnRetCode ) throw( ) {
		m_nRestarting = 1;
		TCHAR szTokens[] = _T("-/");
		LPCTSTR lpszToken = FindOneOf(lpCmdLine, szTokens);
        getRhoRootPath();
		while (lpszToken != NULL)
		{
			if (WordCmpI(lpszToken, _T("Restarting"))==0) {
				m_nRestarting = 10;
			}
#if defined(OS_WINDOWS)
			else if (wcsncmp(lpszToken, _T("approot"),7)==0) {
				char* token = wce_wctomb(lpszToken);
				//parseToken will allocate extra byte at the end of the returned token value
				char* path = parseToken( token, strlen(token) );
				if (path) {
					int len = strlen(path);
					if (!(path[len]=='\\' || path[len]=='/')) {
						path[len] = '\\';
						path[len+1]  = 0;
					}
					m_strRootPath = path;
					free(path);
				}
				free(token);
			}
#endif
			lpszToken = FindOneOf(lpszToken, szTokens);
		}

		return __super::ParseCommandLine(lpCmdLine, pnRetCode);
	}
Exemplo n.º 6
0
bool XMLParser::parseKeyValue(Common::String keyName) {
	assert(_activeKey.empty() == false);

	if (_activeKey.top()->values.contains(keyName))
		return false;

	_token.clear();
	char stringStart;

	if (_char == '"' || _char == '\'') {
		stringStart = _char;
		_char = _stream->readByte();

		while (_char && _char != stringStart) {
			_token += _char;
			_char = _stream->readByte();
		}

		if (_char == 0)
			return false;

		_char = _stream->readByte();

	} else if (!parseToken()) {
		return false;
	}

	_activeKey.top()->values[keyName] = _token;
	return true;
}
Exemplo n.º 7
0
Response parseResponse(char const* str) {
    // Parse an HTTP response 
    auto version = parseToken(str);
    auto code = parseStatus(version.ch);
    auto message = parseUntil(code.ch, [](char ch) { return ch == '\r'; });
    
    auto response = Response();
    if (version.value != "HTTP/1.1") {
        throw Error("bad HTTP version");
    }
      
    auto ch = parseCrLf(message.ch).ch;
    while (*ch != '\0' && *ch != '\r') {
        auto name = parseUntil(ch, [](char ch) { return ch == ':'; });
        if (*name.ch) {
            name.ch++; // For ":"
        }
        auto ws = parseWhile(name.ch, isspace);
        auto value = parseUntil(ws.ch, [](char ch) { return ch == '\r'; });   
        response.headerIs(name.value, value.value);
        if (name.value == "Set-Cookie") {
            response.cookieIs(Cookie(value.value));
        }
        ch = parseCrLf(value.ch).ch;
    }
    ch = parseCrLf(ch).ch;
    
    response.statusIs(code.value);
    response.dataIs(ch); 
    return response;
}
Exemplo n.º 8
0
void SceneParser::parseTransform(Shape* s)
{
    if(currentToken != Scanner::Id || scanner.tokenText() != "transform")
        return;
    parseToken(Scanner::LeftCurly);
    advance();

    while(errorFlag == false && currentToken == Scanner::Id)
    {
        string tokenText = scanner.tokenText();

        if(tokenText == "translate"){
            Vector3 factor;
            parseVector(factor);
            s->Translate(factor);
        }
        else if(tokenText == "rotate"){
            Vector3 factor;
            parseVector(factor);
            s->Rotate(factor);
        }
        else if(tokenText == "scale"){
            Vector3 factor;
            parseVector(factor);
            s->Scale(factor);
        }
        else
            error("undefined transform attribute \"" + tokenText + "\"");

         advance();
    }

    acceptToken(Scanner::RightCurly);
    advance();
}
Exemplo n.º 9
0
void SceneParser::parseNumber(int& val)
{
    parseToken(Scanner::Int);
    if(errorFlag == false){
        string strVal = scanner.tokenText();
        val = atoi(strVal.c_str());
    }
}
Exemplo n.º 10
0
void SceneParser::parse(void)
{
    parseConfig();
    acceptToken(Scanner::Separator);
    advance();
    parseObjects();
    parseToken(Scanner::StreamDone);
}
Exemplo n.º 11
0
void SceneParser::parseCamera(void)
{
    parseToken(Scanner::LeftCurly);

    Vector3 o;
    parseVector(o);

    Vector3 p;
    parseVector(p);

    Vector3 u;
    parseVector(u);

    config.camera = new Camera(o, p, u, config.width, config.height);

    parseToken(Scanner::RightCurly);
}
Exemplo n.º 12
0
static ParseResult<Response::Status> parseStatus(char const* str) {
    ParseResult<Response::Status> result{};
    auto code = parseToken(str);

    result.value = (Response::Status)std::atoi(code.value.c_str());
    result.ch = code.ch;
    return result;
}
Exemplo n.º 13
0
void SceneParser::parseDirectionalLight(void)
{
    parseToken(Scanner::LeftCurly);

    Vector3 dir;
    parseVector(dir);

    Vector3 color;
    parseVector(color);

    float intensity;
    parseNumber(intensity);

    Light* l = new DirectionalLight(raytracer, dir, color, intensity);
    raytracer->addLight(l);

    parseToken(Scanner::RightCurly);
}
Exemplo n.º 14
0
void SceneParser::parsePointLight(void)
{
    parseToken(Scanner::LeftCurly);

    Vector3 pos;
    parseVector(pos);

    Vector3 color;
    parseVector(color);

    Vector3 falloff;
    parseVector(falloff);

    float intensity;
    parseNumber(intensity);

    Light* l = new PointLight(raytracer, pos, color, falloff, intensity);
    raytracer->addLight(l);

    parseToken(Scanner::RightCurly);
}
Exemplo n.º 15
0
static void performCommand(char *acLine, DynArray_T oHistoryList, 
                           char *pcProgName)

/* Expand any !commandprefix in acLine. Insert acLine into 
   oHistoryList iff the expanding succeeds and acLine does not consist
   of entirely whitespace characters. Lexically and syntactically 
   analyze acLine. Execute acLine if no errors are found. It is a 
   checked runtime error for acLine, oHistory, or pcProgName to be
   NULL. */

{
   char *pcTemp;
   Command_T oCommand;
   DynArray_T oTokens;
   int iSuccessful;

   assert(acLine != NULL);
   assert(oHistoryList != NULL);
   assert(pcProgName != NULL);

   if(histHasCommandPrefix(acLine))
   {
      iSuccessful = histExpandLine(acLine, oHistoryList, pcProgName);
      if(iSuccessful)
         printf("%s\n", acLine);
      else
         return;
   }
   oTokens = DynArray_new(0);
   iSuccessful = lexLine(acLine, oTokens, pcProgName);
   if(DynArray_getLength(oTokens) > 0)
   {
      /* Allocate memory to store command in oHistoryList iff 
         command does not consist of entirely whitespace
         characters. */
      pcTemp = (char*)malloc(strlen(acLine) + 1);
      assert(pcTemp != NULL);
      strcpy(pcTemp, acLine);
      DynArray_add(oHistoryList, pcTemp);

      if(iSuccessful)
      {
         oCommand = Command_new();
         iSuccessful = parseToken(oTokens, oCommand, pcProgName);
         if(iSuccessful)
            execute(oCommand, oHistoryList, pcProgName);
         Command_free(oCommand, NULL);
      }
   }
   DynArray_map(oTokens, Token_free, NULL);
   DynArray_free(oTokens);
}
Exemplo n.º 16
0
Arquivo: Reader.cpp Projeto: LicoC/XML
// returns true start of an element is successfully consumed.
// if true, the element's attributes are available below through getAttribute.
bool Reader::readStartElement()
{
	entry element;
	if ( isStartElement() && parseToken(element.Element) )
	{
		_attributes.clear();
		while ( parseAttribute() ) ;
		element.Children = _parser.parseMatch('>');
		_stack.push_back(element);
		_bStart = false;
		return true;
	}
	return false;
}
Exemplo n.º 17
0
void SceneParser::parseMesh(void)
{
    parseToken(Scanner::LeftCurly);

    parseToken(Scanner::String);

    string fileName = scanner.tokenText();
    vector<Triangle*>* newMesh = new vector<Triangle*>;
    vector<Vector3>* newPoints = new vector<Vector3>;
    vector<Vector3>* newNormals = new vector<Vector3>;

    if(!parser->loadObj(fileName, *newMesh, *newPoints, *newNormals))
        errorFlag = true;

    Mesh* m = new Mesh(newMesh, newPoints, newNormals);
    raytracer->addObject(m);

    advance();
    parseMaterial(m);
    parseTransform(m);

    acceptToken(Scanner::RightCurly);
}
Exemplo n.º 18
0
void SceneParser::parseAreaLight(void)
{
    parseToken(Scanner::LeftCurly);

    Vector3 pos;
    parseVector(pos);

    Vector3 right;
    parseVector(right);

    Vector3 up;
    parseVector(up);

    Vector3 color;
    parseVector(color);

    Vector3 falloff;
    parseVector(falloff);

    float intensity;
    parseNumber(intensity);

    int samplesx;
    parseNumber(samplesx);

    int samplesy;
    parseNumber(samplesy);

    Light* l = new AreaLight(raytracer, pos, right, up, color, falloff, intensity, samplesx, samplesy);
    raytracer->addLight(l);

    Plane* p = new Plane(pos + up * 0.5f + right * 0.5f, right, right.getLength() / 2.0f, up, up.getLength() / 2.0f);
    p->getMaterial().setEmissive(color * intensity);
    raytracer->addObject(p);

    parseToken(Scanner::RightCurly);
}
Exemplo n.º 19
0
int parser::parseFile(char* file) {
    string str = openFile(file);
    // delete comments in user.m
    consumeComments(str);
    // delete empty lines in user.m
    consumeNewLines(str);
    int count = 0;
    ofstream han("output.txt");
    while(!str.empty()) {
        ++count;
        han << count << " - " << str.empty() << endl;
        han << str << "----\n" << endl;
        parseToken(str);
    }
    han.close();
    return 0;
}
Exemplo n.º 20
0
Arquivo: Reader.cpp Projeto: LicoC/XML
// parse attribute=quoted-value sequence.
bool Reader::parseAttribute()
{
	std::pair<std::string, std::string> pair;
	bool bOK = skipspace(true) && parseToken(pair.first);
	if (bOK)
	{
		bOK = skipspace(true) && _parser.parseMatch('=') && skipspace(true) &&
			_parser.parseMatch('"') &&
			_parser.readText(pair.second, '"') &&
			_parser.parseMatch('"');
		if (bOK)
		{
			_attributes.push_back(pair);
		}
	}
	return bOK;
}
Exemplo n.º 21
0
/*
 * Match the next token with a list of keywords.
 * The list of keywords is in PROGMEM, separated by spaces.
 * returns either the position of the found keyword (0..n), 
 * PARSER_NOMATCH, or PARSER_EOL at the end of line
 */
int8_t parseKeyword(const char *keys)
{
    char *p = parseToken();
    char *key = (char *)keys;
    int8_t i = 0;
    if (p) {
	while (pgm_read_byte(key)) {
	    key = tokcasecmp(p, key);
	    if (key == 0) {
		return i;  // match
	    }
	    key++;  // skip delimiter
	    i++; // next keyword
	}
    } else {
	return PARSER_EOL;
    }
    return PARSER_NOMATCH;
}
Exemplo n.º 22
0
/********************************************************************
* parseVfdMessage:													*
* Parses the message from the VFD and updates the vfd data struct 	*
********************************************************************/
int parseVfdMessage()
{
	// Message formatting:
	//  	<F=%f,H=%f,T=%f,P=%f,VS=%d><EOF>
	//  	Flow,Freq,Temp,Pres,State
	int id = 0;
	char valstr[32];
	memset(valstr, 0, sizeof(valstr));

	//strtok breaks up the message into tokens, delimited by commas
	char* token = strtok(messageFromVfd, DELIMS);
	while(token != NULL)
	{
		if(strcmp(token, EOFSTR) != 0)
		{
			parseToken(token, &id, valstr);
			switch(id)
			{
				case ID_FLOW: //Flow
					data.flowRate = atof(valstr);
					break;
				case ID_FREQ: //Frequency
					data.frequency = atof(valstr);
					update.frequency = data.frequency;
					break;
				case ID_TEMP: //Temperature
					data.temperature = atof(valstr);
					break;
				case ID_PRESSURE: //Pressure
					data.pressure = atof(valstr);
					break;
				case ID_STATE: //Current VFD State
					data.VFDState = atoi(valstr);
					update.VFDState = data.VFDState;
					break;
				default:
					printf("UNKNOWN TAG ENCOUNTERED, TOKEN: ""%s""\n", token);
			}
		}
		token = strtok(NULL, DELIMS);
	}
	return 1;
}
Exemplo n.º 23
0
void SceneParser::parseBox(void)
{
    parseToken(Scanner::LeftCurly);

    Vector3 minCorner;
    parseVector(minCorner);

    Vector3 maxCorner;
    parseVector(maxCorner);

    Box* b = new Box(minCorner, maxCorner);
    raytracer->addObject(b);

    advance();

    parseMaterial(b);
    parseTransform(b);

    acceptToken(Scanner::RightCurly);
}
Exemplo n.º 24
0
void SceneParser::parseSphere(void)
{
    parseToken(Scanner::LeftCurly);

    Vector3 center;
    parseVector(center);

    float radius;
    parseNumber(radius);

    Sphere* s = new Sphere(center, radius);
    raytracer->addObject(s);

    advance();

    parseMaterial(s);
    parseTransform(s);

    acceptToken(Scanner::RightCurly);
}
Exemplo n.º 25
0
/********************************************************************
* parseServerMessage: parses the current message and 				*
* updates the values sent from the Server 							*
********************************************************************/
int parseServerMessage()
{
	// Message formatting:
	//  	<F=%d,H=%d,T=%d,P=%d,VS=%d><EOF>
	//  	Flow,Freq,Temp,Pres,State
	int id = 0;
	char valstr[32];
	memset(valstr, 0, sizeof(valstr));

	//strtok breaks up the message into tokens, delimited by commas
	char* token = strtok(messageFromServer, DELIMS);
	while(token != NULL)
	{
		if(strcmp(token, EOFSTR) != 0)
		{
			parseToken(token, &id, valstr);
			switch(id)
			{
				case ID_STATE: //Current VFD State
					update.VFDState  = atoi(valstr);
					// update flag
    				LOCK(&flagMutex);
    				SETFLAG(update.updateFlag, UPDATE_STATE);
    				UNLOCK(&flagMutex);
					break;
				case ID_DESIREDFLOW:
					update.desiredFlowRate = atof(valstr);
					// update flag
    				LOCK(&flagMutex);
					SETFLAG(update.updateFlag, UPDATE_FLOW);
    				UNLOCK(&flagMutex);
					break;
				default:
					printf("UNKNOWN TAG ENCOUNTERED, TOKEN: ""%s""\n", token);
			}
		}
		token = strtok(NULL, DELIMS);
	}
	return 1;
}
Exemplo n.º 26
0
void SceneParser::parseCylinder(void)
{
    parseToken(Scanner::LeftCurly);

    Vector3 base;
    parseVector(base);

    float height;
    parseNumber(height);

    float radius;
    parseNumber(radius);

    Cylinder* c = new Cylinder(base, height, radius);
    raytracer->addObject(c);

    advance();
    parseMaterial(c);
    parseTransform(c);

    acceptToken(Scanner::RightCurly);
}
Exemplo n.º 27
0
void SceneParser::parsePlane(void)
{
    parseToken(Scanner::LeftCurly);

    Vector3 center;
    parseVector(center);

    Vector3 right;
    parseVector(right);

    Vector3 up;
    parseVector(up);

    Plane* p = new Plane(center, right, up);
    raytracer->addObject(p);

    advance();
    parseMaterial(p);
    parseTransform(p);

    acceptToken(Scanner::RightCurly);
}
Exemplo n.º 28
0
void SceneParser::parseTriangle(void)
{
    parseToken(Scanner::LeftCurly);

    Vector3* p1 = new Vector3();
    parseVector(*p1);

    Vector3* p2 = new Vector3();
    parseVector(*p2);

    Vector3* p3 = new Vector3();
    parseVector(*p3);

    Triangle* t = new Triangle(p1, p2, p3, true);
    raytracer->addObject(t);

    advance();

    parseMaterial(t);
    parseTransform(t);

    acceptToken(Scanner::RightCurly);
}
Exemplo n.º 29
0
void
SGF::parseInfo(std::string s)
{
    std::vector<std::string> tokens;

    std::string item;
    unsigned pos=0;
    for(auto& c: s)
    {
	switch(c){
	case ']':
	    item += c;
	    if ((pos+1 == s.size() || s[pos+1] != '[') && s[pos-1] != '\\'){
		tokens.push_back(item);
		item.clear();
	    }
	    break;
	default:
	    item += c;
	    break;
	}
	pos++;
    }
    for(auto& i: tokens)
    {
	std::vector<std::string> v;
	parseToken(i, v);

	if (v[0] == "AP") app = v[1];
	else if (v[0] == "AB"){
	    for(unsigned pos=1; pos<v.size(); ++pos){
		Point p;
		p.x = ((int)v[pos][0])-97;
		p.y = ((int)v[pos][1])-97;
		root->AB.push_back(p);
	    }
	}
	else if (v[0] == "AW"){
	    for(unsigned pos=1; pos<v.size(); ++pos){
		Point p;
		p.x = ((int)v[pos][0])-97;
		p.y = ((int)v[pos][1])-97;
		root->AW.push_back(p);
	    }
	}
	else if (v[0] == "C")  comment = v[1];
	else if (v[0] == "CP") copyright = v[1];
	else if (v[0] == "DT") date = v[1];
	else if (v[0] == "EV") event = v[1];
	else if (v[0] == "GC") info = v[1];
	else if (v[0] == "GN") name = v[1];
	else if (v[0] == "HA") handicap = v[1];
	else if (v[0] == "KM") komi = v[1];
	else if (v[0] == "RE") result = v[1];
	else if (v[0] == "LB") {
	    for(unsigned i=1; i<v.size(); i++)
	    {
		std::vector<std::string> ss;
		boost::split(ss, v[i], boost::is_any_of(":"));
		Point p;
		p.x = ((int)ss[0][0])-97;
		p.y = ((int)ss[0][1])-97;
		root->LB.push_back( std::make_pair(p, ss[1]) );
	    }
	}
	else if (v[0] == "PW") white_name = v[1];
	else if (v[0] == "PB") black_name = v[1];
	else if (v[0] == "WR") white_rank = v[1];
	else if (v[0] == "BR") black_rank = v[1];
	else if (v[0] == "PC") place = v[1];
	else if (v[0] == "RU") ruleset = v[1];
	else if (v[0] == "SO") source = v[1];
	else if (v[0] == "ST"){
	    if (v[1] == "0") variations = Variations::successor;
	    else if (v[1] == "1") variations = Variations::current;
	    else if (v[1] == "2") variations = Variations::no_markup;
	    else if (v[1] == "3") variations = Variations::all;
	}
	else if (v[0] == "SZ") size = std::stoi( v[1] );
    }
}
Exemplo n.º 30
0
void
Node::parseString(std::string s)
{
    //
    std::vector<std::string> tokens;

    std::string item;
    unsigned pos=0;
    char b = ' ';
    for(auto& c: s)
    {
	switch(c){
	case ']':
	    item += c;
	    if ((pos+1 == s.size() || s[pos+1] != '[') && b != '\\'){
		tokens.push_back(item);
		item.clear();
	    }
	    break;
	default:
	    item += c;
	    break;
	}
	b = c;
	pos++;
    }
    for(auto& i: tokens)
    {
	std::vector<std::string> v;
	parseToken(i, v);
	// MOVE
	if (v[0] == "B"){
	    x = -1;
	    y = -1;
	    move = Move::black;
	    if (v.size() != 1){
		x = ((int)v[1][0])-97; //97 = 'a';
		y = ((int)v[1][1])-97;
	    }
	}
	else if (v[0] == "W") {
	    move = Move::white;
	    x = -1;
	    y = -1;
	    if (v.size() != 1){
		x = ((int)v[1][0])-97;
		y = ((int)v[1][1])-97;
	    }
	}
	else if (v[0] == "KO")	move = Move::white;
	else if (v[0] == "MN")  number = std::stoi( v[1] );
	// NODE RESTRICTIONS
	else if (v[0] == "AW") {
	    for(unsigned k=1; k<v.size(); ++k){
		Point p;
		p.x = ((int)v[k][0])-97;
		p.y = ((int)v[k][1])-97;
		AW.push_back( p );
	    }
	}
	else if (v[0] == "AB") {
	    for(unsigned k=1; k<v.size(); ++k){
		Point p;
		p.x = ((int)v[k][0])-97;
		p.y = ((int)v[k][1])-97;
		AB.push_back( p );
	    }
	}
	// NODE PROPERTIES
	// for go-online. it may have multiples comment for the same node
	else if (v[0] == "C")	comment += v[1]; 
	//else if (v[0] == "DM")	std::cout << "what?" << std::endl;
	else if (v[0] == "GB")	good_black = true;
	else if (v[0] == "GW")	good_white = true;
	else if (v[0] == "HO")	hotspot = true;
	else if (v[0] == "N")	name = v[1];
	else if (v[0] == "UC")	unclear = true;
	else if (v[0] == "V")	value = std::stod( v[1] );
	// MOVE ANNOTATION
	else if (v[0] == "BM")	bad_move = true;
	else if (v[0] == "DO")	doubtful = true;
	else if (v[0] == "IT")	interest = true;
	else if (v[0] == "TE")	tesuji = true;
	// TIMING PROPERTIES
	else if (v[0] == "BL")	black_time = std::stod( v[1] );
	else if (v[0] == "WL")	white_time = std::stod( v[1] );
	// MARKUP PROPERTIES
	else if (v[0] == "LB"){
	    for(unsigned i=1; i<v.size(); i++)
	    {
		std::vector<std::string> ss;
		boost::split(ss, v[i], boost::is_any_of(":"));
		Point p;
		p.x = ((int)ss[0][0])-97;
		p.y = ((int)ss[0][1])-97;
		LB.push_back( std::make_pair(p, ss[1]) );
	    }
	}
	//else std::cout << "AIO: " << v[0] << std::endl;
    }
    std::stringstream ss;
    ss << depth << "_" << move << "_" << x << "_" << y;
    name = ss.str();
}