Scoring High in Word Games on facebook!


Ever played TextTwirl or WordShuffle on facebook or elsewhere ?
Don't you ever! for they are very addictive as my uber player buddy from Wisconsin warns me. But what can I do, I have my own problems, I'm jobless, there's nothing to do, And I like winning the smart way.

Heres the code:
- #include <iostream>
- using namespace std;
- int main(int argc, char *argv[]){
- string word,check,cword;
- int len,match,count,checksum=0,l;
- if (argc>=3){
- word = argv[1];
- len = word.length();
- for (int i=0;i<len;i++)
- checksum+=word[i];
- freopen (argv[2],"r+",stdin);
- if (argc==4){
- while (cin >> check){
- check[0]=tolower(check[0]);
- if (check.length()<=len && check.length()>=3){
- match = 1; count=0;
- cword=word;
- for (int i=0;i<check.length();i++){
- if (cword.find(check[i]) == string::npos){
- match=0;
- break;
- } else {
- cword[cword.find(check[i])]='_';
- }
- }
- if (match == 1)
- cout << check << endl;
- }
- }
- } else {
- while (cin >> check){
- if (check.length()==len){
- match = 1; count=0;
- for (int i=0;i<len;i++){
- if (word.find(check[i]) == string::npos){
- match=0;
- break;
- } else {
- count+=check[i];
- }
- }
- if (match == 1 && count==checksum)
- cout << check << endl;
- }
- }
- }
- } else {
- cout << "WordWar v0.1\t\t\t(c) Abhishek Mishra\n"
- <<" \t\t\t ideamonk@gmail.com\n\n"
- <<"Usage : "<<argv[0]<<"> <dictionary_file>\n\n";
- }
- return 0;
- }
For this you also need a dictionary. Download dictionary here. This is a very basic dictionary, I recommend you to get better one or try adding 's' etc to this ones results. Compile WordWar in DevCPP/MinGW32 on windows or GCC on linux. Have 1.txt (your dictionary) in the same path. and run it like this ->

enjoy scoring high!
With PHP I can also make a neat live web interface to cheat. :)
happy hacking.

Labels: facebook, game programming, word games
3 Comments:
nice proggy, apart from spoj try being active on topcoder too, in TC you've to keep a track of ongoing srms.
nice blog.
thanks buddy. Yep i'll catchup with TC asap.
Hey there! nice work. I had great fun setting high scores when I was bored.
Post a Comment
Subscribe to Post Comments [Atom]
<< Home