Skip to content

Commit

Permalink
removed unneccessary copying (performance improvement)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Kelley committed Jun 5, 2022
1 parent 7fa68a0 commit 1ef448e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions WordleArchive/WordleArchive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ class WordlePlayer {
void printPrevGuesses() {
prepKeyboard();

for (string& guess : valid_guesses) {
for (std::string::size_type i = 0; i < (59 - current_word.word.size()) / 2; ++i) {
for (auto& guess : valid_guesses) {
for (string::size_type i = 0; i < (59 - current_word.word.size()) / 2; ++i) {
cout << Color::defaults << " ";
}
for (string::size_type i = 0; i < current_word.word.size(); ++i) {
Expand All @@ -359,7 +359,7 @@ class WordlePlayer {

// the number of times we've guessed this letter so far
int num_repeats_in_guess_so_far = 0;
std::string::size_type char_prev_loc = guess.find(guess[i]);
string::size_type char_prev_loc = guess.find(guess[i]);
while (char_prev_loc < i) {
++num_repeats_in_guess_so_far;
if (current_word.word[char_prev_loc] == guess[i]) {
Expand Down

0 comments on commit 1ef448e

Please sign in to comment.