Skip to content

Commit

Permalink
Return getline success on UciParser::take_input
Browse files Browse the repository at this point in the history
  • Loading branch information
Aryan1508 committed May 7, 2021
1 parent a3600a0 commit bc72e65
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 1 addition & 3 deletions Bit-Genie/src/uci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,8 @@ void uci_input_loop(int argc, char **argv)
return;
}

while (true)
while (command.take_input())
{
command.take_input();

if (command == UciCommands::quit)
{
uci_stop(worker);
Expand Down
5 changes: 3 additions & 2 deletions Bit-Genie/src/uciparse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@
#include "piece.h"
#include <utility>

void UciParser::take_input()
bool UciParser::take_input()
{
std::getline(std::cin, command);
auto& val = std::getline(std::cin, command);
trim(command);
return bool(val);
}

int UciParser::parse_perft() const
Expand Down
2 changes: 1 addition & 1 deletion Bit-Genie/src/uciparse.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class UciParser
UciParser() = default;

bool operator==(UciCommands) const;
void take_input();
bool take_input();

std::pair<std::string, std::vector<std::string>>
parse_position_command() const;
Expand Down

0 comments on commit bc72e65

Please # to comment.