A simple(well, kind of) script to hack into wordbase android game.
- 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)
-
create_image
frompre-process.py
takes an image(screenshot) and breaks it up into 13*10 pieces containing individual letters and save them to a folder calledtrain_images
after resizing each of them to 19x16 followed by performing some thresholding stuffs.
-
- 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 fromsklearn.svm
and save the model with the namesvm_model
in the root directory.
- Take each image from
-
get_grid
frompre-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,
solve
frommain.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 :)
- Finally,
- Head to the
src
folder and runmain.py
after setting your-path-to-screenshot as thefirst argument
and color as thesecond argument
tosolve
. 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 toTrue
) by setting optional parametersmin_length
andonly_intersection
respectively ofsolve
. - 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)