Skip to content

Commit

Permalink
Update ch6_horseplay.cpp
Browse files Browse the repository at this point in the history
Main code before refinemenrs
  • Loading branch information
L50six authored May 11, 2024
1 parent 98f8776 commit 35075a6
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/06/Challenge/ch6_horseplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,24 @@ std::vector<std::string> knight_moves(std::string knight){
}

vector<KnightMove> KnightMoves = {
{1,2},{-1,2},{-1,-2}, {-1,2},
{1,2},{-1,2},{-1,-2}, {1,-2},
{2,1},{-2,1},{-2,-1},{2,-1}
};

x = static_cast<int>(knight[[0]);
y = static_cast<int>(knight[[1]);

// needs assci offset

for (const KnightMove& move: KnightMoves) {
x += move.dx;
y += move.dy;
if ((x > 0) && (x<9) && (y > 0) && (y<9)) {
moves.push_back(std::itos(x),std::itos(y))
// columns need to be converrted to letterw.
}
}

return moves;
}

Expand Down

0 comments on commit 35075a6

Please sign in to comment.