mirror of
https://github.com/NohamR/puzzel-solver.git
synced 2026-11-25 15:39:46 +00:00
solver
This commit is contained in:
1 parent
e607871100
commit
eab9691e65
2 files changed
+28
-8
No files matched your search
@@ -1 +1 @@
|
|||||||
Solver for puzzel.org (https://puzzel.org/fr/crossword/play?p=-NwO-VUAR1gKHH_buvut)
|
Solver for puzzel.org (ex : https://puzzel.org/fr/crossword/play?p=-NwO-VUAR1gKHH_buvut)
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
from pprint import pprint
|
|
||||||
import json
|
import json
|
||||||
|
from pprint import pprint
|
||||||
|
import websocket
|
||||||
|
|
||||||
def decode_sentence(sentence):
|
def decode_sentence(sentence):
|
||||||
decoded_words = []
|
decoded_words = []
|
||||||
@@ -12,19 +13,38 @@ def decode_sentence(sentence):
|
|||||||
decoded_words.append(word)
|
decoded_words.append(word)
|
||||||
return ' '.join(decoded_words)
|
return ' '.join(decoded_words)
|
||||||
|
|
||||||
dict = {"t":"d","d":{"r":7,"b":{"s":"ok","d":{"grid":{"0":{"0":"@","1":"@","2":"@","3":"@","4":"@","5":"@","6":"@","7":"@","8":"@","9":"@","10":"@","11":"@","12":"@","13":"@","14":"@","15":"@","16":"@","17":"@","18":"@","19":"@","20":"@","21":"@","22":"@","23":"@","24":"@","25":"é","26":"@","27":"@","28":"@","29":"@","30":"@","31":"@","32":"@","33":"@","34":"@","35":"@","36":"@","37":"@","38":"@","39":"@","40":"@"},"1":{"0":"@","1":"@","2":"@","3":"@","4":"@","5":"@","6":"@","7":"@","8":"@","9":"@","10":"@","11":"@","12":"@","13":"@","14":"@","15":"@","16":"@","17":"@","18":"@","19":"d","20":"@","21":"@","22":"@","23":"@","24":"@","25":"q","26":"@","27":"@","28":"@","29":"@","30":"a","31":"@","32":"@","33":"@","34":"@","35":"@","36":"@","37":"@","38":"p","39":"@","40":"i"},"2":{"0":"@","1":"@","2":"@","3":"@","4":"@","5":"@","6":"@","7":"@","8":"@","9":"@","10":"@","11":"@","12":"@","13":"@","14":"@","15":"@","16":"@","17":"@","18":"@","19":"é","20":"@","21":"@","22":"@","23":"a","24":"@","25":"u","26":"@","27":"@","28":"@","29":"@","30":"m","31":"@","32":"@","33":"@","34":"@","35":"@","36":"@","37":"@","38":"r","39":"@","40":"n"},"3":{"0":"@","1":"@","2":"@","3":"@","4":"@","5":"@","6":"@","7":"@","8":"@","9":"@","10":"@","11":"@","12":"@","13":"@","14":"@","15":"@","16":"@","17":"@","18":"@","19":"f","20":"@","21":"r","22":"e","23":"s","24":"p","25":"i","26":"r","27":"a","28":"t","29":"i","30":"o","31":"n","32":"@","33":"@","34":"@","35":"@","36":"f","37":"@","38":"o","39":"@","40":"d"},"4":{"0":"@","1":"@","2":"@","3":"@","4":"@","5":"@","6":"@","7":"@","8":"@","9":"@","10":"@","11":"@","12":"@","13":"@","14":"@","15":"@","16":"@","17":"@","18":"@","19":"o","20":"@","21":"@","22":"@","23":"t","24":"@","25":"l","26":"@","27":"@","28":"@","29":"@","30":"r","31":"@","32":"@","33":"@","34":"@","35":"@","36":"o","37":"@","38":"t","39":"@","40":"i"},"5":{"0":"@","1":"@","2":"d","3":"i","4":"o","5":"x","6":"y","7":"d","8":"e","9":"d","10":"e","11":"c","12":"a","13":"r","14":"b","15":"o","16":"n","17":"e","18":"@","19":"r","20":"@","21":"m","22":"@","23":"h","24":"@","25":"i","26":"@","27":"@","28":"@","29":"@","30":"t","31":"@","32":"p","33":"@","34":"@","35":"@","36":"r","37":"@","38":"o","39":"@","40":"c"},"6":{"0":"@","1":"@","2":"@","3":"@","4":"@","5":"@","6":"@","7":"@","8":"@","9":"@","10":"@","11":"@","12":"s","13":"@","14":"@","15":"@","16":"@","17":"@","18":"@","19":"e","20":"@","21":"u","22":"@","23":"m","24":"@","25":"b","26":"@","27":"@","28":"@","29":"@","30":"i","31":"@","32":"é","33":"@","34":"@","35":"@","36":"ç","37":"@","38":"c","39":"@","40":"a"},"7":{"0":"@","1":"@","2":"p","3":"a","4":"l","5":"é","6":"o","7":"c","8":"l","9":"i","10":"m","11":"a","12":"t","13":"@","14":"@","15":"m","16":"@","17":"@","18":"@","19":"s","20":"@","21":"t","22":"@","23":"a","24":"@","25":"r","26":"@","27":"@","28":"@","29":"@","30":"s","31":"@","32":"t","33":"@","34":"f","35":"@","36":"a","37":"@","38":"o","39":"@","40":"t"},"8":{"0":"@","1":"@","2":"@","3":"@","4":"@","5":"@","6":"@","7":"@","8":"@","9":"@","10":"@","11":"@","12":"é","13":"@","14":"@","15":"i","16":"@","17":"@","18":"@","19":"t","20":"@","21":"a","22":"@","23":"t","24":"@","25":"é","26":"@","27":"@","28":"@","29":"@","30":"s","31":"@","32":"r","33":"@","34":"o","35":"@","36":"g","37":"@","38":"l","39":"@","40":"e"},"9":{"0":"@","1":"@","2":"@","3":"l","4":"i","5":"t","6":"h","7":"o","8":"s","9":"p","10":"h","11":"è","12":"r","13":"e","14":"@","15":"c","16":"@","17":"@","18":"@","19":"a","20":"@","21":"g","22":"@","23":"i","24":"@","25":"s","26":"@","27":"@","28":"v","29":"i","30":"e","31":"h","32":"o","33":"r","34":"s","35":"d","36":"e","37":"l","38":"e","39":"a","40":"u"},"10":{"0":"@","1":"@","2":"@","3":"@","4":"@","5":"@","6":"@","7":"z","8":"@","9":"@","10":"@","11":"@","12":"o","13":"@","14":"@","15":"r","16":"@","17":"@","18":"@","19":"t","20":"@","21":"è","22":"@","23":"q","24":"@","25":"@","26":"@","27":"@","28":"@","29":"@","30":"u","31":"@","32":"l","33":"@","34":"s","35":"@","36":"r","37":"@","38":"d","39":"@","40":"r"},"11":{"0":"c","1":"@","2":"@","3":"@","4":"@","5":"@","6":"@","7":"o","8":"@","9":"@","10":"@","11":"d","12":"i","13":"s","14":"s","15":"o","16":"l","17":"u","18":"t","19":"i","20":"o","21":"n","22":"@","23":"u","24":"@","25":"@","26":"@","27":"@","28":"@","29":"@","30":"r","31":"@","32":"e","33":"@","34":"i","35":"@","36":"a","37":"@","38":"e","39":"@","40":"c"},"12":{"0":"e","1":"@","2":"@","3":"@","4":"@","5":"@","6":"@","7":"n","8":"@","9":"@","10":"@","11":"@","12":"d","13":"@","14":"@","15":"p","16":"@","17":"@","18":"@","19":"o","20":"@","21":"e","22":"@","23":"e","24":"@","25":"@","26":"@","27":"@","28":"@","29":"@","30":"@","31":"@","32":"@","33":"@","34":"l","35":"@","36":"d","37":"@","38":"m","39":"@","40":"l"},"13":{"0":"n","1":"@","2":"@","3":"@","4":"@","5":"@","6":"@","7":"e","8":"@","9":"@","10":"@","11":"@","12":"e","13":"@","14":"@","15":"a","16":"@","17":"@","18":"@","19Line truncated
|
pageid = '-NwO-VUAR1gKHH_buvut'
|
||||||
# pprint(dict)
|
|
||||||
|
|
||||||
# with open('file.json','w') as f:
|
ws = websocket.WebSocket()
|
||||||
# json.dump(dict, f, indent=2)
|
ws.connect("wss://s-usc1b-nss-2107.firebaseio.com/.ws?v=5&ns=puzzelorg")
|
||||||
|
|
||||||
|
initial_message = ws.recv()
|
||||||
|
|
||||||
|
request_message = {"t": "d", "d": {"r": 3, "a": "g", "b": {"p": f"/index/{pageid}", "q": {}}}}
|
||||||
|
ws.send(json.dumps(request_message))
|
||||||
|
response = ws.recv()
|
||||||
|
id = json.loads(response)['d']['b']['d']
|
||||||
|
|
||||||
|
request_message = {"t":"d","d":{"r":7,"a":"g","b":{"p":f"/fields/{id}/{pageid}","q":{}}}}
|
||||||
|
ws.send(json.dumps(request_message))
|
||||||
|
nbres = ws.recv()
|
||||||
|
mess = ''
|
||||||
|
for i in range(len(nbres)+1):
|
||||||
|
mess += ws.recv()
|
||||||
|
ws.close()
|
||||||
|
|
||||||
|
dict = json.loads(mess)
|
||||||
|
|
||||||
answers = dict['d']['b']['d']['grid']
|
answers = dict['d']['b']['d']['grid']
|
||||||
|
|
||||||
def getanswer(x,y):
|
def getanswer(x,y):
|
||||||
return answers[f'{y}'][f'{x}'].encode('latin1').decode('utf-8')
|
try :
|
||||||
|
return answers[f'{y}'][f'{x}'].encode('latin1').decode('utf-8')
|
||||||
|
except:
|
||||||
|
return answers[f'{y}'][f'{x}']
|
||||||
|
|
||||||
words = dict['d']['b']['d']['wordsPlaced']
|
words = dict['d']['b']['d']['wordsPlaced']
|
||||||
for i in range(45):
|
for i in range(len((dict['d']['b']['d']['wordsPlaced']))):
|
||||||
desc = words[f'{i}']['description']
|
desc = words[f'{i}']['description']
|
||||||
word = ''
|
word = ''
|
||||||
for j in range(len(words[f'{i}']['coords'])):
|
for j in range(len(words[f'{i}']['coords'])):
|
||||||
|
|||||||
Reference in new issue
Block a user