A hangman game cryptogram solver | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

A hangman game cryptogram solver

Hangman type game but no guess limit. This game has quotes (funny, inspiration, love..) with single or 2 letters revealed. Rest are blanks. Each quote has the type (") and who wrote it. I have A website which has a english words which i found for another project. What I want to do. Compare the number of letters and the revealed letter's position in a word of the quote with the website. This will give me all possible results. Which I'll use it in the game and win maybe. Eg. I just put A??LE the program must return me APPLE, ANKLE and other possible values Counting on you guys. You've always helped me through all my game cheats. I'm also attaching my previous cheat. It helped me guess words out of random letters. https://code.sololearn.com/czbZnrz4tEso/?ref=app https://code.sololearn.com/czbZnrz4tEso/?ref=app

10th Apr 2020, 12:28 PM
Akhil Padmanabhan
Akhil Padmanabhan - avatar
1 Answer
+ 1
if you have a bag of words, and you can generate a string with, the ? in (a??ple), you can, word by word in the bag of words, use levenshtein to know the number of different characters between the selected word in the bag of words and your string, if the number of differences is the same than the number of ?, it can be your word. You will need to import numpy module, despite of this, this will be slow. in pseudocode would be this: listofwords = ["anchor", "ankle", "apple",...] word = input #converted to a list char by char and casted to numpy numInt = 0 for c in word: if c == ?: numInt ++ for w in listofwords: wordaux = word#convert word into a splited list char by char and convert to numpy itcanbe = levenshtein(wordaux,word,numInt) if itcanbe: print(wordaux) You should implement levenshtein that applays levenshtein algorithm( you can find how it very easy by searching in google) and return a boolean, if numInt==differences betw str
11th Apr 2020, 4:09 AM
Vicente Gras Mas
Vicente Gras Mas - avatar