-
- while(!uip.at_end_of_line()) {
- token = uip.get_next_token();
-
- if(token == "infinite")
- infinite = true;
- else if(token == "ponder")
- ponder = true;
- else if(token == "wtime") {
- if(!uip.at_end_of_line())
- time[0] = atoi(uip.get_next_token().c_str());
- }
- else if(token == "btime") {
- if(!uip.at_end_of_line())
- time[1] = atoi(uip.get_next_token().c_str());
- }
- else if(token == "winc") {
- if(!uip.at_end_of_line())
- inc[0] = atoi(uip.get_next_token().c_str());
- }
- else if(token == "binc") {
- if(!uip.at_end_of_line())
- inc[1] = atoi(uip.get_next_token().c_str());
- }
- else if(token == "movestogo") {
- if(!uip.at_end_of_line())
- movesToGo = atoi(uip.get_next_token().c_str());
- }
- else if(token == "depth") {
- if(!uip.at_end_of_line())
- depth = atoi(uip.get_next_token().c_str());
- }
- else if(token == "nodes") {
- if(!uip.at_end_of_line())
- nodes = atoi(uip.get_next_token().c_str());
- }
- else if(token == "movetime") {
- if(!uip.at_end_of_line())
- moveTime = atoi(uip.get_next_token().c_str());
- }
- else if(token == "searchmoves" && !uip.at_end_of_line()) {
- int numOfMoves = 0;
- while(!uip.at_end_of_line()) {
- token = uip.get_next_token();
- searchMoves[numOfMoves++] = move_from_string(RootPosition, token);
+ infinite = ponder = false;
+ movesToGo = depth = nodes = moveTime = numOfMoves = 0;
+
+ while (up >> token)
+ {
+ if (token == "infinite")
+ infinite = true;
+ else if (token == "ponder")
+ ponder = true;
+ else if (token == "wtime")
+ up >> time[0];
+ else if (token == "btime")
+ up >> time[1];
+ else if (token == "winc")
+ up >> inc[0];
+ else if (token == "binc")
+ up >> inc[1];
+ else if (token == "movestogo")
+ up >> movesToGo;
+ else if (token == "depth")
+ up >> depth;
+ else if (token == "nodes")
+ up >> nodes;
+ else if (token == "movetime")
+ up >> moveTime;
+ else if (token == "searchmoves")
+ {
+ while (up >> token)
+ searchMoves[numOfMoves++] = move_from_uci(pos, token);
+
+ searchMoves[numOfMoves] = MOVE_NONE;