diff --git a/wordle.cpp b/wordle.cpp new file mode 100644 index 0000000..aa2b987 --- /dev/null +++ b/wordle.cpp @@ -0,0 +1,148 @@ +#include +#include +#include +using namespace std; +string wrds[9999],chn[9999],line; +string user,sys,trans,gsd; +int i,j,k,th=0,life=6; +int c;bool reset=true; +ifstream ifile("dictionary7.txt"); +HANDLE hout=GetStdHandle(STD_OUTPUT_HANDLE); +char tc(int inte){return inte;} +void play(); +int search(string arr[],int sise,string targ){ + for(k=0;k<=sise;k++){ + if(arr[k]==targ){return k;} + } + return -1; +} +void color(string clr){ + if(clr=="white"){ + SetConsoleTextAttribute(hout,FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE); + } + else if(clr=="yellow"){ + SetConsoleTextAttribute(hout,FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED); + } + else if(clr=="cyan"){ + SetConsoleTextAttribute(hout,FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE); + } + else if(clr=="green"){ + SetConsoleTextAttribute(hout,FOREGROUND_INTENSITY|FOREGROUND_GREEN); + } + else if(clr=="red"){ + SetConsoleTextAttribute(hout,FOREGROUND_INTENSITY|FOREGROUND_RED); + } +} +void cons(){ + int sise; + while(getline(ifile,line)){ + sise=line.size(); + for(i=0;i>choice; + if(choice=='Y'){ + reset=true;play(); + } + else if(choice=='N'){exit(0);} +} +void play(){ + if(reset){ + th=rand()%1078; + sys=wrds[th];trans=chn[th];reset=false;user=""; + life=6;gsd=""; + } + //cout<