All right, here’s the result of me getting a bit carried away, I guess… I tried to reshape quite a bit of the underlying structure. Some feedback on whether or not it makes sense would be great.
Something of interest to all, though, would be the dictionaries I included in the upload. If you want to extend your selection of words, go ahead and use these lists!
If you’re also still on the course, have fun with the rest and see you around!
Ah, nice suggestion! I didn’t know about it… Cheers! (learning new things every day, eh )
Only advantage of pseudo-random, I guess, is the ability to fix the seed and have the same words picked every time for testing purposes.
This simply because I decided to print past guesses in inverse-chronological order while using a lazy range-based for and without having to reverse the list. So I needed to have a ‘push_front’ method for the guess history.
Then rather than using a different container for the dictionary, since deque and vector (from my limited experience) are pretty much the same… Bah, otherwise no particular reason.
First I did have a different solution, where guesses were stored in a map<Guess, Score>, making the lookup trivial. But eventually I thought I preferred to have them stored in chronological order.
I know, I know. But that’s how lazy I am… (maybe more like I haven’t been using range-based loops much so far, so wanted excuses to try them out)
Otherwise fair point about guaranteeing contiguous storage of the dictionary. Maybe I should change that.
I also just thought that I could probably still store the previous guesses in a map, and have an extra vector of iterators to its elements to keep track of the chronology.