My Bull Cow Game has three .txt lists, one for each difficulty level. Rather than sorting through the thousand+ words myself I just quickly put this together.
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
bool IsIsogram(string Word, int NotIso)
{
for (int j = 0; j < Word.length(); j++)
{
for (int h = j + 1; h < Word.length(); h++)
{
if (Word[j] == Word[h])
{
system("cls");
cout << "Non-Isogram Words: " << NotIso << endl;
return false;
}
}
}
return true;
}
int main ()
{
fstream HugeList;
HugeList.open("WordList.txt", ios::in);
ofstream List1;
ofstream List2;
ofstream List3;
List1.open ("EasyWordList.txt"); // You could direct these straight into the appropirate BullCowGame file & you could name them whatever you'd like
List2.open ("NormalWordList.txt");
List3.open ("HardWordList.txt");
if (HugeList.is_open())
{
int NotIso = 1;
string Word;
while(getline(HugeList, Word))
{
if (IsIsogram(Word, NotIso)) // checks if words are isograms NOTE: Thinks A != a, B != b, etc...
{
if (Word.length() == 3 || Word.length() == 4 || Word.length() == 5)
{
List1 << Word << endl;
}
if (Word.length() == 6 || Word.length() == 7)
{
List2 << Word << endl;
}
if (Word.length() >= 8)
{
List3 << Word << endl;
}
}
else
{
NotIso++;
}
}
}
List1.close();
List2.close();
List3.close();
HugeList.close();
return 0;
}
I created the WordList.txt file in the same location as this .cpp. Then I copied and pasted several online word lists into the WordList.txt, and ran the .cpp. It filters out all the non-isogram words (Except those with capitol first letters) and assigns the isograms to the other three lists. The length of the isogram determines which list it gets placed into. Additional/Alternate filters could easily be applied, and I plan on creating one to supplement the current isogram filter shortcoming. Hopefully someone here finds this helpful or interesting.