Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kuashio committed Nov 30, 2022
1 parent b7e4234 commit 292b175
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 29 deletions.
22 changes: 7 additions & 15 deletions src/06/Challenge/ch6_horseplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,16 @@ std::vector<std::string> knight_moves(std::string knight){

// Main function
int main(){
std::string knight;
std::vector<std::string> moves1, moves2;
std::string knight = "d5";

std::cout << "Enter the location of the knight: " << std::flush;
std::cin >> knight;

knight = "d5";
moves1 = knight_moves(knight);
std::vector<std::string> the_moves = knight_moves(knight);
std::cout << std::endl << "Possible moves from " << knight << ": ";

for (auto element : moves1)
for (auto element : the_moves)
std::cout << element << " ";
std::cout << std::endl << std::endl << std::flush;

knight = "h7";
moves2 = knight_moves(knight);
std::cout << std::endl << "Possible moves from " << knight << ": ";

for (auto element : moves2)
std::cout << element << " ";
std::cout << std::endl << std::endl << std::flush;

return 0;
}
}
20 changes: 6 additions & 14 deletions src/06/Solution/ch6_horseplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,16 @@ std::vector<std::string> knight_moves(std::string knight){

// Main function
int main(){
std::string knight;
std::vector<std::string> moves1, moves2;

knight = "d5";
moves1 = knight_moves(knight);
std::cout << std::endl << "Possible moves from " << knight << ": ";

for (auto element : moves1)
std::cout << element << " ";
std::cout << std::endl << std::endl << std::flush;
std::string knight = "d5";

std::cout << "Enter the location of the knight: " << std::flush;
std::cin >> knight;

knight = "h7";
moves2 = knight_moves(knight);
std::vector<std::string> the_moves = knight_moves(knight);
std::cout << std::endl << "Possible moves from " << knight << ": ";

for (auto element : moves2)
for (auto element : the_moves)
std::cout << element << " ";
std::cout << std::endl << std::endl << std::flush;

return 0;
}

0 comments on commit 292b175

Please sign in to comment.