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 baaad1c commit 7d50efa
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/06/Solution/ch6_horseplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ std::vector<std::string> knight_moves(std::string knight){
std::vector<std::string> moves;
int x, y;
x = knight[0] - 'a' + 1;
y = knight[1]-'0';
y = knight[1] - '0';
const int delta1[2] = {-1, 1};
const int delta2[2] = {-2, 2};

Expand Down Expand Up @@ -53,12 +53,20 @@ std::vector<std::string> knight_moves(std::string knight){
// Main function
int main(){
std::string knight = "d5";

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

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

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

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

return 0;
}

0 comments on commit 7d50efa

Please sign in to comment.