UciParser.cpp 610 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #include "UciParser.h"
  2. #include <sstream>
  3. #include "ChessGame.h"
  4. using namespace std;
  5. int UciParser::parse(istream& in, ostream& out)
  6. {
  7. while (!in.eof()) {
  8. string line;
  9. getline(in, line);
  10. executeLine(line);
  11. }
  12. return 0;
  13. }
  14. int UciParser::executeLine(const string& line)
  15. {
  16. stringstream s {line};
  17. string token;
  18. string command;
  19. vector<string> args;
  20. s >> command;
  21. while (s >> token) {
  22. args.push_back(token);
  23. }
  24. executeCommand(command, args);
  25. }
  26. int UciParser::executeCommand(const string& command,
  27. const vector<string>& args)
  28. {
  29. }