shashi278 / wordbase-hack

Wordbase is a nice game but I'm just sooo bad at it!

Home Page:https://watney.pythonanywhere.com/wordbase-hack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wordbase-Hack

A simple(well, kind of) script to hack into wordbase android game.

How does it work?

In short:
  • It takes up a screenshot image of the game along with your color(i.e. Blue or Orange) and provides you with possible words you can play. Also, you can choose to show only those words which intersects with the opposite color(with a cost of few extra seconds)
In not-so-short:
  • Creating training images
    • create_image from pre-process.py takes an image(screenshot) and breaks it up into 13*10 pieces containing individual letters and save them to a folder called train_images after resizing each of them to 19x16 followed by performing some thresholding stuffs.
  • Training the model
    • Take each image from train_images folder and associate corresponding labels to them(Labels are just respective alphabet letters).
    • Reshape(to 1D) and normalize(0 to 255 => 0 to 1) the image array.
    • Finally, train the model upon reshaped-array using LinearSVC method from sklearn.svm and save the model with the name svm_model in the root directory.
  • Generating letter grid
    • get_grid from pre-process.py uses the above trained model to produce an exact grid(2D-array) of letters from a given screenshot along with lists containing positions of blue and orange tiles.
  • Finally, getting words
    • Finally, solve from main.py uses the grid to filter out possible words starting from position of given-colour tiles.
    • It uses a list of English words, which is stored as a list in word_list.py, to compare for possible words.
    • Why not use word_list.txt directly rather than saving it in a .py file and then using the .py file? Because importing .py file will create a .pyc file upon first execution of the script which will be used in further execution thereby cutting down the execution time almost by a factor of 10.
    • For depth understanding of word-generation, consider reading the codebase :)

How to use?

  • Head to the src folder and run main.py after setting your-path-to-screenshot as the first argument and color as the second argument to solve. You can also specify the minimum length of the words(defaults to 4) and whether to get only words which intersect the opponent's base(defaults to True) by setting optional parameters min_length and only_intersection respectively of solve.
  • Or, you may just go to the above link in the description. Now, for some reasons the website doesn't work as expected in a row on a given image(meaning, you may need to close the current tab and open the link all over again, no promises tho)

About

Wordbase is a nice game but I'm just sooo bad at it!

https://watney.pythonanywhere.com/wordbase-hack

License:GNU General Public License v3.0


Languages

Language:Python 99.9%Language:HTML 0.1%